Skip to content

92 unite registration steps into one transformation#131

Merged
neuronflow merged 16 commits intomainfrom
92-unite-registration-steps-into-one-transformation
Jun 27, 2025
Merged

92 unite registration steps into one transformation#131
neuronflow merged 16 commits intomainfrom
92-unite-registration-steps-into-one-transformation

Conversation

@MarcelRosier
Copy link
Collaborator

@MarcelRosier MarcelRosier commented Jun 23, 2025

unites coreg and atlas reg transformations to reduce resampling and provides class to perform inverse mappings from atlas to native space. As of now, only Ants and NiftyReg are supported.
Hence, this resolves #92, resolves #100, resolves #122

@MarcelRosier MarcelRosier self-assigned this Jun 23, 2025
@MarcelRosier MarcelRosier linked an issue Jun 23, 2025 that may be closed by this pull request
Modify antspyx and brainles_hd_bet to be flexible within <1.0.0
Restrict  "scipy<1.14" to make antspyx work for python >=3.11
@MarcelRosier MarcelRosier marked this pull request as ready for review June 25, 2025 13:32
Copilot AI review requested due to automatic review settings June 25, 2025 13:32
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR unites coregistration and atlas registration transformations into a single workflow to minimize resampling and introduces a class for performing inverse mappings from atlas to native space (currently for ANTs and NiftyReg). Key changes include:

  • New test cases for composing and inverting affine transforms.
  • Updates to dependency versions and parameter handling for registration modules.
  • Addition of the BackToNativeSpace class and modifications in modality processing to capture transformation matrices.

Reviewed Changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
tests/test_registrators.py Added tests for affine transform inversion and composition functions.
tests/test_back_to_native.py Added tests to verify inverse transformation calls with correct parameters.
pyproject.toml Updated dependency constraints for antspyx, brainles_hd_bet, and scipy.
brainles_preprocessing/registration/registrator.py Introduced an interpolator parameter and abstract inverse_transform method.
brainles_preprocessing/registration/niftyreg/* Modified matrix path handling, affine composition, and inversion functions.
brainles_preprocessing/registration/greedy/greedy.py Added inverse_transform stub to conform with Registrator interface.
brainles_preprocessing/registration/elastix/elastix.py Added an inverse_transform method that raises NotImplementedError.
brainles_preprocessing/registration/ANTs/ANTs.py Updated transform and inverse_transform to support list-based matrix paths and parameter passing.
brainles_preprocessing/preprocessor.py Added a parameter and logic for saving transformation matrices.
brainles_preprocessing/modality.py Updated transformation path management and registration matrix naming conventions.
brainles_preprocessing/back_to_native.py Implemented BackToNativeSpace class to apply inverse transformations.
Comments suppressed due to low confidence (2)

brainles_preprocessing/registration/ANTs/ANTs.py:257

  • The 'whichtoinvert' parameter is passed to the transform method in inverse_transform but is not explicitly documented or handled in transform; consider updating the API documentation or implementation to clarify its purpose.
            whichtoinvert=[True] * len(matrix_path),  # Invert all matrices

brainles_preprocessing/modality.py:256

  • Changing the registration matrix file name to use a 'M_' prefix without a clear extension may lead to inconsistency; consider appending a proper file extension (e.g. .mat or .txt) to match downstream expectations.
        registered_matrix = registration_dir / f"M_{moving_image_name}"

) -> Optional[Path]:
possible_Files = list(
transform_incomplete_path.parent.glob(f"{transform_incomplete_path.stem}.*")
)
Copy link

Copilot AI Jun 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The _find_transformation_matrix method returns the first match when multiple files exist; consider refining the selection logic or documenting the assumptions to ensure that the correct file is chosen.

Copilot uses AI. Check for mistakes.
@MarcelRosier MarcelRosier requested a review from neuronflow June 25, 2025 13:34
@neuronflow neuronflow merged commit 1413eb9 into main Jun 27, 2025
4 checks passed
@neuronflow neuronflow deleted the 92-unite-registration-steps-into-one-transformation branch June 27, 2025 18:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

3 participants