SuperElastix / elastix

Official elastix repository
http://elastix.dev
Apache License 2.0
449 stars 110 forks source link

SumOfPairwiseCorrelationCoefficientsMetric m_TransformIsStackTransform always true?!? #1159

Closed N-Dekker closed 3 days ago

N-Dekker commented 4 days ago

Looking at commit 764490d5e37de792fea4340fc11850bfd067318d "Add: Added PCAMetric, PCAMetric2 and SumOfPairwiseCorrelationCoefficientsMetric to trunkpublic", Wyke Huizinga (@whuizinga), Nov 24, 2015, it appear that the TransformIsStackTransform property of SumOfPairwiseCorrelationCoefficientsMetric is always true. It is initialized by true in the default-constructor of the metric:

https://github.com/SuperElastix/elastix/blob/764490d5e37de792fea4340fc11850bfd067318d/src/Components/Metrics/SumOfPairwiseCorrelationsMetric/itkSumOfPairwiseCorrelationCoefficientsMetric.hxx#L33

And then it may be set true, by calling SetTransformIsStackTransform(true), in BeforeEachResolution():

https://github.com/SuperElastix/elastix/blob/764490d5e37de792fea4340fc11850bfd067318d/src/Components/Metrics/SumOfPairwiseCorrelationsMetric/elxSumOfPairwiseCorrelationCoefficientsMetric.hxx#L116

However, it is never false. Is it means to be like that?


Note that other metrics (PCAMetric, PCAMetric2, VarianceOverLastDimension) have a similar TransformIsStackTransform property, but those are initialized to false, during the construction of those metrics.

N-Dekker commented 3 days ago

@stefanklein A related topic: BeforeEachResolution() does: https://github.com/SuperElastix/elastix/blob/764490d5e37de792fea4340fc11850bfd067318d/src/Components/Metrics/SumOfPairwiseCorrelationsMetric/elxSumOfPairwiseCorrelationCoefficientsMetric.hxx#L111-L116

So: if the current transform is a stack transform, call SetTransformIsStackTransform(true). But what else? There is no else part. Is that OK? What if a previous transform was a stack transform, but the current transform is not? Should it not call SetTransformIsStackTransform(false)?