registration

registration.registrator

class brainles_preprocessing.registration.registrator.Registrator

Bases: ABC

_abc_impl = <_abc._abc_data object>
abstract register(fixed_image_path: Any, moving_image_path: Any, transformed_image_path: Any, matrix_path: Any, log_file_path: str)

Abstract method for registering images.

Parameters:
  • fixed_image_path (Any) – The fixed image for registration.

  • moving_image_path (Any) – The moving image to be registered.

  • transformed_image_path (Any) – The resulting transformed image after registration.

  • matrix_path (Any) – The transformation matrix applied during registration.

  • log_file_path (str) – The path to the log file for recording registration details.

abstract transform(fixed_image_path: Any, moving_image_path: Any, transformed_image_path: Any, matrix_path: Any, log_file_path: str)

Abstract method for transforming images.

Parameters:
  • fixed_image_path (Any) – The fixed image to be transformed.

  • moving_image_path (Any) – The moving image to be transformed.

  • transformed_image_path (Any) – The resulting transformed image.

  • matrix_path (Any) – The transformation matrix applied during transformation.

  • log_file_path (str) – The path to the log file for recording transformation details.

registration.ANTs

class brainles_preprocessing.registration.ANTs.ANTs.ANTsRegistrator(registration_params: Dict[str, Any] | None = None, transformation_params: Dict[str, Any] | None = None)

Bases: Registrator

_abc_impl = <_abc._abc_data object>
static _log_to_file(log_file_path: str | Path, fixed_image_path: str | Path, moving_image_path: str | Path, transformed_image_path: str | Path, matrix_path: str | Path, operation_name: str, start_time: datetime, end_time: datetime) None

Log the operation details to a file.

Parameters:
  • log_file_path (str or Path) – Path to the log file.

  • fixed_image_path (str or Path) – Path to the fixed image.

  • moving_image_path (str or Path) – Path to the moving image.

  • transformed_image_path (str or Path) – Path to the transformed image.

  • matrix_path (str or Path) – Path to the transformation matrix.

  • operation_name (str) – Name of the operation (‘registration’ or ‘transformation’).

  • start_time (datetime.datetime) – Start time of the operation.

  • end_time (datetime.datetime) – End time of the operation.

register(fixed_image_path: str | Path, moving_image_path: str | Path, transformed_image_path: str | Path, matrix_path: str | Path, log_file_path: str | Path, **kwargs) None

Register images using ANTs.

Parameters:
  • fixed_image_path (str or Path) – Path to the fixed image.

  • moving_image_path (str or Path) – Path to the moving image.

  • transformed_image_path (str or Path) – Path to the transformed image (output).

  • matrix_path (str or Path) – Path to the transformation matrix (output).

  • log_file_path (str or Path) – Path to the log file.

  • **kwargs – Additional registration parameters to update the instantiated defaults.

transform(fixed_image_path: str | Path, moving_image_path: str | Path, transformed_image_path: str | Path, matrix_path: str | Path, log_file_path: str | Path, **kwargs) None

Apply a transformation using ANTs.

Parameters:
  • fixed_image_path (str or Path) – Path to the fixed image.

  • moving_image_path (str or Path) – Path to the moving image.

  • transformed_image_path (str or Path) – Path to the transformed image (output).

  • matrix_path (str or Path) – Path to the transformation matrix.

  • log_file_path (str or Path) – Path to the log file.

  • **kwargs – Additional transformation parameters to update the instantiated defaults.

registration.eReg

brainles_preprocessing.registration.eReg.eReg._add_mat_suffix(filename: str) str

Adds a “.mat” suffix to the filename if it doesn’t have any extension.

Parameters:

filename (str) – The filename to check and potentially modify.

Returns:

The filename with “.mat” suffix added if needed.

Return type:

str

class brainles_preprocessing.registration.eReg.eReg.eRegRegistrator(configuration_file: str | None = None)

Bases: Registrator

_abc_impl = <_abc._abc_data object>
register(fixed_image_path: str, moving_image_path: str, transformed_image_path: str, matrix_path: str, log_file_path: str | None = None) None

Register images using eReg.

Parameters:
  • fixed_image_path (str) – Path to the fixed image.

  • moving_image_path (str) – Path to the moving image.

  • transformed_image_path (str) – Path to the transformed image (output).

  • matrix_path (str) – Path to the transformation matrix (output).

  • log_file_path (str) – Path to the log file.

transform(fixed_image_path: str, moving_image_path: str, transformed_image_path: str, matrix_path: str, log_file_path: str | None = None) None

Apply a transformation using eReg.

Parameters:
  • fixed_image_path (str) – Path to the fixed image.

  • moving_image_path (str) – Path to the moving image.

  • transformed_image_path (str) – Path to the transformed image (output).

  • matrix_path (str) – Path to the transformation matrix.

  • log_file_path (str) – Path to the log file.

registration.niftyreg

class brainles_preprocessing.registration.niftyreg.niftyreg.NiftyRegRegistrator(registration_abspath: str = '/home/docs/checkouts/readthedocs.org/user_builds/brainles-preprocessing/checkouts/stable/brainles_preprocessing/registration/niftyreg', registration_script: str | None = None, transformation_script: str | None = None)

Bases: Registrator

_abc_impl = <_abc._abc_data object>
register(fixed_image_path: str, moving_image_path: str, transformed_image_path: str, matrix_path: str, log_file_path: str) None

Register images using NiftyReg.

Parameters:
  • fixed_image_path (str) – Path to the fixed image.

  • moving_image_path (str) – Path to the moving image.

  • transformed_image_path (str) – Path to the transformed image (output).

  • matrix_path (str) – Path to the transformation matrix (output).

  • log_file_path (str) – Path to the log file.

transform(fixed_image_path: str, moving_image_path: str, transformed_image_path: str, matrix_path: str, log_file_path: str) None

Apply a transformation using NiftyReg.

Parameters:
  • fixed_image_path (str) – Path to the fixed image.

  • moving_image_path (str) – Path to the moving image.

  • transformed_image_path (str) – Path to the transformed image (output).

  • matrix_path (str) – Path to the transformation matrix.

  • log_file_path (str) – Path to the log file.