unravel.segment.ilastik_pixel_classification module#

Use seg_ilastik from UNRAVEL to use segment features of interest using Ilastik.

Prereqs:
Inputs:
  • ilastik_project: path/ilastik_project.ilp

  • Input: path/tif_dir or path/image (relative to current dir or sample??/)

  • Input image types: .tif, .czi, .nii.gz, .h5, .zarr

Outputs:
  • seg_dir/seg_dir/*.tif series (segmented images; delete w/ –rm_out_tifs)

  • Optional: seg_dir/seg_dir_<label>.nii.gz (binary masks for each label specified w/ –labels)

  • Skips processing if output already exists (.nii.gz with –labels or .tif without)

Note

  • Ilastik executable files for each OS (update path and version as needed):

  • Linux and WSL: /usr/local/ilastik-1.4.0.post1-Linux/run_ilastik.sh

  • Mac: /Applications/ilastik-1.4.0.post1-OSX.app/Contents/ilastik-release/run_ilastik.sh

  • Windows: C:Program Filesilastik-1.4.0.post1run_ilastik.bat

Usage:#

seg_ilastik -ie path/ilastik_executable -ilp path/ilastik_project.ilp -i <tif_dir or image> -o seg_dir [–labels 1 2 3] [–rm_out_tifs] [For .czi: –channel 1] [-d list of paths] [-p sample??] [-v]

unravel.segment.ilastik_pixel_classification.parse_args()[source]#
unravel.segment.ilastik_pixel_classification.count_files(directory)[source]#

Count the number of files in a directory, excluding subdirectories.

unravel.segment.ilastik_pixel_classification.save_labels_as_masks(tif_dir, labels, segmentation_dir, output_name)[source]#
unravel.segment.ilastik_pixel_classification.main()[source]#