load_extract_cohort

Note

This page is a reference documentation. It only explains the function signature, and not how to use it. Please refer to the Habitat Guide and Python API guide (v2.0) for usage.

load_extract_cohort(raw_img_folder: str | Path, *, images_folder: str = 'images', name: str | None = None) → Cohort[source]

Build a cohort from raw_img_folder/images/<subject>/<modality>/.

Unlike DirectoryDataSource, masks are not required: habitat feature extractors derive the ROI from the habitat map. Every modality folder that contains a file is kept (per-subject).

Parameters:
  • raw_img_folder – Root directory holding the images subdirectory.

  • images_folder – Name of the images subdirectory under the root.

  • name – Optional cohort name.

Returns:

Cohort with lazy FileImageRef images, sorted by subject id.

Raises:

DataFormatError – If the images tree is missing or yields no subjects.