In phase_cross_correlation, allow adapting to new return value structure while still avoiding unnecessary computationΒ #7169
Description
Description:
Right now, it looks like there's a warning about registration.phase_cross_correlation
always returning a 3-tuple starting in 0.22, e.g. that return_error=False
will no longer prompt the function to give back just the shift, but the 2 other values as well. I'd like to adapt code to prepare for this, and can set return_error='always'
to do so.
However, it looks like these discarded values will sometimes still be computed, though? It appears that avoiding these computations is possible when passing a reference_mask
or a moving_mask
(https://github.com/scikit-image/scikit-image/blob/v0.21.0/skimage/registration/_phase_cross_correlation.py#L315-L316), but in my case I'm not doing so, and it looks like I'll still end up having things computed (https://github.com/scikit-image/scikit-image/blob/v0.21.0/skimage/registration/_phase_cross_correlation.py#L358-L362 or https://github.com/scikit-image/scikit-image/blob/v0.21.0/skimage/registration/_phase_cross_correlation.py#L388-L389), https://github.com/scikit-image/scikit-image/blob/v0.21.0/skimage/registration/_phase_cross_correlation.py#L414-L415) that I don't intend to use.
Am I missing something? Would it be possible to treat calls without a mask equally as those with a mask, with respect to being able to avoid the extra computations of the values that will be discarded?