Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

STYLE: Make data ImageMomentsCalculator, ComputeDisplacementDist private #643

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 14 additions & 11 deletions Common/Transforms/itkAdvancedImageMomentsCalculator.h
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,6 @@ class ITK_TEMPLATE_EXPORT AdvancedImageMomentsCalculator : public Object
/** Typedefs for multi-threading. */
using ThreaderType = itk::PlatformMultiThreader;
using ThreadInfoType = ThreaderType::WorkUnitInfo;
ThreaderType::Pointer m_Threader;

/** Launch MultiThread Compute. */
void
Expand All @@ -280,7 +279,6 @@ class ITK_TEMPLATE_EXPORT AdvancedImageMomentsCalculator : public Object
{
Self * st_Self;
};
mutable MultiThreaderParameterType m_ThreaderParameters;

struct ComputePerThreadStruct
{
Expand All @@ -294,19 +292,10 @@ class ITK_TEMPLATE_EXPORT AdvancedImageMomentsCalculator : public Object
};
itkPadStruct(ITK_CACHE_LINE_ALIGNMENT, ComputePerThreadStruct, PaddedComputePerThreadStruct);
itkAlignedTypedef(ITK_CACHE_LINE_ALIGNMENT, PaddedComputePerThreadStruct, AlignedComputePerThreadStruct);
mutable AlignedComputePerThreadStruct * m_ComputePerThreadVariables;
mutable ThreadIdType m_ComputePerThreadVariablesSize;
bool m_UseMultiThread;
SizeValueType m_NumberOfPixelsCounted;

/** The type of region used for multithreading */
using ThreadRegionType = typename ImageType::RegionType;

SizeValueType m_NumberOfSamplesForCenteredTransformInitialization;
InputPixelType m_LowerThresholdForCenterGravity;
bool m_CenterOfGravityUsesLowerThreshold;
ImageSampleContainerPointer m_SampleContainer;

private:
/** Internal helper function. Does post processing at the end of
* ComputeSingleThreaded() and AfterThreadedCompute() */
Expand All @@ -317,6 +306,20 @@ class ITK_TEMPLATE_EXPORT AdvancedImageMomentsCalculator : public Object
void
operator=(const Self &);

ThreaderType::Pointer m_Threader;

mutable MultiThreaderParameterType m_ThreaderParameters;

mutable AlignedComputePerThreadStruct * m_ComputePerThreadVariables;
mutable ThreadIdType m_ComputePerThreadVariablesSize;
bool m_UseMultiThread;
SizeValueType m_NumberOfPixelsCounted;

SizeValueType m_NumberOfSamplesForCenteredTransformInitialization;
InputPixelType m_LowerThresholdForCenterGravity;
bool m_CenterOfGravityUsesLowerThreshold;
ImageSampleContainerPointer m_SampleContainer;

bool m_Valid; // Have moments been computed yet?
ScalarType m_M0; // Zeroth moment
VectorType m_M1; // First moments about origin
Expand Down
7 changes: 4 additions & 3 deletions Common/itkComputeDisplacementDistribution.h
Original file line number Diff line number Diff line change
Expand Up @@ -200,8 +200,6 @@ class ITK_TEMPLATE_EXPORT ComputeDisplacementDistribution : public ScaledSingleV
{
Self * st_Self;
};
mutable MultiThreaderParameterType m_ThreaderParameters;

struct ComputePerThreadStruct
{
/** Used for accumulating variables. */
Expand All @@ -212,14 +210,17 @@ class ITK_TEMPLATE_EXPORT ComputeDisplacementDistribution : public ScaledSingleV
};
itkPadStruct(ITK_CACHE_LINE_ALIGNMENT, ComputePerThreadStruct, PaddedComputePerThreadStruct);
itkAlignedTypedef(ITK_CACHE_LINE_ALIGNMENT, PaddedComputePerThreadStruct, AlignedComputePerThreadStruct);

private:
mutable MultiThreaderParameterType m_ThreaderParameters;

mutable AlignedComputePerThreadStruct * m_ComputePerThreadVariables;
mutable ThreadIdType m_ComputePerThreadVariablesSize;

SizeValueType m_NumberOfPixelsCounted;
bool m_UseMultiThread;
ImageSampleContainerPointer m_SampleContainer;

private:
ComputeDisplacementDistribution(const Self &) = delete;
void
operator=(const Self &) = delete;
Expand Down