import napari
-from pathlib import Path
-from cellfinder_core.tools.IO import read_with_dask
-
-viewer = napari.viewer.current_viewer()
-
-# adapt "path/to/data" to your folder of tiffs
-path_to_data = Path("path/to/data")
-viewer.open(path_to_data)
-
-print(viewer.layers)
-
-# which of these is quicker?
-%timeit -r 3-n 1 viewer.open(path_to_data)
-%timeit -r 3-n 1 viewer.add_image(read_with_dask(str(path_to_data)))
+
import napari
+from pathlib import Path
+from cellfinder_core.tools.IO import read_with_dask
+
+viewer = napari.viewer.current_viewer()
+
+# adapt "path/to/data" to your folder of tiffs
+path_to_data = Path("path/to/data")
+viewer.open(path_to_data)
+
+print(viewer.layers)
+
+# which of these is quicker?
+%timeit -r 3-n 1 viewer.open(path_to_data)
+%timeit -r 3-n 1 viewer.add_image(read_with_dask(str(path_to_data)))
Example script (demo)
-
import napari
-from bg_atlasapi import BrainGlobeAtlas
-from brainrender_napari.napari_atlas_representation import NapariAtlasRepresentation
-
-# setup a napari viewer and a brainglobe atlas
-viewer = napari.viewer.Viewer()
-viewer.dims.ndisplay =3# set to 3d mode
-atlas = BrainGlobeAtlas("allen_mouse_100um")
-
-# find all hippocampal regions
-hip_id =1080# the id of the hippocampus is 1080
-hip_regions = [
- region["acronym"]
-for region in atlas.structures_list
-if hip_id in region["structure_id_path"]
-]
-
-# make a representation of the brainglobe atlas in napari
-napari_atlas = NapariAtlasRepresentation(atlas, viewer)
-
-# add all hippocampal regions to the napari viewer
-for hip_region in hip_regions:
- napari_atlas.add_structure_to_viewer(hip_region)
-
-# add the whole brain mesh as a help for orientation
-napari_atlas.add_structure_to_viewer("root")
-
-# run this script
-if__name__=="__main__":
- napari.run()
+
import napari
+from bg_atlasapi import BrainGlobeAtlas
+from brainrender_napari.napari_atlas_representation import NapariAtlasRepresentation
+
+# setup a napari viewer and a brainglobe atlas
+viewer = napari.viewer.Viewer()
+viewer.dims.ndisplay =3# set to 3d mode
+atlas = BrainGlobeAtlas("allen_mouse_100um")
+
+# find all hippocampal regions
+hip_id =1080# the id of the hippocampus is 1080
+hip_regions = [
+ region["acronym"]
+for region in atlas.structures_list
+if hip_id in region["structure_id_path"]
+]
+
+# make a representation of the brainglobe atlas in napari
+napari_atlas = NapariAtlasRepresentation(atlas, viewer)
+
+# add all hippocampal regions to the napari viewer
+for hip_region in hip_regions:
+ napari_atlas.add_structure_to_viewer(hip_region)
+
+# add the whole brain mesh as a help for orientation
+napari_atlas.add_structure_to_viewer("root")
+
+# run this script
+if__name__=="__main__":
+ napari.run()