Segmenting 2/3D structures#
In this tutorial, you will use the brainglobe-segmentation plugin for napari to segment a a 3D (or 2D) structure, such as an injection site. As a prerequisite, you will need to have registered your data to an atlas using brainreg
and know what folder you saved this in (your “brainreg
output directory”). If you don’t have this, please follow our registration tutorial first.
Note
You will need napari
installed on your computer - please follow napari
’s installation instructions to do so (including their recommendation to use a conda
environment).
Open
napari
.Install
brainglobe-segmentation
by selectingPlugins > Install/Uninstall plugins
and searching forbrainglobe-segmentation
in the searchbox. If it is not installed yet, click on theInstall
button.
Caution
On Silicon Macs you may have to conda install hdf5
first for the installation to be successful.
Open the
brainglobe-segmentation
widget by selectingPlugins > Region/track segmentation (brainglobe-segmentation)
in the napari menu bar near the top left of the window.
The brainglobe segmentation widget appears on the right-hand side of the window.
Load your registered data in atlas space by clicking on
Load project (atlas space)
and navigating to yourbrainreg
output directory.If required, adjust the contrast on the registered image by selecting the
Registered Image
layer on the left of the screen, and clicking onAutocontrast: once
on the top left of the screen.Click the
Region Segmentation
button in theSegmentation
panel.Click the
Add new region
button.
A new Labels layer named region_0
appears on the left hand side.
If required, rename this region (by selecting the e.g.
region_0
text)Navigate to where you want to draw your region of interest.
Choose a brush size (top left box).
Make sure painting mode is activated (by selecting the paintbrush icon, top left). You can go back to the navigation mode by selecting the magnifying glass.
Colour in your region that you want to segment by holding down the left mouse button, ensuring that you make a solid object. For 3D structures, set
n edit dim
to3
to paint a sphere instead of a circle, or paint circles across several slices. You can change slice using the slider at the bottom of the screen.
Repeat steps 6.-11. for each other region you would like to segment.
Click
Analyse regions
to analyse the spatial distribution of the regions you have drawn.If
Calculate volumes
is selected, the volume of each brain area included in the segmented region will be calculated and saved.If
Summarise volumes
is selected, then each region will be summarised (centers, volumes etc)If
Save segmentation
is selected, then the segmented layer will be saved at the same time as the analysis is run (this may make your analysis take longer)
(Optional) Use the
Save
button to save your segmented regions to be reloaded at a later date.
Note
All data will be saved into your brainreg output directory
Hint
For more information about how to use automated methods to segment your feature of interest, please see Analysing segmentation from other napari plugins. For full information on how to use brainglobe-segmentation, please see the brainglobe-segmentation page