defacing

defacing.defacer

class brainles_preprocessing.defacing.defacer.Defacer(masking_value: int | float | None = None)

Bases: ABC

_abc_impl = <_abc._abc_data object>
apply_mask(input_image_path: str | Path, mask_path: str | Path, defaced_image_path: str | Path) None

Apply a brain mask to an input image.

Parameters:
  • input_image_path (str or Path) – Path to the input image (NIfTI format).

  • mask_path (str or Path) – Path to the brain mask image (NIfTI format).

  • defaced_image_path (str or Path) – Path to save the resulting defaced image (NIfTI format).

abstract deface(input_image_path: str | Path, mask_image_path: str | Path) None

Generate a defacing mask provided an input image.

Parameters:
  • input_image_path (str or Path) – Path to the input image (NIfTI format).

  • mask_image_path (str or Path) – Path to save the output mask image (NIfTI format).

defacing.quickshear

class brainles_preprocessing.defacing.quickshear.quickshear.QuickshearDefacer(buffer: float = 10.0, force_atlas_registration: bool = True, atlas_image_path: str | Path | Atlas = Atlas.SRI24, masking_value: int | float | None = None)

Bases: Defacer

Defacer using Quickshear algorithm.

Quickshear uses a skull stripped version of an anatomical images as a reference to deface the unaltered anatomical image.

Base publication:
_abc_impl = <_abc._abc_data object>
deface(input_image_path: str | Path, mask_image_path: str | Path) None

Generate a defacing mask using Quickshear algorithm.

Note: The input image must be a brain-extracted (skull-stripped) image.

Args: input_image_path (str or Path): Path to the brain-extracted input image. mask_image_path (str or Path): Path to save the generated mask image.