How to use the neuroglancer.parse_url function in neuroglancer

To help you get started, we’ve selected a few neuroglancer examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github google / neuroglancer / python / neuroglancer / tool / video_tool.py View on Github external
def load_script(script_path, transition_duration=1):
    keypoints = []
    with open(script_path, 'r') as f:
        while True:
            url = f.readline()
            if not url:
                break
            line = f.readline()
            if not line:
                duration = transition_duration
            else:
                duration = float(line)
            keypoints.append({
                'state': neuroglancer.parse_url(url),
                'transition_duration': duration
            })
    return keypoints
github google / neuroglancer / python / examples / extend_segments_tool.py View on Github external
def add_segments_from_state(self, base_state):
        if isinstance(base_state, basestring):
            base_state = neuroglancer.parse_url(base_state)
        elif isinstance(base_state, dict):
            base_state = neuroglancer.ViewerState(base_state)

        segment_ids = self.get_state_segment_ids(base_state)

        existing_segment_ids = self.get_existing_segment_ids()

        for segment_id in segment_ids:
            if segment_id in existing_segment_ids:
                print('Skipping redundant segment id %d' % segment_id)
                continue
            self.states.append(self.make_initial_state(segment_id, base_state))

        if self.state_index is None:
            self.next_state()