Skip to content

Affine registration - #7421

Open
jboulanger wants to merge 179 commits into
scikit-image:pre-megamove-integrationfrom
jboulanger:global-registration
Open

jboulanger wants to merge 179 commits into
scikit-image:pre-megamove-integrationfrom
jboulanger:global-registration

Conversation

@jboulanger

Copy link
Copy Markdown

Description

Intensity based affine registration of image pairs.

  • estimate a transform to register the moving image using ndi.affine_transform
  • supports 2d and 3d images
  • supports color image using channel_axis parameter (more flexible for 3d images)
  • supports affine, euclidean and translation motion models using a string parameter
  • supports weights/mask to use only a part of the image. Modifies the normalized_mutual_information to support weights.
  • includes 2 solvers: lucas kanade [1] and studholme [2,3] parametrized as functions callback
  • related to PR 3544 and 7050. The studholme solver is inspired heavily from PR 3544.
  • include an quantification of alignment error (target registration error)

The API tries to take inspiration from the PR3455, however I found it not very user friendly to pass callback for handling euclidean or translation motion model. Moreover the logic is different between the two solvers and could not find a way to conciliate the previously discussed API with the added solver. PR3455 was relying on transforms in the example to handle restricted model (euclidean) which is not compatible with ndi.affine_transform, here we stick to ndi.affine_transform to ba able to handle 3D images.

Comparison bewteen the solvers and cv2.findTransformECC. The 2nd row display the registration error map.
image

Registration of a brain MRI volume
image

TODO

  • euclidean is not implemented for lucas kanade solver for dimension > 2.

References

  1. algo_affine
  2. Studholme C, Hill DL, Hawkes DJ. Automated 3-D registration of MR and CT images of the head. Med Image Anal. 1996 Jun;1(2):163-75.
  3. J. Nunez-Iglesias, S. van der Walt, and H. Dashnow, Elegant SciPy: The Art of Scientific Python. O’Reilly Media, Inc., 2017.

Checklist

Release note

For maintainers and optionally contributors, please refer to the instructions on how to document this PR for the release notes.

...

@lagru
lagru requested a review from JDWarner September 16, 2024 06:57
@stefanv

stefanv commented Mar 11, 2025

Copy link
Copy Markdown
Member

xref: #7666

mkcor and others added 5 commits August 15, 2025 16:00
## Description

As per our discussion at the in-person sprint, let's go for the `src`
layout and get started with the `skimage2` namespace.

/cc @lagru @stefanv @jni @matthew-brett @Czaki 

## Checklist

<!-- Before pull requests can be merged, they should provide: -->

- A descriptive but concise pull request title
- [Docstrings for all
functions](https://github.com/numpy/numpydoc/blob/main/doc/example.py)
- [Unit
tests](https://scikit-image.org/docs/dev/development/contribute.html#testing)
- A gallery example in `./doc/examples` for new features
- [Contribution
guide](https://scikit-image.org/docs/dev/development/contribute.html) is
followed

## Release note

For maintainers and optionally contributors, please refer to the
[instructions](https://scikit-image.org/docs/stable/development/contribute.html#documenting-changes)
on how to document this PR for the release notes.

```release-note
...
```

---------

Co-authored-by: Stefan van der Walt <[email protected]>
Co-authored-by: Lars Grüter <[email protected]>
Co-authored-by: Grzegorz Bokota <[email protected]>
Co-authored-by: Stefan van der Walt <[email protected]>
Co-authored-by: Grzegorz Bokota <[email protected]>
@matthew-brett
matthew-brett changed the base branch from main to pre-megamove-integration June 19, 2026 15:25
@matthew-brett

Copy link
Copy Markdown
Contributor

We have changed the base branch for this PR from the main branch to the pre-megamove-integration branch.

Summary - what this means for your PR

You can continue to work on your PR, now based on pre-megamove-integration. You should update your branch to the current state of pre-megamove-integration (this is what the Github "Update branch" button does). Please do not merge the scikit-image main branch into your PR branch.

Once we've merged your PR into the pre-megamove-integration branch, we'll update your changes for Megamove, and merge into the main branch.

In addition - our automated script detected that your branch had merge conflicts with the pre-Megamove branch. Please make sure to merge in the pre-megamove-integration branch, and resolve the merge conflicts in the way that you want.

Read on for the Megamove rationale, and more detailed instructions.

Details

Rationale

We've changed the base branch to make it easier and smoother to continue to work on your PR, while we work through a rather large change in the directory structure of the repository - a change that we have called Megamove.

See the Megamove explanation issue for more detail.

Changing the base branch means you do not see merge conflicts related to the Megamove change, and can continue to work with the repository in its original state, without worrying about porting those changes across to the new post-Megamove structure.

As you'll see in the linked issue, you can continue to work on your PR as before, and you can continue to use the Github GUI to "Update branch" - this updates from the new pre-megamove-integration branch. However, there is one caveat: please, do not try and merge the scikit-image main branch into this one, but instead, keep track of the pre-megamove-integration branch. The issue explains more.

To emphasize again, do not try and merge the scikit-image main branch. You will get Megamove related merge conflicts that are rather tricky to resolve correctly.

When we've approved your PR, we'll merge into the pre-megamove-integration branch, and then process it so we can merge it into the main branch. We'll let you know when we've merged your PR changes into main.

Any questions, please reply here.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

10 participants