Using BoneJ2
Here we adapt a workflow from the BoneJ2 paper for use with napari-imagej.
napari Setup
We will install one additional napari plugin, napari-segment-blobs-and-things-with-membranes, to support this use case. Instructions for finding and installing a napari plugin are here
To install napari-segment-blobs-and-things-with-membranes
, simply ensure that your napari environment is active and paste the following into your terminal:
pip install napari-segment-blobs-and-things-with-membranes
Once the plugin has been installed correctly, napari-segment-blobs-and-things-with-membranes
will appear as an option within the Plugins
menu of napari, and the Tools
menu will be populated with the various functions of the plugin.
BoneJ2 Setup
We need to first specify the endpoint that we will use to access BoneJ2.
We can configure napari-imagej to use BoneJ2 by opening the settings dialog and changing the imagej directory or endpoint
(described here). Within the napari-imagej settings dialog, paste the following into the imagej directory or endpoint
field, and click OK
:
sc.fiji:fiji:2.13.0+org.bonej:bonej-ops:MANAGED+org.bonej:bonej-plugins:MANAGED+org.bonej:bonej-utilities:MANAGED
Note that napari must be restarted for these changes to take effect!
Preparing and Opening the Data
We will use the same data that was used in the BoneJ2 paper. Go ahead and download umzc_378p_Apteryx_haastii_head.tif.bz2
from doi:10.6084/m9.figshare.7257179
, linked directly here.
Opening Data in napari
Once you’ve unzipped the downloaded file, you can drag-and-drop the image onto napari to open it.
Processing Data in napari with nsbatwm
Now we need to process the image.
First, we will blur the image to smooth intensity values and filter noise.
Within napari’s menus choose:
Tools > Filtering / noise removal > Gaussian (scikit image, nsbatwm)
When the widget comes up, change the
sigma
value to2
and ensure that theimage
layer is correctly set to the image that was opened.Run the widget! When the blurring is complete, a new
Image
layer will appear in the napari viewer.
Now we will threshold the image to make it binary.
Within napari’s menus choose:
Tools > Segmentation / binarization > Threshold (Li et al 1993, scikit image, nsbatwm)
When the widget comes up, ensure that the layer that is selected is the result of step 1.
Run the widget! When the thresholding is complete, a new
Labels
layer will appear in the napari viewer.Right click on the new
Labels
layer and selectConvert to Image
. This will allow us to pass the result, now anImage
layer, to BoneJ2.
Processing Data in napari with BoneJ2 and napari-imagej
Calculating the degree of anisotropy:
In the napari-imagej search bar type
anisotropy
, and select theAnisotropy
Command from the search results.Click
Run
.Select the
inputImage
that corresponds to the theshold layer created previously.Enter
1.73
as the samplingInterval.Check the
Recommended minimums
box.Click
OK
.
This will output the degree of anisotropy measurement for the image.
Calculating the fractal dimension:
In the napari-imagej search bar type
fractal dimension
, and select theFractal dimension
Command from the search results.Click
Run
.Select the
inputImage
that corresponds to the theshold layer created previously.Check the
Automatic parameters
box.Click
OK
.
This will output the fractal dimension of the image.
Calculating the surface area:
In the napari-imagej search bar type
surface area
, and select theSurface area
Command from the search results.Click
Run
.Select the
inputImage
that corresponds to the theshold layer created previously.Click
OK
.
Note: This command may take some time, because it runs a computationally costly algorithm called “Marching Cubes” that creates a surface mesh of the image before computing the surface area. This will output the surface area of the thresholded regions.
Calculating the area/volume fraction:
In the napari-imagej search bar type
volume fraction
, and select theArea/Volume fraction
Command from the search results.Click
Run
.Select the
inputImage
that corresponds to the theshold layer created previously.Click
OK
.
This will output the Bone Volume Fraction (BV/TV) measurement for the image.
Calculating the connectivity:
In the napari-imagej search bar type
connectivity
, and select theConnectivity (Modern)
Command from the search results.Click
Run
.Select the
inputImage
that corresponds to the theshold layer created previously.Click
OK
.
This will output the Euler characteristic and Conn.D for the image.
The final measurements
We have now quantified our image with a number of methods and can use our resulting measurements in further scientific analysis!