Skip to content

Commit 554c442

Browse files
N-Dekkerdzenanz
authored andcommitted
STYLE: Default default-constructor of SpatialFunction classes
Defaulted the default-constructors of five SpatialFunction class templates: - BinaryThresholdSpatialFunction - EllipsoidInteriorExteriorSpatialFunction - GaussianDerivativeSpatialFunction - GaussianSpatialFunction - SphereSpatialFunction
1 parent a51d204 commit 554c442

10 files changed

+13
-53
lines changed

Modules/Core/Common/include/itkBinaryThresholdSpatialFunction.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,13 +87,13 @@ class ITK_TEMPLATE_EXPORT BinaryThresholdSpatialFunction
8787
Evaluate(const InputType & point) const override;
8888

8989
protected:
90-
BinaryThresholdSpatialFunction();
90+
BinaryThresholdSpatialFunction() = default;
9191
~BinaryThresholdSpatialFunction() override = default;
9292
void
9393
PrintSelf(std::ostream & os, Indent indent) const override;
9494

95-
FunctionOutputType m_LowerThreshold{};
96-
FunctionOutputType m_UpperThreshold{};
95+
FunctionOutputType m_LowerThreshold{ NumericTraits<FunctionOutputType>::NonpositiveMin() };
96+
FunctionOutputType m_UpperThreshold{ NumericTraits<FunctionOutputType>::max() };
9797

9898
typename FunctionType::Pointer m_Function{};
9999
};

Modules/Core/Common/include/itkBinaryThresholdSpatialFunction.hxx

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,6 @@
2121

