preprocessing module

Core pipeline

BatchProcessor is the main entry point for batch image processing.

Correction

Normalization

Spatial transform

Format conversion

DICOM sort/rename only (not NIfTI conversion): see habit.core.dicom_sort and CLI habit sort-dicom.

Base and factory

class habit.core.preprocessing.base_preprocessor.BasePreprocessor(keys: str | List[str], allow_missing_keys: bool = False)[source]

Bases: ABC

Base class for all image preprocessors in HABIT.

This class defines the basic interface that all preprocessors must implement.

__init__(keys: str | List[str], allow_missing_keys: bool = False)[source]

Initialize the preprocessor.

Parameters:
  • keys (Union[str, List[str]]) – Keys of the corresponding items to be transformed.

  • allow_missing_keys (bool) – If True, allows missing keys in the input data.

abstract __call__(data: Dict[str, Any]) Dict[str, Any][source]

Process the input data.

Parameters:

data (Dict[str, Any]) – Input data dictionary containing image and metadata.

Returns:

Processed data dictionary.

Return type:

Dict[str, Any]