-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make cross_correlate_masked public #6036
Make cross_correlate_masked public #6036
Conversation
This function already has standalone tests in test_masked_phase_cross_correlation.py
@grlee77 I don't think it should be public, this was part of the original discussion involving this function: it's accessed through |
I agree that is currently how it is accessed, but I think the intent in For precedent in other libraries, the DIPlib API is a case where they have a FindShift function that operates like our (unmasked) |
@grlee77 @jni I think that adding this to the public API could be good in many cases. While the phase_cross_correlation function is useful in the case where you are aligning images, the cross-correlation can give much more information about some image. It can be used to identify similar features in an image, identify rotational symmetry in a polar image, identify the extent of some feature in higher dimensional images etc. It most of these examples the important information is the number of peaks in the correlation as well as their size, rather than the position of the most intense peak (the shift returned by the phase_cross_correlation). While there are many cross-correlation functions available in other packages, this is one of the only functions that properly treats masked regions of the image. I'd argue that making this part of the public API also important as it advertises the function as proper treatment of masked images when preforming the cross-correlation. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since people have use cases for this function, I'm more than happy to make it public! I would keep it under skimage.registration
where it is now, alongside phase_cross_correlation
.
We do try to provide an online gallery example for functions added to the public API. Do you have a good idea for a concise example relying on public domain data that we could use for this? |
Ah, apologies, I hadn't realised that this function returned the cross correlation directly, not the shift. But could we not simply add |
Yeah that would be better and could incorporate some of the things mentioned in #5573 (comment). @CSSFrancis, if you want to make a PR unifying in a single |
Sure! I can do that hopefully tomorrow or this weekend. |
Has this been superseded by #6077? |
Closing in preference of #6077. |
Description
Our existing
cross_correlate_masked
function is used for masked rigid registration, but is not currently exported as part of the public API. It would be useful to downstream projects to have this part of the official API (see prior discussion with @CSSFrancis: #5573 (comment)). It already has pretty good docstrings and independent test cases, so I don't see it being a maintenance burden to do so.I did propose renaming
m1
->mask1
andm2
->mask2
here to make the names a bit more descriptive. Given that this wasn't officially public API previously, I did not introduce a deprecation cycle for this. Also, should we have this underskimage.registration
where it is now or perhaps somewhere else likeskimage.util
? What do others think?Checklist
./doc/examples
(new features only)./benchmarks
, if your changes aren't covered by anexisting benchmark
For reviewers
later.
__init__.py
.doc/release/release_dev.rst
.