Skip to content

Remove SampleRandom from SumOfPairwiseCorrelationCoefficientsMetric and PCAMetric2 - #1496

Merged
N-Dekker merged 6 commits into
mainfrom
Remove-SampleRandom
Nov 20, 2026
Merged

N-Dekker merged 6 commits into
mainfrom
Remove-SampleRandom

Conversation

@N-Dekker

@N-Dekker N-Dekker commented Nov 20, 2026 •

Copy link
Copy Markdown
Member

The SampleRandom member functions of SumOfPairwiseCorrelationCoefficientsMetric and PCAMetric2 appear very much like itk::VarianceOverLastDimensionImageMetric::SampleRandom. VarianceOverLastDimensionImageMetric really uses its SampleRandom member function, but SumOfPairwiseCorrelationCoefficientsMetric and PCAMetric2 do not use SampleRandom at all.

The unused SampleRandom member functions appear introduced with commit 764490d, Wyke Huizinga (@whuizinga), 24-11-2015, Add: Added PCAMetric, PCAMetric2 and SumOfPairwiseCorrelationCoefficientsMetric to trunkpublic. These are the metrics I used in 'PCA-based groupwise image registration for quantitative MRI', submitted to Medical Image Analysis.

Slightly related: Note that according to the documentation, four metrics support the parameter "SampleLastDimensionRandomly": PCAMetric, PCAMetric2, SumOfPairwiseCorrelationCoefficientsMetric, and VarianceOverLastDimensionImageMetric. However, only VarianceOverLastDimensionImageMetric really retrieves the parameter. VarianceOverLastDimensionImageMetric internally uses SampleRandom to supports "SampleLastDimensionRandomly".

This private member function was unused. It would not even compile, if it was called!
This private member function was unused. It would not even compile, if it was called!
"NumAdditionalSamplesFixed" and "ReducedDimensionIndex" were not used by SumOfPairwiseCorrelationCoefficientsMetric.
"NumAdditionalSamplesFixed" and "ReducedDimensionIndex" were not used by PCAMetric2.
@N-Dekker

Copy link
Copy Markdown
Member Author

@stefanklein @mstaring Can you please have a look before Monday afternoon? Technically, I think it's harmless to remove this unused code (unused for 11 years already), but it still triggers the question: should the code still have been used? I mean: Should the "SampleLastDimensionRandomly" parameter still be implemented for PCAMetric, PCAMetric2, and/or SumOfPairwiseCorrelationCoefficientsMetric?

@stefanklein

stefanklein commented Nov 20, 2026 via email

Copy link
Copy Markdown
Member

This parameter is only supported by VarianceOverLastDimensionImageMetric. It is not supported by PCAMetric, PCAMetric2, or SumOfPairwiseCorrelationCoefficientsMetric, as confirmed by Stefan Klein.
This parameter is only supported by VarianceOverLastDimensionImageMetric. It is not supported by PCAMetric or SumOfPairwiseCorrelationCoefficientsMetric.
@N-Dekker
N-Dekker merged commit bf2396c into main Nov 20, 2026
7 of 8 checks passed
@N-Dekker
N-Dekker deleted the Remove-SampleRandom branch November 20, 2026 16:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants