Instance Segmentation Function
This module requires a neuron info dict from the instance segmentation step as well as the Allen labels directory (in native space), typically from the registration step.
This module perfoms the following:
Filters cells based on a specified minimum (and optional maximum) area argument
Computes cell count of segmented image and summarizes them per label
Outputs clarity_segmentation_features_ara_labels.csv (segmentation features summarized per ARA labels)
Main outputs
A csv file containing the segmentation features summarized per ARA labels located at
<output_folder>/clarity_segmentation_features_ara_labels_<hemi>.csv
CLI
To look at the arguments that need to be provided to the function, invoke the help menu using:
$ miracl seg count_neurons -h
The following menu will be printed to the terminal:
usage: miracl count_neurons -l LBL --min-area MIN_AREA --neuron-info-dict
NEURON_INFO_DICT [-o OUTPUT] [--max-area MAX_AREA]
[--hemi {split,combined}] [--skip SKIP]
[-c CPU_LOAD] [-v] [-h]
1) Filters cells based on a specified minimum (and maximum) area argument 1)
Computes cell count of segmented image and summarizes them per label 2)
Outputs clarity_segmentation_features_ara_labels.csv (segmentation features
summarized per ARA labels)
optional arguments:
-o OUTPUT, --output OUTPUT
Output directory (default: .)
--max-area MAX_AREA Maximum area of a neuron to be considered (default:
1000000)
--hemi {split,combined}
Hemisphere of the brain (split or combined) (default:
combined)
--skip SKIP Number of slices to skip from start and end (default:
50) Note: this helps to skip the slices that are poor
quality due to the microscope
-c CPU_LOAD, --cpu-load CPU_LOAD
Percentage of CPU load to use (default: 0.3)
-v, --verbose Prints out more information (default: False)
-h, --help show this help message and exit
required arguments:
-l LBL, --lbl LBL Allen labels directory (in native space) used to
summarize features; from registration step. Can also
be any other labels that you want to use to summarize
the features, such as cluster labels.
--min-area MIN_AREA Minimum area of a neuron to be considered
--neuron-info-dict NEURON_INFO_DICT
Path to the neuron info dict from instance
segmentation (neuron_info_final.json)
Flag |
Parameter |
Type |
Description |
Default |
|---|---|---|---|---|
-l, --lbl |
LBL |
|
Allen labels directory (in native space) used to summarize features; from registration step. |
|
--min-area |
MIN_AREA |
|
Minimum area of a neuron to be considered |
|
--neuron-info-dict |
NEURON_INFO_DICT |
|
Path to the neuron info dict from instance segmentation (neuron_info_final.json) |
|
-o, --output |
OUTPUT |
|
Output directory |
|
--max-area |
MAX_AREA |
|
Maximum area of a neuron to be considered |
|
--hemi |
{split, combined} |
|
Hemisphere of the brain (split or combined) |
|
--skip |
SKIP |
|
Number of slices to skip from start and end |
|
-c, --cpu-load |
CPU_LOAD |
|
Percentage of CPU load to use |
|
-v, --verbose |
N/A |
|
Prints out more information |
|
Note
The --skip argument is used to skip the slices that are poor quality due to the microscope.
Example usage:
$ miracl seg count_neurons \
-l ../reag_final/allen_labels/ \
--min-area 10 \
--neuron-info-dict ./cc_patches/neuron_info_final.json \
-o ./output_dir