unravel.allen_institute.mapmysections.segmentation_summary module#

Use mms_seg_summary or mms_ss from UNRAVEL to summarize the prevalence of voxels for somata, endothelial cells, and astrocytes from Ilastik segmentations.

Note

  • Designed for MMS segmentations of somata (label 1), endothelial cells (3), and astrocytes (4).

  • For each sample, voxel counts and proportions are computed for each cell type.

  • For example, if a sample has 1000 total segmented voxels, with 600 somatic voxels, 300 endothelial voxels, and 100 astroglia voxels, the proportions would be 0.6, 0.3, and 0.1 respectively.

Prereqs:
  • seg_ilastik outputs (e.g., MMS_seg/MMS_seg_1.nii.gz, MMS_seg/MMS_seg_3.nii.gz, MMS_seg/MMS_seg_4.nii.gz).

Output:
  • Per-sample CSVs saved to <sample>/MMS_seg/<sample>_segmentation_summary.csv

  • Columns: sample, somata_count, endothelial_count, astrocytes_count, total_count, somata_prop, endothelial_prop, astrocytes_prop

Next steps:
  • Use agg to aggregate results across samples and cd to the target directory.

  • Use concat_with_source to merge outputs across samples.

  • If most voxels are endothelial, the sample is likely enriched for endothelial cells (manually verify and revise cell type proportions as needed).

  • If most voxels are astroglial, the sample is likely enriched for astrocytes (manually verify and revise cell type proportions as needed).

Usage:#

mms_seg_summary [-s seg_dir] [-d path/to/dirs] [-p ‘ID_*’] [-v]

unravel.allen_institute.mapmysections.segmentation_summary.parse_args()[source]#
unravel.allen_institute.mapmysections.segmentation_summary.get_seg_voxel_counts(seg_folder, classes)[source]#
unravel.allen_institute.mapmysections.segmentation_summary.compute_proportions(counts_dict)[source]#
unravel.allen_institute.mapmysections.segmentation_summary.process_and_write_line(sample, seg_folder, output_csv, classes)[source]#
unravel.allen_institute.mapmysections.segmentation_summary.main()[source]#