Skip to content

Commit

Permalink
STYLE: Use true as default member initializer for m_UseImageDirection
Browse files Browse the repository at this point in the history
Removed `m_UseImageDirection = true` assignment from the function body of the
corresponding constructors.

Following C++ Core Guidelines, February 15, 2024 "Prefer initialization to
assignment in constructors",
http://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#c49-prefer-initialization-to-assignment-in-constructors
  • Loading branch information
N-Dekker committed Mar 12, 2024
1 parent ddea89f commit 16456e1
Show file tree
Hide file tree
Showing 10 changed files with 6 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ class ITK_TEMPLATE_EXPORT VectorCentralDifferenceImageFunction
private:
// flag to take or not the image direction into account
// when computing the derivatives.
bool m_UseImageDirection{};
bool m_UseImageDirection{ true };
};
} // end namespace itk

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,7 @@ namespace itk

template <typename TInputImage, typename TCoordRep>
VectorCentralDifferenceImageFunction<TInputImage, TCoordRep>::VectorCentralDifferenceImageFunction()
{
this->m_UseImageDirection = true;
}
{}

template <typename TInputImage, typename TCoordRep>
void
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,7 @@ class ITK_TEMPLATE_EXPORT BSplineInterpolateImageFunction : public InterpolateIm

// flag to take or not the image direction into account when computing the
// derivatives.
bool m_UseImageDirection{};
bool m_UseImageDirection{ true };

ThreadIdType m_NumberOfWorkUnits{};
std::unique_ptr<vnl_matrix<long>[]> m_ThreadedEvaluateIndex;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ BSplineInterpolateImageFunction<TImageType, TCoordRep, TCoefficientType>::BSplin
m_SplineOrder = 0;
unsigned int SplineOrder = 3;
this->SetSplineOrder(SplineOrder);
this->m_UseImageDirection = true;
}

template <typename TImageType, typename TCoordRep, typename TCoefficientType>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ class ITK_TEMPLATE_EXPORT CentralDifferenceImageFunction : public ImageFunction<

// flag to take or not the image direction into account
// when computing the derivatives.
bool m_UseImageDirection{};
bool m_UseImageDirection{ true };

// interpolator
InterpolatorPointer m_Interpolator{};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ namespace itk
template <typename TInputImage, typename TCoordRep, typename TOutputType>
CentralDifferenceImageFunction<TInputImage, TCoordRep, TOutputType>::CentralDifferenceImageFunction()
{
this->m_UseImageDirection = true;

using LinearInterpolatorType = LinearInterpolateImageFunction<TInputImage, TCoordRep>;
this->m_Interpolator = LinearInterpolatorType::New();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ class ITK_TEMPLATE_EXPORT GradientImageFilter : public ImageToImageFilter<TInput

// flag to take or not the image direction into account
// when computing the derivatives.
bool m_UseImageDirection{};
bool m_UseImageDirection{ true };

// allow setting the the m_BoundaryCondition
ImageBoundaryCondition<TInputImage, TInputImage> * m_BoundaryCondition{};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ GradientImageFilter<TInputImage, TOperatorValueType, TOutputValueType, TOutputIm
{
// default boundary condition
m_BoundaryCondition = new ZeroFluxNeumannBoundaryCondition<TInputImage>();
this->m_UseImageDirection = true;
this->DynamicMultiThreadingOn();
this->ThreaderUpdateProgressOff();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ class ITK_TEMPLATE_EXPORT GradientRecursiveGaussianImageFilter : public ImageToI
bool m_NormalizeAcrossScale{};

/** Take into account image orientation when computing the Gradient */
bool m_UseImageDirection{};
bool m_UseImageDirection{ true };

/** Standard deviation of the gaussian */
SigmaArrayType m_Sigma{};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ template <typename TInputImage, typename TOutputImage>
GradientRecursiveGaussianImageFilter<TInputImage, TOutputImage>::GradientRecursiveGaussianImageFilter()
{
m_NormalizeAcrossScale = false;
this->m_UseImageDirection = true;

static_assert(ImageDimension > 0, "Images shall have one dimension at least");
const unsigned int imageDimensionMinus1 = ImageDimension - 1;
Expand Down

0 comments on commit 16456e1

Please sign in to comment.