From ed8b3b77f15b28e6fca1933bccf36cee3ba3eadc Mon Sep 17 00:00:00 2001 From: Niels Dekker Date: Fri, 6 May 2022 12:15:38 +0200 Subject: [PATCH] STYLE: Make threading related data of metrics private Applies to both `PCAMetric` and `ParzenWindowHistogramImageToImageMetric`. Follow-up to pull request https://github.com/SuperElastix/elastix/pull/643 commit ab0c8df174fd3485f5626caf06dea8edd66fff92 "STYLE: Make data ImageMomentsCalculator, ComputeDisplacementDist private" --- ...kParzenWindowHistogramImageToImageMetric.h | 54 +++++++++---------- .../PCAMetric/itkPCAMetric_F_multithreaded.h | 48 ++++++++--------- 2 files changed, 51 insertions(+), 51 deletions(-) diff --git a/Common/CostFunctions/itkParzenWindowHistogramImageToImageMetric.h b/Common/CostFunctions/itkParzenWindowHistogramImageToImageMetric.h index f04202ab3..bd554f429 100644 --- a/Common/CostFunctions/itkParzenWindowHistogramImageToImageMetric.h +++ b/Common/CostFunctions/itkParzenWindowHistogramImageToImageMetric.h @@ -294,33 +294,6 @@ class ITK_TEMPLATE_EXPORT ParzenWindowHistogramImageToImageMetric KernelFunctionPointer m_MovingKernel; KernelFunctionPointer m_DerivativeMovingKernel; - /** Threading related parameters. */ - mutable std::vector m_ThreaderJointPDFs; - - /** Helper structs that multi-threads the computation of - * the metric derivative using ITK threads. - */ - struct ParzenWindowHistogramMultiThreaderParameterType // can't we use the one from AdvancedImageToImageMetric ? - { - Self * m_Metric; - }; - ParzenWindowHistogramMultiThreaderParameterType m_ParzenWindowHistogramThreaderParameters; - - struct ParzenWindowHistogramGetValueAndDerivativePerThreadStruct - { - SizeValueType st_NumberOfPixelsCounted; - JointPDFPointer st_JointPDF; - }; - itkPadStruct(ITK_CACHE_LINE_ALIGNMENT, - ParzenWindowHistogramGetValueAndDerivativePerThreadStruct, - PaddedParzenWindowHistogramGetValueAndDerivativePerThreadStruct); - itkAlignedTypedef(ITK_CACHE_LINE_ALIGNMENT, - PaddedParzenWindowHistogramGetValueAndDerivativePerThreadStruct, - AlignedParzenWindowHistogramGetValueAndDerivativePerThreadStruct); - mutable AlignedParzenWindowHistogramGetValueAndDerivativePerThreadStruct * - m_ParzenWindowHistogramGetValueAndDerivativePerThreadVariables; - mutable ThreadIdType m_ParzenWindowHistogramGetValueAndDerivativePerThreadVariablesSize; - /** Initialize threading related parameters. */ void InitializeThreadingParameters() const override; @@ -505,6 +478,33 @@ class ITK_TEMPLATE_EXPORT ParzenWindowHistogramImageToImageMetric void operator=(const Self &) = delete; + /** Threading related parameters. */ + mutable std::vector m_ThreaderJointPDFs; + + /** Helper structs that multi-threads the computation of + * the metric derivative using ITK threads. + */ + struct ParzenWindowHistogramMultiThreaderParameterType // can't we use the one from AdvancedImageToImageMetric ? + { + Self * m_Metric; + }; + ParzenWindowHistogramMultiThreaderParameterType m_ParzenWindowHistogramThreaderParameters; + + struct ParzenWindowHistogramGetValueAndDerivativePerThreadStruct + { + SizeValueType st_NumberOfPixelsCounted; + JointPDFPointer st_JointPDF; + }; + itkPadStruct(ITK_CACHE_LINE_ALIGNMENT, + ParzenWindowHistogramGetValueAndDerivativePerThreadStruct, + PaddedParzenWindowHistogramGetValueAndDerivativePerThreadStruct); + itkAlignedTypedef(ITK_CACHE_LINE_ALIGNMENT, + PaddedParzenWindowHistogramGetValueAndDerivativePerThreadStruct, + AlignedParzenWindowHistogramGetValueAndDerivativePerThreadStruct); + mutable AlignedParzenWindowHistogramGetValueAndDerivativePerThreadStruct * + m_ParzenWindowHistogramGetValueAndDerivativePerThreadVariables; + mutable ThreadIdType m_ParzenWindowHistogramGetValueAndDerivativePerThreadVariablesSize; + /** Variables that can/should be accessed by their Set/Get functions. */ unsigned long m_NumberOfFixedHistogramBins; unsigned long m_NumberOfMovingHistogramBins; diff --git a/Components/Metrics/PCAMetric/itkPCAMetric_F_multithreaded.h b/Components/Metrics/PCAMetric/itkPCAMetric_F_multithreaded.h index 977d66e76..ccbb5c6a1 100644 --- a/Components/Metrics/PCAMetric/itkPCAMetric_F_multithreaded.h +++ b/Components/Metrics/PCAMetric/itkPCAMetric_F_multithreaded.h @@ -163,30 +163,6 @@ class ITK_TEMPLATE_EXPORT PCAMetric : public AdvancedImageToImageMetric st_ApprovedSamples; - DerivativeType st_Derivative; - }; - - itkPadStruct(ITK_CACHE_LINE_ALIGNMENT, PCAMetricGetSamplesPerThreadStruct, PaddedPCAMetricGetSamplesPerThreadStruct); - - itkAlignedTypedef(ITK_CACHE_LINE_ALIGNMENT, - PaddedPCAMetricGetSamplesPerThreadStruct, - AlignedPCAMetricGetSamplesPerThreadStruct); - - mutable AlignedPCAMetricGetSamplesPerThreadStruct * m_PCAMetricGetSamplesPerThreadVariables; - mutable ThreadIdType m_PCAMetricGetSamplesPerThreadVariablesSize; - /** Get value and derivatives for each thread. */ inline void ThreadedGetSamples(ThreadIdType threadID); @@ -224,6 +200,30 @@ class ITK_TEMPLATE_EXPORT PCAMetric : public AdvancedImageToImageMetric st_ApprovedSamples; + DerivativeType st_Derivative; + }; + + itkPadStruct(ITK_CACHE_LINE_ALIGNMENT, PCAMetricGetSamplesPerThreadStruct, PaddedPCAMetricGetSamplesPerThreadStruct); + + itkAlignedTypedef(ITK_CACHE_LINE_ALIGNMENT, + PaddedPCAMetricGetSamplesPerThreadStruct, + AlignedPCAMetricGetSamplesPerThreadStruct); + + mutable AlignedPCAMetricGetSamplesPerThreadStruct * m_PCAMetricGetSamplesPerThreadVariables; + mutable ThreadIdType m_PCAMetricGetSamplesPerThreadVariablesSize; + unsigned int m_G; unsigned int m_LastDimIndex;