From 7e5ac36970308fde23aa29f101254e57fe8c6a3b Mon Sep 17 00:00:00 2001 From: Niels Dekker Date: Fri, 29 Mar 2019 16:01:57 +0100 Subject: [PATCH 1/6] STYLE: Made data AdvancedImageMomentsC. + ComputeDisplacementD. private Made data members of `AdvancedImageMomentsCalculator` and `ComputeDisplacementDistribution` private, including their `m_ComputePerThreadVariables` member. --- .../itkAdvancedImageMomentsCalculator.h | 16 ++++++++++------ Common/itkComputeDisplacementDistribution.h | 6 +++++- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/Common/Transforms/itkAdvancedImageMomentsCalculator.h b/Common/Transforms/itkAdvancedImageMomentsCalculator.h index a8a97c634..88c50e717 100644 --- a/Common/Transforms/itkAdvancedImageMomentsCalculator.h +++ b/Common/Transforms/itkAdvancedImageMomentsCalculator.h @@ -243,7 +243,6 @@ class AdvancedImageMomentsCalculator : public Object /** Typedefs for multi-threading. */ typedef itk::MultiThreader ThreaderType; typedef ThreaderType::ThreadInfoStruct ThreadInfoType; - ThreaderType::Pointer m_Threader; /** Launch MultiThread Compute. */ void LaunchComputeThreaderCallback(void) const; @@ -262,8 +261,6 @@ class AdvancedImageMomentsCalculator : public Object { Self * st_Self; }; - mutable MultiThreaderParameterType m_ThreaderParameters; - struct ComputePerThreadStruct { /** Used for accumulating variables. */ @@ -278,14 +275,21 @@ class AdvancedImageMomentsCalculator : public Object PaddedComputePerThreadStruct); itkAlignedTypedef(ITK_CACHE_LINE_ALIGNMENT, PaddedComputePerThreadStruct, AlignedComputePerThreadStruct); + + /** The type of region used for multithreading */ + typedef typename ImageType::RegionType ThreadRegionType; + +private: + + ThreaderType::Pointer m_Threader; + + mutable MultiThreaderParameterType m_ThreaderParameters; + mutable AlignedComputePerThreadStruct * m_ComputePerThreadVariables; mutable ThreadIdType m_ComputePerThreadVariablesSize; bool m_UseMultiThread; SizeValueType m_NumberOfPixelsCounted; - /** The type of region used for multithreading */ - typedef typename ImageType::RegionType ThreadRegionType; - SizeValueType m_NumberOfSamplesForCenteredTransformInitialization; InputPixelType m_LowerThresholdForCenterGravity; bool m_CenterOfGravityUsesLowerThreshold; diff --git a/Common/itkComputeDisplacementDistribution.h b/Common/itkComputeDisplacementDistribution.h index d7e3313d5..1ae5b3cb0 100644 --- a/Common/itkComputeDisplacementDistribution.h +++ b/Common/itkComputeDisplacementDistribution.h @@ -198,7 +198,6 @@ class ComputeDisplacementDistribution : { Self * st_Self; }; - mutable MultiThreaderParameterType m_ThreaderParameters; struct ComputePerThreadStruct { @@ -212,6 +211,11 @@ class ComputeDisplacementDistribution : PaddedComputePerThreadStruct ); itkAlignedTypedef( ITK_CACHE_LINE_ALIGNMENT, PaddedComputePerThreadStruct, AlignedComputePerThreadStruct ); + +private: + + mutable MultiThreaderParameterType m_ThreaderParameters; + mutable AlignedComputePerThreadStruct * m_ComputePerThreadVariables; mutable ThreadIdType m_ComputePerThreadVariablesSize; From 9e6ca5acab886cad06ca0a68b1733693c95f211a Mon Sep 17 00:00:00 2001 From: Niels Dekker Date: Fri, 29 Mar 2019 16:23:03 +0100 Subject: [PATCH 2/6] STYLE: Declared m_ComputePerThreadVariables as an std::vector (2 x) Declared m_ComputePerThreadVariables of both as `AdvancedImageMomentsCalculator` and `ComputeDisplacementDistribution` as an `std::vector`, instead of a raw pointer to the structs. Simplified zero-initialization of the structs. Removed manual `delete[]` statements. This commit aims to improve modern C++ style, and avoid memory leaks. --- .../itkAdvancedImageMomentsCalculator.h | 5 ++-- .../itkAdvancedImageMomentsCalculator.hxx | 24 +++---------------- Common/itkComputeDisplacementDistribution.h | 5 ++-- Common/itkComputeDisplacementDistribution.hxx | 24 +++---------------- 4 files changed, 12 insertions(+), 46 deletions(-) diff --git a/Common/Transforms/itkAdvancedImageMomentsCalculator.h b/Common/Transforms/itkAdvancedImageMomentsCalculator.h index 88c50e717..6a8631e5d 100644 --- a/Common/Transforms/itkAdvancedImageMomentsCalculator.h +++ b/Common/Transforms/itkAdvancedImageMomentsCalculator.h @@ -32,6 +32,8 @@ #include "itkMultiThreader.h" +#include + namespace itk { /** \class AdvancedImageMomentsCalculator @@ -285,8 +287,7 @@ class AdvancedImageMomentsCalculator : public Object mutable MultiThreaderParameterType m_ThreaderParameters; - mutable AlignedComputePerThreadStruct * m_ComputePerThreadVariables; - mutable ThreadIdType m_ComputePerThreadVariablesSize; + mutable std::vector m_ComputePerThreadVariables; bool m_UseMultiThread; SizeValueType m_NumberOfPixelsCounted; diff --git a/Common/Transforms/itkAdvancedImageMomentsCalculator.hxx b/Common/Transforms/itkAdvancedImageMomentsCalculator.hxx index c88d60e87..e8b538be1 100644 --- a/Common/Transforms/itkAdvancedImageMomentsCalculator.hxx +++ b/Common/Transforms/itkAdvancedImageMomentsCalculator.hxx @@ -78,8 +78,6 @@ AdvancedImageMomentsCalculator< TImage >::AdvancedImageMomentsCalculator(void) this->m_ThreaderParameters.st_Self = this; // Multi-threading structs - this->m_ComputePerThreadVariables = NULL; - this->m_ComputePerThreadVariablesSize = 0; this->m_CenterOfGravityUsesLowerThreshold = false; this->m_NumberOfSamplesForCenteredTransformInitialization = 10000; this->m_LowerThresholdForCenterGravity = 500; @@ -91,7 +89,6 @@ template< typename TImage > AdvancedImageMomentsCalculator< TImage >:: ~AdvancedImageMomentsCalculator() { - delete[] this->m_ComputePerThreadVariables; } /** @@ -114,24 +111,9 @@ AdvancedImageMomentsCalculator< TImage > */ const ThreadIdType numberOfThreads = this->m_Threader->GetNumberOfThreads(); - /** Only resize the array of structs when needed. */ - if (this->m_ComputePerThreadVariablesSize != numberOfThreads) - { - delete[] this->m_ComputePerThreadVariables; - this->m_ComputePerThreadVariables = new AlignedComputePerThreadStruct[numberOfThreads]; - this->m_ComputePerThreadVariablesSize = numberOfThreads; - } - - /** Some initialization. */ - for (ThreadIdType i = 0; i < numberOfThreads; ++i) - { - this->m_ComputePerThreadVariables[i].st_M0 = NumericTraits< ScalarType >::Zero; - this->m_ComputePerThreadVariables[i].st_M1 = NumericTraits< typename VectorType::ValueType >::Zero; - this->m_ComputePerThreadVariables[i].st_M2.Fill(NumericTraits< typename MatrixType::ValueType >::ZeroValue()); - this->m_ComputePerThreadVariables[i].st_Cg = NumericTraits< typename VectorType::ValueType >::Zero; - this->m_ComputePerThreadVariables[i].st_Cm.Fill(NumericTraits< typename MatrixType::ValueType >::ZeroValue()); - this->m_ComputePerThreadVariables[i].st_NumberOfPixelsCounted = NumericTraits< SizeValueType >::Zero; - } + /** Resize (if necessary) and assign structs of zero-initialized values */ + this->m_ComputePerThreadVariables.resize(numberOfThreads); + this->m_ComputePerThreadVariables.assign(numberOfThreads, AlignedComputePerThreadStruct()); } // end InitializeThreadingParameters() diff --git a/Common/itkComputeDisplacementDistribution.h b/Common/itkComputeDisplacementDistribution.h index 1ae5b3cb0..2773fe03a 100644 --- a/Common/itkComputeDisplacementDistribution.h +++ b/Common/itkComputeDisplacementDistribution.h @@ -26,6 +26,8 @@ #include "itkImageFullSampler.h" #include "itkMultiThreader.h" +#include + namespace itk { /**\class ComputeDisplacementDistribution @@ -216,8 +218,7 @@ class ComputeDisplacementDistribution : mutable MultiThreaderParameterType m_ThreaderParameters; - mutable AlignedComputePerThreadStruct * m_ComputePerThreadVariables; - mutable ThreadIdType m_ComputePerThreadVariablesSize; + mutable std::vector m_ComputePerThreadVariables; SizeValueType m_NumberOfPixelsCounted; bool m_UseMultiThread; diff --git a/Common/itkComputeDisplacementDistribution.hxx b/Common/itkComputeDisplacementDistribution.hxx index e358cff21..bedc8b3e8 100644 --- a/Common/itkComputeDisplacementDistribution.hxx +++ b/Common/itkComputeDisplacementDistribution.hxx @@ -63,10 +63,6 @@ ComputeDisplacementDistribution< TFixedImage, TTransform > /** Initialize the m_ThreaderParameters. */ this->m_ThreaderParameters.st_Self = this; - // Multi-threading structs - this->m_ComputePerThreadVariables = NULL; - this->m_ComputePerThreadVariablesSize = 0; - } // end Constructor @@ -78,7 +74,6 @@ template< class TFixedImage, class TTransform > ComputeDisplacementDistribution< TFixedImage, TTransform > ::~ComputeDisplacementDistribution() { - delete[] this->m_ComputePerThreadVariables; } // end Destructor @@ -102,22 +97,9 @@ ComputeDisplacementDistribution< TFixedImage, TTransform > */ const ThreadIdType numberOfThreads = this->m_Threader->GetNumberOfThreads(); - /** Only resize the array of structs when needed. */ - if( this->m_ComputePerThreadVariablesSize != numberOfThreads ) - { - delete[] this->m_ComputePerThreadVariables; - this->m_ComputePerThreadVariables = new AlignedComputePerThreadStruct[ numberOfThreads ]; - this->m_ComputePerThreadVariablesSize = numberOfThreads; - } - - /** Some initialization. */ - for( ThreadIdType i = 0; i < numberOfThreads; ++i ) - { - this->m_ComputePerThreadVariables[ i ].st_MaxJJ = NumericTraits< double >::Zero; - this->m_ComputePerThreadVariables[ i ].st_Displacement = NumericTraits< double >::Zero; - this->m_ComputePerThreadVariables[ i ].st_DisplacementSquared = NumericTraits< double >::Zero; - this->m_ComputePerThreadVariables[ i ].st_NumberOfPixelsCounted = NumericTraits< SizeValueType >::Zero; - } + /** Resize (if necessary) and assign structs of zero-initialized values */ + this->m_ComputePerThreadVariables.resize(numberOfThreads); + this->m_ComputePerThreadVariables.assign(numberOfThreads, AlignedComputePerThreadStruct()); } // end InitializeThreadingParameters() From 0bff30a49056fea9ea94a187bd3f67730350b530 Mon Sep 17 00:00:00 2001 From: Niels Dekker Date: Mon, 1 Apr 2019 10:46:56 +0200 Subject: [PATCH 3/6] STYLE: Remove mutable from AdvancedImageMomentsC., ComputeDisplacementD. Removed the `mutable` keyword from `AdvancedImageMomentsCalculator` and `ComputeDisplacementDistribution` data members. The `mutable` keyword should only be used when really necessary (specifically for const-correctness). --- Common/Transforms/itkAdvancedImageMomentsCalculator.h | 4 ++-- Common/itkComputeDisplacementDistribution.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Common/Transforms/itkAdvancedImageMomentsCalculator.h b/Common/Transforms/itkAdvancedImageMomentsCalculator.h index 6a8631e5d..b28cf0522 100644 --- a/Common/Transforms/itkAdvancedImageMomentsCalculator.h +++ b/Common/Transforms/itkAdvancedImageMomentsCalculator.h @@ -285,9 +285,9 @@ class AdvancedImageMomentsCalculator : public Object ThreaderType::Pointer m_Threader; - mutable MultiThreaderParameterType m_ThreaderParameters; + MultiThreaderParameterType m_ThreaderParameters; - mutable std::vector m_ComputePerThreadVariables; + std::vector m_ComputePerThreadVariables; bool m_UseMultiThread; SizeValueType m_NumberOfPixelsCounted; diff --git a/Common/itkComputeDisplacementDistribution.h b/Common/itkComputeDisplacementDistribution.h index 2773fe03a..2d231b9d2 100644 --- a/Common/itkComputeDisplacementDistribution.h +++ b/Common/itkComputeDisplacementDistribution.h @@ -216,9 +216,9 @@ class ComputeDisplacementDistribution : private: - mutable MultiThreaderParameterType m_ThreaderParameters; + MultiThreaderParameterType m_ThreaderParameters; - mutable std::vector m_ComputePerThreadVariables; + std::vector m_ComputePerThreadVariables; SizeValueType m_NumberOfPixelsCounted; bool m_UseMultiThread; From 68ceddd2554bb5621518a059ce5d75ab616b19b6 Mon Sep 17 00:00:00 2001 From: Niels Dekker Date: Fri, 29 Mar 2019 16:01:57 +0100 Subject: [PATCH 4/6] STYLE: Made data AdvancedImageMomentsC. + ComputeDisplacementD. private Made data members of `AdvancedImageMomentsCalculator` and `ComputeDisplacementDistribution` private, including their `m_ComputePerThreadVariables` member. --- .../itkAdvancedImageMomentsCalculator.h | 16 ++++++++++------ Common/itkComputeDisplacementDistribution.h | 6 +++++- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/Common/Transforms/itkAdvancedImageMomentsCalculator.h b/Common/Transforms/itkAdvancedImageMomentsCalculator.h index 9f294bd20..189845884 100644 --- a/Common/Transforms/itkAdvancedImageMomentsCalculator.h +++ b/Common/Transforms/itkAdvancedImageMomentsCalculator.h @@ -243,7 +243,6 @@ class AdvancedImageMomentsCalculator : public Object /** Typedefs for multi-threading. */ typedef itk::MultiThreader ThreaderType; typedef ThreaderType::ThreadInfoStruct ThreadInfoType; - ThreaderType::Pointer m_Threader; /** Launch MultiThread Compute. */ void LaunchComputeThreaderCallback(void) const; @@ -262,8 +261,6 @@ class AdvancedImageMomentsCalculator : public Object { Self * st_Self; }; - mutable MultiThreaderParameterType m_ThreaderParameters; - struct ComputePerThreadStruct { /** Used for accumulating variables. */ @@ -278,14 +275,21 @@ class AdvancedImageMomentsCalculator : public Object PaddedComputePerThreadStruct); itkAlignedTypedef(ITK_CACHE_LINE_ALIGNMENT, PaddedComputePerThreadStruct, AlignedComputePerThreadStruct); + + /** The type of region used for multithreading */ + typedef typename ImageType::RegionType ThreadRegionType; + +private: + + ThreaderType::Pointer m_Threader; + + mutable MultiThreaderParameterType m_ThreaderParameters; + mutable AlignedComputePerThreadStruct * m_ComputePerThreadVariables; mutable ThreadIdType m_ComputePerThreadVariablesSize; bool m_UseMultiThread; SizeValueType m_NumberOfPixelsCounted; - /** The type of region used for multithreading */ - typedef typename ImageType::RegionType ThreadRegionType; - SizeValueType m_NumberOfSamplesForCenteredTransformInitialization; InputPixelType m_LowerThresholdForCenterGravity; bool m_CenterOfGravityUsesLowerThreshold; diff --git a/Common/itkComputeDisplacementDistribution.h b/Common/itkComputeDisplacementDistribution.h index 3ded2ed3a..b69d22c52 100644 --- a/Common/itkComputeDisplacementDistribution.h +++ b/Common/itkComputeDisplacementDistribution.h @@ -198,7 +198,6 @@ class ComputeDisplacementDistribution : { Self * st_Self; }; - mutable MultiThreaderParameterType m_ThreaderParameters; struct ComputePerThreadStruct { @@ -212,6 +211,11 @@ class ComputeDisplacementDistribution : PaddedComputePerThreadStruct ); itkAlignedTypedef( ITK_CACHE_LINE_ALIGNMENT, PaddedComputePerThreadStruct, AlignedComputePerThreadStruct ); + +private: + + mutable MultiThreaderParameterType m_ThreaderParameters; + mutable AlignedComputePerThreadStruct * m_ComputePerThreadVariables; mutable ThreadIdType m_ComputePerThreadVariablesSize; From a9df49eb41466d590e6c13534d281566fdfbd43b Mon Sep 17 00:00:00 2001 From: Niels Dekker Date: Fri, 29 Mar 2019 16:23:03 +0100 Subject: [PATCH 5/6] STYLE: Declared m_ComputePerThreadVariables as an std::vector (2 x) Declared m_ComputePerThreadVariables of both as `AdvancedImageMomentsCalculator` and `ComputeDisplacementDistribution` as an `std::vector`, instead of a raw pointer to the structs. Simplified zero-initialization of the structs. Removed manual `delete[]` statements. This commit aims to improve modern C++ style, and avoid memory leaks. --- .../itkAdvancedImageMomentsCalculator.h | 5 ++-- .../itkAdvancedImageMomentsCalculator.hxx | 24 +++---------------- Common/itkComputeDisplacementDistribution.h | 5 ++-- Common/itkComputeDisplacementDistribution.hxx | 24 +++---------------- 4 files changed, 12 insertions(+), 46 deletions(-) diff --git a/Common/Transforms/itkAdvancedImageMomentsCalculator.h b/Common/Transforms/itkAdvancedImageMomentsCalculator.h index 189845884..edab95433 100644 --- a/Common/Transforms/itkAdvancedImageMomentsCalculator.h +++ b/Common/Transforms/itkAdvancedImageMomentsCalculator.h @@ -32,6 +32,8 @@ #include "itkMultiThreader.h" +#include + namespace itk { /** \class AdvancedImageMomentsCalculator @@ -285,8 +287,7 @@ class AdvancedImageMomentsCalculator : public Object mutable MultiThreaderParameterType m_ThreaderParameters; - mutable AlignedComputePerThreadStruct * m_ComputePerThreadVariables; - mutable ThreadIdType m_ComputePerThreadVariablesSize; + mutable std::vector m_ComputePerThreadVariables; bool m_UseMultiThread; SizeValueType m_NumberOfPixelsCounted; diff --git a/Common/Transforms/itkAdvancedImageMomentsCalculator.hxx b/Common/Transforms/itkAdvancedImageMomentsCalculator.hxx index 4b99c0d76..98564aabe 100644 --- a/Common/Transforms/itkAdvancedImageMomentsCalculator.hxx +++ b/Common/Transforms/itkAdvancedImageMomentsCalculator.hxx @@ -78,8 +78,6 @@ AdvancedImageMomentsCalculator< TImage >::AdvancedImageMomentsCalculator(void) this->m_ThreaderParameters.st_Self = this; // Multi-threading structs - this->m_ComputePerThreadVariables = NULL; - this->m_ComputePerThreadVariablesSize = 0; this->m_CenterOfGravityUsesLowerThreshold = false; this->m_NumberOfSamplesForCenteredTransformInitialization = 10000; this->m_LowerThresholdForCenterGravity = 500; @@ -91,7 +89,6 @@ template< typename TImage > AdvancedImageMomentsCalculator< TImage >:: ~AdvancedImageMomentsCalculator() { - delete[] this->m_ComputePerThreadVariables; } /** @@ -114,24 +111,9 @@ AdvancedImageMomentsCalculator< TImage > */ const ThreadIdType numberOfThreads = this->m_Threader->GetNumberOfThreads(); - /** Only resize the array of structs when needed. */ - if (this->m_ComputePerThreadVariablesSize != numberOfThreads) - { - delete[] this->m_ComputePerThreadVariables; - this->m_ComputePerThreadVariables = new AlignedComputePerThreadStruct[numberOfThreads]; - this->m_ComputePerThreadVariablesSize = numberOfThreads; - } - - /** Some initialization. */ - for (ThreadIdType i = 0; i < numberOfThreads; ++i) - { - this->m_ComputePerThreadVariables[i].st_M0 = NumericTraits< ScalarType >::Zero; - this->m_ComputePerThreadVariables[i].st_M1 = NumericTraits< typename VectorType::ValueType >::Zero; - this->m_ComputePerThreadVariables[i].st_M2.Fill(NumericTraits< typename MatrixType::ValueType >::ZeroValue()); - this->m_ComputePerThreadVariables[i].st_Cg = NumericTraits< typename VectorType::ValueType >::Zero; - this->m_ComputePerThreadVariables[i].st_Cm.Fill(NumericTraits< typename MatrixType::ValueType >::ZeroValue()); - this->m_ComputePerThreadVariables[i].st_NumberOfPixelsCounted = NumericTraits< SizeValueType >::Zero; - } + /** Resize (if necessary) and assign structs of zero-initialized values */ + this->m_ComputePerThreadVariables.resize(numberOfThreads); + this->m_ComputePerThreadVariables.assign(numberOfThreads, AlignedComputePerThreadStruct()); } // end InitializeThreadingParameters() diff --git a/Common/itkComputeDisplacementDistribution.h b/Common/itkComputeDisplacementDistribution.h index b69d22c52..740a6b3af 100644 --- a/Common/itkComputeDisplacementDistribution.h +++ b/Common/itkComputeDisplacementDistribution.h @@ -26,6 +26,8 @@ #include "itkImageFullSampler.h" #include "itkMultiThreader.h" +#include + namespace itk { /**\class ComputeDisplacementDistribution @@ -216,8 +218,7 @@ class ComputeDisplacementDistribution : mutable MultiThreaderParameterType m_ThreaderParameters; - mutable AlignedComputePerThreadStruct * m_ComputePerThreadVariables; - mutable ThreadIdType m_ComputePerThreadVariablesSize; + mutable std::vector m_ComputePerThreadVariables; SizeValueType m_NumberOfPixelsCounted; bool m_UseMultiThread; diff --git a/Common/itkComputeDisplacementDistribution.hxx b/Common/itkComputeDisplacementDistribution.hxx index 28fa827cd..437cf6401 100644 --- a/Common/itkComputeDisplacementDistribution.hxx +++ b/Common/itkComputeDisplacementDistribution.hxx @@ -63,10 +63,6 @@ ComputeDisplacementDistribution< TFixedImage, TTransform > /** Initialize the m_ThreaderParameters. */ this->m_ThreaderParameters.st_Self = this; - // Multi-threading structs - this->m_ComputePerThreadVariables = NULL; - this->m_ComputePerThreadVariablesSize = 0; - } // end Constructor @@ -78,7 +74,6 @@ template< class TFixedImage, class TTransform > ComputeDisplacementDistribution< TFixedImage, TTransform > ::~ComputeDisplacementDistribution() { - delete[] this->m_ComputePerThreadVariables; } // end Destructor @@ -102,22 +97,9 @@ ComputeDisplacementDistribution< TFixedImage, TTransform > */ const ThreadIdType numberOfThreads = this->m_Threader->GetNumberOfThreads(); - /** Only resize the array of structs when needed. */ - if( this->m_ComputePerThreadVariablesSize != numberOfThreads ) - { - delete[] this->m_ComputePerThreadVariables; - this->m_ComputePerThreadVariables = new AlignedComputePerThreadStruct[ numberOfThreads ]; - this->m_ComputePerThreadVariablesSize = numberOfThreads; - } - - /** Some initialization. */ - for( ThreadIdType i = 0; i < numberOfThreads; ++i ) - { - this->m_ComputePerThreadVariables[ i ].st_MaxJJ = NumericTraits< double >::Zero; - this->m_ComputePerThreadVariables[ i ].st_Displacement = NumericTraits< double >::Zero; - this->m_ComputePerThreadVariables[ i ].st_DisplacementSquared = NumericTraits< double >::Zero; - this->m_ComputePerThreadVariables[ i ].st_NumberOfPixelsCounted = NumericTraits< SizeValueType >::Zero; - } + /** Resize (if necessary) and assign structs of zero-initialized values */ + this->m_ComputePerThreadVariables.resize(numberOfThreads); + this->m_ComputePerThreadVariables.assign(numberOfThreads, AlignedComputePerThreadStruct()); } // end InitializeThreadingParameters() From 6c44a574df2de3b2d313a331afe3b0e1f65c2f34 Mon Sep 17 00:00:00 2001 From: Niels Dekker Date: Mon, 1 Apr 2019 10:46:56 +0200 Subject: [PATCH 6/6] STYLE: Remove mutable from AdvancedImageMomentsC., ComputeDisplacementD. Removed the `mutable` keyword from `AdvancedImageMomentsCalculator` and `ComputeDisplacementDistribution` data members. The `mutable` keyword should only be used when really necessary (specifically for const-correctness). --- Common/Transforms/itkAdvancedImageMomentsCalculator.h | 4 ++-- Common/itkComputeDisplacementDistribution.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Common/Transforms/itkAdvancedImageMomentsCalculator.h b/Common/Transforms/itkAdvancedImageMomentsCalculator.h index edab95433..ff7a29fef 100644 --- a/Common/Transforms/itkAdvancedImageMomentsCalculator.h +++ b/Common/Transforms/itkAdvancedImageMomentsCalculator.h @@ -285,9 +285,9 @@ class AdvancedImageMomentsCalculator : public Object ThreaderType::Pointer m_Threader; - mutable MultiThreaderParameterType m_ThreaderParameters; + MultiThreaderParameterType m_ThreaderParameters; - mutable std::vector m_ComputePerThreadVariables; + std::vector m_ComputePerThreadVariables; bool m_UseMultiThread; SizeValueType m_NumberOfPixelsCounted; diff --git a/Common/itkComputeDisplacementDistribution.h b/Common/itkComputeDisplacementDistribution.h index 740a6b3af..7114976f4 100644 --- a/Common/itkComputeDisplacementDistribution.h +++ b/Common/itkComputeDisplacementDistribution.h @@ -216,9 +216,9 @@ class ComputeDisplacementDistribution : private: - mutable MultiThreaderParameterType m_ThreaderParameters; + MultiThreaderParameterType m_ThreaderParameters; - mutable std::vector m_ComputePerThreadVariables; + std::vector m_ComputePerThreadVariables; SizeValueType m_NumberOfPixelsCounted; bool m_UseMultiThread;