6. Iterators¶
When building image processing pipelines it is often useful to iterate over specific regions of the image, for example to process the image in smaller tiles or to process only specific regions of interest (ROIs).
Moreover, when working with OME-Zarr Images it is often useful to set specific broadcasting rules for the iteration, for example to iterate over all z-planes or iterate over all timepoints.
Ngio provides a set of Iterator classes that can be used for this purpose. We provide iterators four basic iterators:
- The
SegmentationIteratoris designed to build segmentation pipelines, where an input image is processed to produce a segmentation mask. An example use case on how to use theSegmentationIteratorcan be found in the Image Segmentation Tutorial. - The
MaskedSegmentationIteratoris similar to theSegmentationIterator, but it uses a masking roi table to restrict the segmentation to masks. This is useful when you want to segment only specific regions of the image, for example, segmenting cells only within a specific tissue region. An example use case on how to use theMaskedSegmentationIteratorcan be found in the Image Segmentation Tutorial. - The
ImageProcessingIteratoris designed to build image processing pipelines, where an input image is processed to produce a new image. An example use case on how to use theImageProcessingIteratorcan be found in the Image Processing Tutorial. - The
FeatureExtractionIteratoris read-only iterator designed to iterate over pairs of images and labels to extract features from the image based on the labels. An example use case on how to use theFeatureExtractionIteratorcan be found in the Feature Extraction Tutorial.
A set of more complete example can be found in the Fractal Tasks Template.