Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
with viewer.config_state.txn() as s:
s.input_event_bindings.data_view['dblclick0'] = 'select-custom'
with viewer.txn() as s:
s.projection_orientation = [0.63240087, 0.01582051, 0.05692779, 0.77238464]
s.dimensions = dimensions
s.position = [3000, 3000, 3000]
s.layers['image'] = neuroglancer.ImageLayer(
source='precomputed://gs://neuroglancer-public-data/flyem_fib-25/image',
)
s.layers['ground_truth'] = neuroglancer.SegmentationLayer(
source='precomputed://gs://neuroglancer-public-data/flyem_fib-25/ground_truth',
)
s.layers['partners'] = neuroglancer.SegmentationLayer(
source='precomputed://gs://neuroglancer-public-data/flyem_fib-25/ground_truth',
)
s.layers['synapses'] = neuroglancer.LocalAnnotationLayer(
dimensions=dimensions,
linked_segmentation_layer='ground_truth')
s.layout = neuroglancer.row_layout([
neuroglancer.LayerGroupViewer(
layout='xy',
layers=['image', 'ground_truth', 'partners', 'synapses'],
),
neuroglancer.LayerGroupViewer(
layout='3d',
layers=['ground_truth', 'synapses'],
),
neuroglancer.LayerGroupViewer(
layout='3d',
layers=['partners', 'synapses'],
),
])
def _start_flood_fill(self, pos):
self._stop_flood_fill()
inf_results = zarr.zeros(
self.gt_vol.bounds.to_list()[3:], chunks=(64, 64, 64), dtype=np.uint8)
inf_volume = neuroglancer.LocalVolume(
data=inf_results, dimensions=self.dimensions)
with self.viewer.txn() as s:
s.layers['points'] = neuroglancer.LocalAnnotationLayer(self.dimensions)
s.layers['inference'] = neuroglancer.ImageLayer(
source=inf_volume,
shader='''
void main() {
float v = toNormalized(getDataValue(0));
vec4 rgba = vec4(0,0,0,0);
if (v != 0.0) {
rgba = vec4(colormapJet(v), 1.0);
}
emitRGBA(rgba);
}
''',
)
self.flood_fill_event = threading.Event()
t = threading.Thread(
target=self._do_flood_fill,