MRI_Neurite_Analyzer - MontpellierRessourcesImagerie/imagej_macros_and_scripts GitHub Wiki

The toolset helps to segment neurites, measure the distances on the neurites to the closest soma, assign each neurite to a soma and to measure the FISH-signal on the neurites.

distance_neurites.png labelled_neurites.png

Getting Started

You must have the ilastik4ij-plugin, morpholibj, FeatureJ and the Neurite_Labelling_IJ_Plugin installed. Save the toolset neurite_analyzer.ijm into the macros/toolsets-folder of your FIJI installation. Download and unzip the ilastik classifier and the training images. Unzip the archive in the macros/toolbars-folder. Select neurite_analyzer from the >>-button:

toolbar.png

Before using the toolset, please configure the ilastik4ij-plugin. Run Plugins>ilastik>configure ilastik executable location and set the path to your ilastik-executable. It might also be useful to download the lookup-table Random.lut into the luts-folder of your FIJI installation.

  • the first button opens this help page
  • n-button: segment the nuclei in the active image
  • s-button: segment the neurites in the active image (this might take a while)
  • d-button: calculate for each point on a neurite, the length of the shortest path along the neurites to the closest soma
  • l-button: label each point with the label of the closest soma following a path on the neurites
  • f-button: detect the FISH spots and measures the distance along a neurite to the closest soma and the label of the neurite
  • bn-button: batch segment the nuclei, segement the nuclei in all the images in all direct subfolders of the input folder
  • h5-button: batch export the neurite images as h5-images, optionally apply histogram equalization
  • i-button: the button does nothing, but remind the user to use ilastik for the neurite segmentation
  • bs-button: batch convert the output of the ilastik segmentation into ImageJ rois
  • bd-button: batch calculate the distances and the neurite labelling
  • bf-button: batch detect the FISH spots and measure the label and the distance to the soma
  • b-button: run all the batch steps after having segmented the neurites with ilastik, i.e. bn, bs, bd and bf.

Segment nuclei

Nuclei are segmented by applying a Gaussian blur filter, followed by an auto-threshold. The particle analyzer is then used to create rois.

Options

Right-click the n-button to open the options-dialog:

segment_nuclei_options.png

sigma of Gaussian blur
The sigma of the Gaussian blur filter. Select a sigma that just makes the inner structures of the nuclei disappear.
Thresholding method
The auto-thresholding method used to segment the nuclei

Segment neurites

The neurites are segmented using a pretrained ilastik-classifier. The execution of this operation may be long. It might be preferable to use ilastik directly for the neurite segmentation. You can use the provided ilastik classifier or create your own.

Options

segment_neurites_options.png

equalize histogram
If selected a histogram equalization is run on the image before the classifier is applied. The equalization should be used consistently between training and application
/exported_data
The dataset within the h5-file to be used
axis order
The meaning of the different dimensions of the dataset.
classifier folder
The path to the folder containing the classifier (ilp-file)
classifier
The trained ilastik classifier. The training images must available at the relative paths stored in the classifier

Calculate distances

First, nuclei not on a neurite and neurites containing no nuclei are removed. Then, the tool calculates the Geodesic Distance Map using MorphoLibJ. The masks of the nuclei are dilated and used as the marker image for the Geodesic Distance Map.

Options

calculate_distances_options.png

nuclei channel
The part of the name that identifies the file as the channel containing the nuclei (for example 405, DAPI, ...)
neurite channel
The part of the name that identifies the file as the channel containing the neurites (for example 640, Cy5, ...)
FISH channel
The part of the name that identifies the file as the channel containing the FISH spots (for example 488, Alexa, ...)
Number of dilates on nuclei mask
The number of times the dilate operation is run on the nuclei mask so that nuclei belonging to the same soma become connected

Label neurites

From the dilated nuclei mask a labelled mask is created. In the neurite mask the value 255 is changed to 65535 and the two images are combined. The Neurite_Labelling_IJ_Plugin is used to label the neurites with the label of the closest soma following a path on the neurites.

Options

label_neurites_options.png

connectivity
The connectivity used for the connected components labeling

Measure FISH signal on neurites

The spots are detected by applying a LOG-filter with the given scale and then finding minima.

Options

measure_FISH_options.png

scale
The sigma of the Gaussian used in the LoG filter
proeminence
The maximum must at least stand out by this value from the surroundings to be taken into account

Results

For each FISH-spot the distance along the neurites to the nearest soma and the ID of neurite are reported.

results.png disttosomadist.png

For comparison, here the distribution of the distances to the nearest soma for all points on neurites:

distdistribution.png

Batch processing

Batch-export the images as h5-files using the h5-button. Use Ilastik to batch-segment the neurites and save each mask in the folder of the input image. Press the b-button to batch-execute the remaining steps:

  • batch-nuclei-segmentation (bn) - saves the rois of the nuclei on the nuclei images
  • batch-mask-to-selection (bs) - converts the segmentation masks from Ilastik to ImageJ rois
  • batch-calculate-distances (bd) - creates a hyperstack containing the nuclei and the neurite image and the distances and neurite-ID results
  • batch-measure FISH signal (bf) - detects the FISH spots and saves a csv-file for each image, containing the coordinates, distances and ids
⚠️ **GitHub.com Fallback** ⚠️