Skip to content

Commit

Permalink
STYLE: Make threading related data of metrics private
Browse files Browse the repository at this point in the history
Applies to both `PCAMetric` and `ParzenWindowHistogramImageToImageMetric`.

Follow-up to pull request #643 commit ab0c8df "STYLE: Make data ImageMomentsCalculator, ComputeDisplacementDist private"
  • Loading branch information
N-Dekker committed May 6, 2022
1 parent 398cea9 commit ed8b3b7
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 51 deletions.
54 changes: 27 additions & 27 deletions Common/CostFunctions/itkParzenWindowHistogramImageToImageMetric.h
Original file line number Diff line number Diff line change
Expand Up @@ -294,33 +294,6 @@ class ITK_TEMPLATE_EXPORT ParzenWindowHistogramImageToImageMetric
KernelFunctionPointer m_MovingKernel;
KernelFunctionPointer m_DerivativeMovingKernel;

/** Threading related parameters. */
mutable std::vector<JointPDFPointer> 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;
Expand Down Expand Up @@ -505,6 +478,33 @@ class ITK_TEMPLATE_EXPORT ParzenWindowHistogramImageToImageMetric
void
operator=(const Self &) = delete;

/** Threading related parameters. */
mutable std::vector<JointPDFPointer> 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;
Expand Down
48 changes: 24 additions & 24 deletions Components/Metrics/PCAMetric/itkPCAMetric_F_multithreaded.h
Original file line number Diff line number Diff line change
Expand Up @@ -163,30 +163,6 @@ class ITK_TEMPLATE_EXPORT PCAMetric : public AdvancedImageToImageMetric<TFixedIm
const MovingImageDerivativeType & movingImageDerivative,
DerivativeType & imageJacobian) const override;

struct PCAMetricMultiThreaderParameterType
{
Self * m_Metric;
};

PCAMetricMultiThreaderParameterType m_PCAMetricThreaderParameters;

struct PCAMetricGetSamplesPerThreadStruct
{
SizeValueType st_NumberOfPixelsCounted;
MatrixType st_DataBlock;
std::vector<FixedImagePointType> 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);
Expand Down Expand Up @@ -224,6 +200,30 @@ class ITK_TEMPLATE_EXPORT PCAMetric : public AdvancedImageToImageMetric<TFixedIm
void
operator=(const Self &) = delete;

struct PCAMetricMultiThreaderParameterType
{
Self * m_Metric;
};

PCAMetricMultiThreaderParameterType m_PCAMetricThreaderParameters;

struct PCAMetricGetSamplesPerThreadStruct
{
SizeValueType st_NumberOfPixelsCounted;
MatrixType st_DataBlock;
std::vector<FixedImagePointType> 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;

Expand Down

0 comments on commit ed8b3b7

Please sign in to comment.