Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def make_initial_state(self, segment_id, base_state):
state = copy.deepcopy(base_state)
segments = self.get_state_segment_ids(state)
segments.clear()
segments.add(segment_id)
state.layers[self.point_annotation_layer_name] = neuroglancer.PointAnnotationLayer()
return state
source=segmentation_url,
segments=set(x for x, seeds in six.viewitems(supervoxel_map) if len(seeds) > 1),
),
visible=False,
)
state.layers.append(
name='split',
layer=neuroglancer.SegmentationLayer(
source=segmentation_url,
equivalences=cur_eqs,
segments=set(cur_eqs[x] for x in agglo_members),
))
for label, component in six.viewitems(split_seeds):
state.layers.append(
name='seed%d' % label,
layer=neuroglancer.PointAnnotationLayer(
points=[seed['position'] for seed in component],
),
)
state.show_slices = False
state.layout = '3d'
all_seed_points = [
seed['position'] for component in six.viewvalues(split_seeds) for seed in component
]
state.voxel_coordinates = np.mean(all_seed_points, axis=0)
return state