diff --git a/index.html b/index.html index 15ef185..fe252ce 100644 --- a/index.html +++ b/index.html @@ -450,7 +450,7 @@

Command line installation

Create a new conda environment and install napari

conda create --name brainglobe python=3.10 -y
 conda activate brainglobe
-conda install napari -c conda-forge
+conda install -c conda-forge napari pyqt

Double-check that running

napari

opens a new napari window.

@@ -471,6 +471,33 @@

Command line installation

+
+

Command line installation (alternative)

+
+

Create a new conda environment and install napari with pip

+
conda create --name brainglobe python=3.10 -y
+conda activate brainglobe
+pip install "napari[pyqt5]"
+

Double-check that running

+
napari
+

opens a new napari window.

+
+
+
+
+
+
+ +
+

More details

+
+
+

More details about using conda are available at brainglobe.info

+
+
+
+
+

Install brainglobe napari plugins

@@ -483,12 +510,12 @@

Install brainglobe napari plugins

Run this first:

-
conda install hdf5
+
conda install hdf5

Install all brainglobe tools with

-
pip install brainglobe
+
pip install brainglobe

Initial checkup

@@ -559,29 +586,29 @@

BrainGlobe Atlas API

BrainGlobe Atlas API

-
from pprint import pprint
-from bg_atlasapi.bg_atlas import BrainGlobeAtlas
-atlas = BrainGlobeAtlas("allen_mouse_25um")
-
-# reference image
-reference_image = atlas.reference
-print(reference_image.shape)
-# (528, 320, 456)
-
-# hemispheres image (value 1 in left hemisphere, 2 in right)
-hemispheres_image = atlas.hemispheres
-print(hemispheres_image.shape)
-# (528, 320, 456)
-
-VISp = atlas.structures["VISp"]
-pprint(VISp)
-# {'acronym': 'VISp',
-#  'id': 385,
-#  'mesh': None,
-#  'mesh_filename': PosixPath('/home/user/.brainglobe/allen_mouse_25um_v0.3/meshes/385.obj')
-#  'name': 'Primary visual area',
-#  'rgb_triplet': [8, 133, 140],
-#  'structure_id_path': [997, 8, 567, 688, 695, 315, 669, 385]}
+
from pprint import pprint
+from bg_atlasapi.bg_atlas import BrainGlobeAtlas
+atlas = BrainGlobeAtlas("allen_mouse_25um")
+
+# reference image
+reference_image = atlas.reference
+print(reference_image.shape)
+# (528, 320, 456)
+
+# hemispheres image (value 1 in left hemisphere, 2 in right)
+hemispheres_image = atlas.hemispheres
+print(hemispheres_image.shape)
+# (528, 320, 456)
+
+VISp = atlas.structures["VISp"]
+pprint(VISp)
+# {'acronym': 'VISp',
+#  'id': 385,
+#  'mesh': None,
+#  'mesh_filename': PosixPath('/home/user/.brainglobe/allen_mouse_25um_v0.3/meshes/385.obj')
+#  'name': 'Primary visual area',
+#  'rgb_triplet': [8, 133, 140],
+#  'structure_id_path': [997, 8, 567, 688, 695, 315, 669, 385]}
@@ -904,21 +931,21 @@

The IPython console

  • Navigate to Window > Console
  • In the console, run (each line separately)
  • -
    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()