unravel.allen_institute.genetic_tools_atlas.auto_crop module#

Use gta_auto_crop (gta_ac) from UNRAVEL to automatically crop 3D images for all ID_* directories based on the brain bounding box.

Inputs:
  • One or more 3D image files (e.g., directory with tifs)

Outputs:
  • ./bbox/: Saves average intensity projections (AIPs) for two axes (coronal and sagittal) w/ & w/o mask outlines.

  • ./bbox/: Saves thresholded AIPs as binary masks.

  • ./bbox/: Saves bounding box coordinates of the largest connected component in a text file.

  • ./bbox/: Saves the bounding box coordinates with padding in a text file.

  • ./: Crops the original 3D image based on the bounding box w/ padding and saves it as a tif series to ./<tif_dir>_cropped/.

Note

  • This currently uses a simple thresholding method to identify brain tissue, which works well for GTA data.

  • Future improvements could include more advanced segmentation techniques, such as machine learning-based methods.

  • For simplicity and processing with Ilastik, this outputs as a TIFF series.

  • The TIFF series can be converted with io_convert_img (conv) to other formats if needed.

Next steps:
  • Aggregate the average intensity projections (AIPs) from the green channel with the outline to check the cropping.

  • Use gta_bbox_crop (gta_bc) to crop the other channels (e.g., red) using the bounding box from the green channel.

  • To save space, the original TIFF directories may be deleted. Run from TIFFs/ directory: rm -rf **/green **/red

  • reg_prep to prepare the cropped images for registration.

  • seg_copy_tifs to copy select TIFFs to a common directory to train an Ilastik project for cell segmentation.

Usage:#

gta_ac [-i green] [-o bbox] [-t 40] [-pad 0.02] [–force] [-d ID_123 ID_456 …] [-p pattern] [-v]

unravel.allen_institute.genetic_tools_atlas.auto_crop.parse_args()[source]#
unravel.allen_institute.genetic_tools_atlas.auto_crop.create_outline(mask)[source]#

Create an outline mask by eroding the original mask and subtracting it from the original mask.

unravel.allen_institute.genetic_tools_atlas.auto_crop.main()[source]#