2222
namespace itk
2323
{
24-
template <typename TFunction>
25-
BinaryThresholdSpatialFunction<TFunction>::BinaryThresholdSpatialFunction()
26-
{
27-
m_LowerThreshold = NumericTraits<FunctionOutputType>::NonpositiveMin();
28-
m_UpperThreshold = NumericTraits<FunctionOutputType>::max();
29-
m_Function = nullptr;
30-
}
3124

3225
template <typename TFunction>
3326
void

Modules/Core/Common/include/itkEllipsoidInteriorExteriorSpatialFunction.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ class ITK_TEMPLATE_EXPORT EllipsoidInteriorExteriorSpatialFunction
8181
Evaluate(const InputType & position) const override;
8282

8383
protected:
84-
EllipsoidInteriorExteriorSpatialFunction();
84+
EllipsoidInteriorExteriorSpatialFunction() = default;
8585
~EllipsoidInteriorExteriorSpatialFunction() override = default;
8686

8787
void
@@ -92,7 +92,7 @@ class ITK_TEMPLATE_EXPORT EllipsoidInteriorExteriorSpatialFunction
9292
InputType m_Center{};
9393

9494
/** The axes lengths of the ellipsoid. */
95-
InputType m_Axes{};
95+
InputType m_Axes{ MakeFilled<InputType>(1.0f) };
9696

9797
/** The orientation vectors (must be orthogonal) of the ellipsoid axes. */
9898
OrientationType m_Orientations{};

Modules/Core/Common/include/itkEllipsoidInteriorExteriorSpatialFunction.hxx

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,6 @@
2222

2323
namespace itk
2424
{
25-
template <unsigned int VDimension, typename TInput>
26-
EllipsoidInteriorExteriorSpatialFunction<VDimension, TInput>::EllipsoidInteriorExteriorSpatialFunction()
27-
{
28-
m_Axes.Fill(1.0f); // Lengths of ellipsoid axes.
29-
m_Center.Fill(0.0f); // Origin of ellipsoid
30-
}
31-
3225
template <unsigned int VDimension, typename TInput>
3326
auto
3427
EllipsoidInteriorExteriorSpatialFunction<VDimension, TInput>::Evaluate(const InputType & position) const -> OutputType

Modules/Core/Common/include/itkGaussianDerivativeSpatialFunction.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ class ITK_TEMPLATE_EXPORT GaussianDerivativeSpatialFunction : public SpatialFunc
9191
itkGetConstMacro(Direction, unsigned int);
9292

9393
protected:
94-
GaussianDerivativeSpatialFunction();
94+
GaussianDerivativeSpatialFunction() = default;
9595
~GaussianDerivativeSpatialFunction() override = default;
9696
void
9797
PrintSelf(std::ostream & os, Indent indent) const override;
@@ -101,13 +101,13 @@ class ITK_TEMPLATE_EXPORT GaussianDerivativeSpatialFunction : public SpatialFunc
101101
mutable unsigned int m_Direction{};
102102

103103
/** The standard deviation in each direction. */
104-
ArrayType m_Sigma{};
104+
ArrayType m_Sigma{ ArrayType::Filled(1.0) };
105105

106106
/** The mean in each direction. */
107107
ArrayType m_Mean{};
108108

109109
/** A scale factor multiplied by the true value of the Gaussian. */
110-
double m_Scale{};
110+
double m_Scale{ 1.0 };
111111

112112
/** Whether or not to normalize the Gaussian. */
113113
bool m_Normalized{};

Modules/Core/Common/include/itkGaussianDerivativeSpatialFunction.hxx

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,6 @@
2323

2424
namespace itk
2525
{
26-
template <typename TOutput, unsigned int VImageDimension, typename TInput>
27-
GaussianDerivativeSpatialFunction<TOutput, VImageDimension, TInput>::GaussianDerivativeSpatialFunction()
28-
{
29-
m_Mean = ArrayType::Filled(0.0);
30-
m_Sigma = ArrayType::Filled(1.0);
31-
m_Scale = 1.0;
32-
m_Normalized = false;
33-
m_Direction = 0;
34-
}
35-
3626
template <typename TOutput, unsigned int VImageDimension, typename TInput>
3727
auto
3828
GaussianDerivativeSpatialFunction<TOutput, VImageDimension, TInput>::Evaluate(const TInput & position) const

Modules/Core/Common/include/itkGaussianSpatialFunction.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,15 +89,15 @@ class ITK_TEMPLATE_EXPORT GaussianSpatialFunction : public SpatialFunction<TOutp
8989
itkGetConstMacro(Mean, ArrayType);
9090

9191
protected:
92-
GaussianSpatialFunction();
92+
GaussianSpatialFunction() = default;
9393
~GaussianSpatialFunction() override = default;
9494
void
9595
PrintSelf(std::ostream & os, Indent indent) const override;
9696

9797
private:
98-
ArrayType m_Sigma{};
98+
ArrayType m_Sigma{ ArrayType::Filled(5.0) };
9999

100-
ArrayType m_Mean{};
100+
ArrayType m_Mean{ ArrayType::Filled(10.0) };
101101

102102
double m_Scale{ 1.0 };
103103

Modules/Core/Common/include/itkGaussianSpatialFunction.hxx

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,6 @@
2323

2424
namespace itk
2525
{
26-
template <typename TOutput, unsigned int VImageDimension, typename TInput>
27-
GaussianSpatialFunction<TOutput, VImageDimension, TInput>::GaussianSpatialFunction()
28-
29-
{
30-
m_Mean = ArrayType::Filled(10.0);
31-
m_Sigma = ArrayType::Filled(5.0);
32-
}
33-
3426
template <typename TOutput, unsigned int VImageDimension, typename TInput>
3527
auto
3628
GaussianSpatialFunction<TOutput, VImageDimension, TInput>::Evaluate(const TInput & position) const -> OutputType

Modules/Core/Common/include/itkSphereSpatialFunction.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ class ITK_TEMPLATE_EXPORT SphereSpatialFunction : public InteriorExteriorSpatial
6868
itkSetMacro(Radius, double);
6969

7070
protected:
71-
SphereSpatialFunction();
71+
SphereSpatialFunction() = default;
7272
~SphereSpatialFunction() override = default;
7373
void
7474
PrintSelf(std::ostream & os, Indent indent) const override;
@@ -78,7 +78,7 @@ class ITK_TEMPLATE_EXPORT SphereSpatialFunction : public InteriorExteriorSpatial
7878
InputType m_Center{};
7979

8080
/** The radius of the sphere. */
81-
double m_Radius{};
81+
double m_Radius{ 1.0 };
8282
};
8383
} // end namespace itk
8484

Modules/Core/Common/include/itkSphereSpatialFunction.hxx

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,6 @@
2121

2222
namespace itk
2323
{
24-
template <unsigned int VImageDimension, typename TInput>
25-
SphereSpatialFunction<VImageDimension, TInput>::SphereSpatialFunction()
26-
{
27-
m_Radius = 1.0;
28-
29-
m_Center.Fill(0.0f);
30-
}
31-
3224
template <unsigned int VImageDimension, typename TInput>
3325
auto
3426
SphereSpatialFunction<VImageDimension, TInput>::Evaluate(const InputType & position) const -> OutputType

0 commit comments

Comments
 (0)