diff --git a/Modules/Core/Common/include/itkBackwardDifferenceOperator.hxx b/Modules/Core/Common/include/itkBackwardDifferenceOperator.hxx index 74ea2ee1d6c..36f04a8ca21 100644 --- a/Modules/Core/Common/include/itkBackwardDifferenceOperator.hxx +++ b/Modules/Core/Common/include/itkBackwardDifferenceOperator.hxx @@ -29,7 +29,7 @@ BackwardDifferenceOperator::GenerateCoefficients coeff[0] = -1.0 * NumericTraits::OneValue(); coeff[1] = NumericTraits::OneValue(); - coeff[2] = NumericTraits::ZeroValue(); + coeff[2] = PixelType{}; return coeff; } diff --git a/Modules/Core/Common/include/itkBoundingBox.hxx b/Modules/Core/Common/include/itkBoundingBox.hxx index 8b5c156373d..2e0817ffd0f 100644 --- a/Modules/Core/Common/include/itkBoundingBox.hxx +++ b/Modules/Core/Common/include/itkBoundingBox.hxx @@ -134,7 +134,7 @@ BoundingBox::Com { if (this->GetMTime() > m_BoundsMTime) { - m_Bounds.Fill(NumericTraits::ZeroValue()); + m_Bounds.Fill(CoordRepType{}); m_BoundsMTime.Modified(); } return false; @@ -146,7 +146,7 @@ BoundingBox::Com // start by initializing the values if (m_PointsContainer->Size() < 1) { - m_Bounds.Fill(NumericTraits::ZeroValue()); + m_Bounds.Fill(CoordRepType{}); m_BoundsMTime.Modified(); return false; } @@ -285,7 +285,7 @@ auto BoundingBox::GetDiagonalLength2() const -> AccumulateType { - typename NumericTraits::AccumulateType dist2 = NumericTraits::ZeroValue(); + typename NumericTraits::AccumulateType dist2 = CoordRepType{}; if (this->ComputeBoundingBox()) { diff --git a/Modules/Core/Common/include/itkCellInterface.h b/Modules/Core/Common/include/itkCellInterface.h index 207ab00166d..b02049416e4 100644 --- a/Modules/Core/Common/include/itkCellInterface.h +++ b/Modules/Core/Common/include/itkCellInterface.h @@ -387,7 +387,7 @@ class ITK_TEMPLATE_EXPORT CellInterface CoordRepType GetBoundingBoxDiagonalLength2() { - return NumericTraits::ZeroValue(); + return CoordRepType{}; } /** Intersect the given bounding box (bounds[PointDimension*2]) with a line diff --git a/Modules/Core/Common/include/itkColorTable.hxx b/Modules/Core/Common/include/itkColorTable.hxx index d6cb008d3f3..94b08ed36dc 100644 --- a/Modules/Core/Common/include/itkColorTable.hxx +++ b/Modules/Core/Common/include/itkColorTable.hxx @@ -57,7 +57,7 @@ ColorTable::UseDiscreteColors() else { scale = NumericTraits::OneValue(); - shift = NumericTraits::ZeroValue(); + shift = TComponent{}; } m_Color[0].Set((TComponent)(0.9 * scale + shift), (TComponent)(shift), (TComponent)(shift)); @@ -123,7 +123,7 @@ ColorTable::UseGrayColors(unsigned int n) else { range = NumericTraits::OneValue(); - minimum = NumericTraits::ZeroValue(); + minimum = TComponent{}; } typename NumericTraits::RealType delta; if (m_NumberOfColors > 1) @@ -178,7 +178,7 @@ ColorTable::UseHeatColors(unsigned int n) else { scale = NumericTraits::OneValue(); - shift = NumericTraits::ZeroValue(); + shift = TComponent{}; } // Converting from TComponent to RealType may introduce a rounding error, so do static_cast constexpr auto max_value_converted = @@ -238,7 +238,7 @@ ColorTable::UseRandomColors(unsigned int n) } else { - minimum = NumericTraits::ZeroValue(); + minimum = TComponent{}; maximum = NumericTraits::OneValue(); } for (i = 0; i < n; ++i) diff --git a/Modules/Core/Common/include/itkCompensatedSummation.hxx b/Modules/Core/Common/include/itkCompensatedSummation.hxx index 1ed32deee06..c3a644772e1 100644 --- a/Modules/Core/Common/include/itkCompensatedSummation.hxx +++ b/Modules/Core/Common/include/itkCompensatedSummation.hxx @@ -61,7 +61,7 @@ CompensatedSummationAddElement(TFloat & compensation, TFloat & sum, const TFloat template CompensatedSummation::CompensatedSummation(const TFloat value) : m_Sum(value) - , m_Compensation(NumericTraits::ZeroValue()) + , m_Compensation(AccumulateType{}) {} template @@ -138,8 +138,8 @@ template void CompensatedSummation::ResetToZero() { - this->m_Sum = NumericTraits::ZeroValue(); - this->m_Compensation = NumericTraits::ZeroValue(); + this->m_Sum = AccumulateType{}; + this->m_Compensation = AccumulateType{}; } template @@ -147,7 +147,7 @@ CompensatedSummation & CompensatedSummation::operator=(const FloatType & rhs) { this->m_Sum = rhs; - this->m_Compensation = NumericTraits::ZeroValue(); + this->m_Compensation = AccumulateType{}; return *this; } diff --git a/Modules/Core/Common/include/itkConceptChecking.h b/Modules/Core/Common/include/itkConceptChecking.h index ce97be08104..be4bb858362 100644 --- a/Modules/Core/Common/include/itkConceptChecking.h +++ b/Modules/Core/Common/include/itkConceptChecking.h @@ -771,7 +771,7 @@ struct HasZero { T a; - a = NumericTraits::ZeroValue(); + a = T{}; Detail::IgnoreUnusedVariable(a); } }; diff --git a/Modules/Core/Common/include/itkCovariantVector.hxx b/Modules/Core/Common/include/itkCovariantVector.hxx index 672f44acb0f..2319fdfbf6e 100644 --- a/Modules/Core/Common/include/itkCovariantVector.hxx +++ b/Modules/Core/Common/include/itkCovariantVector.hxx @@ -101,7 +101,7 @@ template typename CovariantVector::ValueType CovariantVector::operator*( const Self & other) const { - typename NumericTraits::AccumulateType value = NumericTraits::ZeroValue(); + typename NumericTraits::AccumulateType value = T{}; for (unsigned int i = 0; i < VVectorDimension; ++i) { value += (*this)[i] * other[i]; @@ -113,7 +113,7 @@ template typename CovariantVector::ValueType CovariantVector::operator*( const Vector & other) const { - typename NumericTraits::AccumulateType value = NumericTraits::ZeroValue(); + typename NumericTraits::AccumulateType value = T{}; for (unsigned int i = 0; i < VVectorDimension; ++i) { value += (*this)[i] * other[i]; diff --git a/Modules/Core/Common/include/itkDiffusionTensor3D.hxx b/Modules/Core/Common/include/itkDiffusionTensor3D.hxx index 53aeb3d51d0..37dcd4d0e86 100644 --- a/Modules/Core/Common/include/itkDiffusionTensor3D.hxx +++ b/Modules/Core/Common/include/itkDiffusionTensor3D.hxx @@ -115,14 +115,14 @@ DiffusionTensor3D::GetRelativeAnisotropy() const -> RealValueType // zero. if (trace < NumericTraits::min()) { - return NumericTraits::ZeroValue(); + return RealValueType{}; } const RealValueType anisotropy = 3.0 * isp - trace * trace; - if (anisotropy < NumericTraits::ZeroValue()) + if (anisotropy < RealValueType{}) { - return NumericTraits::ZeroValue(); + return RealValueType{}; } const auto relativeAnisotropySquared = static_cast(anisotropy / (std::sqrt(3.0) * trace)); diff --git a/Modules/Core/Common/include/itkFloodFilledFunctionConditionalConstIterator.h b/Modules/Core/Common/include/itkFloodFilledFunctionConditionalConstIterator.h index 13808ace45b..32f66e08d9b 100644 --- a/Modules/Core/Common/include/itkFloodFilledFunctionConditionalConstIterator.h +++ b/Modules/Core/Common/include/itkFloodFilledFunctionConditionalConstIterator.h @@ -202,7 +202,7 @@ class ITK_TEMPLATE_EXPORT FloodFilledFunctionConditionalConstIterator : public C this->m_IsAtEnd = true; // Initialize the temporary image - m_TemporaryPointer->FillBuffer(NumericTraits::ZeroValue()); + m_TemporaryPointer->FillBuffer(typename TTempImage::PixelType{}); for (unsigned int i = 0; i < m_Seeds.size(); ++i) { diff --git a/Modules/Core/Common/include/itkForwardDifferenceOperator.hxx b/Modules/Core/Common/include/itkForwardDifferenceOperator.hxx index 83dbf8d7108..3f54623e16d 100644 --- a/Modules/Core/Common/include/itkForwardDifferenceOperator.hxx +++ b/Modules/Core/Common/include/itkForwardDifferenceOperator.hxx @@ -28,7 +28,7 @@ ForwardDifferenceOperator::GenerateCoefficients( { CoefficientVector coeff(3); - coeff[0] = NumericTraits::ZeroValue(); + coeff[0] = PixelType{}; coeff[1] = -1.0 * NumericTraits::OneValue(); coeff[2] = NumericTraits::OneValue(); diff --git a/Modules/Core/Common/include/itkHeavisideStepFunction.hxx b/Modules/Core/Common/include/itkHeavisideStepFunction.hxx index d2df9c23564..afc643badb3 100644 --- a/Modules/Core/Common/include/itkHeavisideStepFunction.hxx +++ b/Modules/Core/Common/include/itkHeavisideStepFunction.hxx @@ -27,16 +27,14 @@ template auto HeavisideStepFunction::Evaluate(const InputType & input) const -> OutputType { - return (input >= NumericTraits::ZeroValue()) ? NumericTraits::OneValue() - : NumericTraits::ZeroValue(); + return (input >= InputType{}) ? NumericTraits::OneValue() : OutputType{}; } template auto HeavisideStepFunction::EvaluateDerivative(const InputType & input) const -> OutputType { - return (Math::ExactlyEquals(input, NumericTraits::ZeroValue())) ? NumericTraits::OneValue() - : NumericTraits::ZeroValue(); + return (Math::ExactlyEquals(input, InputType{})) ? NumericTraits::OneValue() : OutputType{}; } } // namespace itk diff --git a/Modules/Core/Common/include/itkMath.h b/Modules/Core/Common/include/itkMath.h index 8f366ccd780..e1b47c5a644 100644 --- a/Modules/Core/Common/include/itkMath.h +++ b/Modules/Core/Common/include/itkMath.h @@ -577,9 +577,7 @@ struct AlmostEqualsScalarVsComplex static bool AlmostEqualsFunction(TScalarType scalarVariable, TComplexType complexVariable) { - if (!AlmostEqualsScalarComparer( - complexVariable.imag(), - itk::NumericTraits::ValueType>::ZeroValue())) + if (!AlmostEqualsScalarComparer(complexVariable.imag(), typename itk::NumericTraits::ValueType{})) { return false; } diff --git a/Modules/Core/Common/include/itkMatrix.h b/Modules/Core/Common/include/itkMatrix.h index c1ed4bb00af..99bc070b2d0 100644 --- a/Modules/Core/Common/include/itkMatrix.h +++ b/Modules/Core/Common/include/itkMatrix.h @@ -276,7 +276,7 @@ class ITK_TEMPLATE_EXPORT Matrix inline vnl_matrix_fixed GetInverse() const { - if (vnl_determinant(m_Matrix) == NumericTraits::ZeroValue()) + if (vnl_determinant(m_Matrix) == T{}) { itkGenericExceptionMacro("Singular matrix. Determinant is 0."); } diff --git a/Modules/Core/Common/include/itkNeighborhoodOperator.h b/Modules/Core/Common/include/itkNeighborhoodOperator.h index e4b59ec9ef8..a95d39f3f7b 100644 --- a/Modules/Core/Common/include/itkNeighborhoodOperator.h +++ b/Modules/Core/Common/include/itkNeighborhoodOperator.h @@ -170,7 +170,7 @@ class ITK_TEMPLATE_EXPORT NeighborhoodOperator : public NeighborhoodSize(); ++i) { - this->operator[](i) = NumericTraits::ZeroValue(); + this->operator[](i) = PixelType{}; } } diff --git a/Modules/Core/Common/include/itkNumericTraits.h b/Modules/Core/Common/include/itkNumericTraits.h index 91a3b5743f8..ae4bd04fbb2 100644 --- a/Modules/Core/Common/include/itkNumericTraits.h +++ b/Modules/Core/Common/include/itkNumericTraits.h @@ -189,7 +189,7 @@ class NumericTraits : public std::numeric_limits { itkGenericExceptionMacro("Cannot set the size of a scalar to " << s); } - m = NumericTraits::ZeroValue(); + m = ValueType{}; } /** Return the length of the scalar. This API is needed for * VariableLengthVector because @@ -368,7 +368,7 @@ class NumericTraits : public std::numeric_limits { itkGenericExceptionMacro("Cannot set the size of a scalar to " << s); } - m = NumericTraits::ZeroValue(); + m = ValueType{}; } }; @@ -474,7 +474,7 @@ class NumericTraits : public std::numeric_limits { itkGenericExceptionMacro("Cannot set the size of a scalar to " << s); } - m = NumericTraits::ZeroValue(); + m = ValueType{}; } }; @@ -596,7 +596,7 @@ class NumericTraits : public std::numeric_limits { itkGenericExceptionMacro("Cannot set the size of a scalar to " << s); } - m = NumericTraits::ZeroValue(); + m = ValueType{}; } }; @@ -700,7 +700,7 @@ class NumericTraits : public std::numeric_limits { itkGenericExceptionMacro("Cannot set the size of a scalar to " << s); } - m = NumericTraits::ZeroValue(); + m = ValueType{}; } }; @@ -802,7 +802,7 @@ class NumericTraits : public std::numeric_limits { itkGenericExceptionMacro("Cannot set the size of a scalar to " << s); } - m = NumericTraits::ZeroValue(); + m = ValueType{}; } }; @@ -905,7 +905,7 @@ class NumericTraits : public std::numeric_limits { itkGenericExceptionMacro("Cannot set the size of a scalar to " << s); } - m = NumericTraits::ZeroValue(); + m = ValueType{}; } }; @@ -1007,7 +1007,7 @@ class NumericTraits : public std::numeric_limits { itkGenericExceptionMacro("Cannot set the size of a scalar to " << s); } - m = NumericTraits::ZeroValue(); + m = ValueType{}; } }; @@ -1129,7 +1129,7 @@ class NumericTraits : public std::numeric_limits { itkGenericExceptionMacro("Cannot set the size of a scalar to " << s); } - m = NumericTraits::ZeroValue(); + m = ValueType{}; } }; @@ -1232,7 +1232,7 @@ class NumericTraits : public std::numeric_limits { itkGenericExceptionMacro("Cannot set the size of a scalar to " << s); } - m = NumericTraits::ZeroValue(); + m = ValueType{}; } }; @@ -1335,7 +1335,7 @@ class NumericTraits : public std::numeric_limits { itkGenericExceptionMacro("Cannot set the size of a scalar to " << s); } - m = NumericTraits::ZeroValue(); + m = ValueType{}; } }; @@ -1439,7 +1439,7 @@ class NumericTraits : public std::numeric_limits { itkGenericExceptionMacro("Cannot set the size of a scalar to " << s); } - m = NumericTraits::ZeroValue(); + m = ValueType{}; } }; @@ -1542,7 +1542,7 @@ class NumericTraits : public std::numeric_limits { itkGenericExceptionMacro("Cannot set the size of a scalar to " << s); } - m = NumericTraits::ZeroValue(); + m = ValueType{}; } }; @@ -1653,7 +1653,7 @@ class NumericTraits : public std::numeric_limits { itkGenericExceptionMacro("Cannot set the size of a scalar to " << s); } - m = NumericTraits::ZeroValue(); + m = ValueType{}; } }; @@ -1757,7 +1757,7 @@ class NumericTraits : public std::numeric_limits { itkGenericExceptionMacro("Cannot set the size of a scalar to " << s); } - m = NumericTraits::ZeroValue(); + m = ValueType{}; } }; @@ -1852,7 +1852,7 @@ class NumericTraits : public std::numeric_limits::ZeroValue(); + m = ValueType{}; } }; @@ -1978,7 +1978,7 @@ class NumericTraits> { itkGenericExceptionMacro("Cannot set the size of a complex to " << s); } - m = NumericTraits::ZeroValue(); + m = ValueType{}; } #if defined(ITK_LEGACY_REMOVE) diff --git a/Modules/Core/Common/include/itkNumericTraitsArrayPixel.h b/Modules/Core/Common/include/itkNumericTraitsArrayPixel.h index ecbbfe2d04c..cb147be8cdf 100644 --- a/Modules/Core/Common/include/itkNumericTraitsArrayPixel.h +++ b/Modules/Core/Common/include/itkNumericTraitsArrayPixel.h @@ -91,7 +91,7 @@ class NumericTraits> { Self b(a.Size()); - b.Fill(NumericTraits::ZeroValue()); + b.Fill(T{}); return b; } @@ -121,7 +121,7 @@ class NumericTraits> SetLength(Array & m, const unsigned int s) { m.SetSize(s); - m.Fill(NumericTraits::ZeroValue()); + m.Fill(T{}); } /** Get the length of the input array. */ diff --git a/Modules/Core/Common/include/itkNumericTraitsCovariantVectorPixel.h b/Modules/Core/Common/include/itkNumericTraitsCovariantVectorPixel.h index 07d0319ed4a..95bff64b64f 100644 --- a/Modules/Core/Common/include/itkNumericTraitsCovariantVectorPixel.h +++ b/Modules/Core/Common/include/itkNumericTraitsCovariantVectorPixel.h @@ -157,7 +157,7 @@ class NumericTraits> { itkGenericExceptionMacro("Cannot set the size of a CovariantVector of length " << D << " to " << s); } - m.Fill(NumericTraits::ZeroValue()); + m.Fill(T{}); } /** Return the length of the vector. */ diff --git a/Modules/Core/Common/include/itkNumericTraitsDiffusionTensor3DPixel.h b/Modules/Core/Common/include/itkNumericTraitsDiffusionTensor3DPixel.h index 5bd8fb4a8da..ebf2b5101bf 100644 --- a/Modules/Core/Common/include/itkNumericTraitsDiffusionTensor3DPixel.h +++ b/Modules/Core/Common/include/itkNumericTraitsDiffusionTensor3DPixel.h @@ -160,7 +160,7 @@ class NumericTraits> itkGenericExceptionMacro("Cannot set the size of a DiffusionTensor3D " "to anything other than 6."); } - m.Fill(NumericTraits::ZeroValue()); + m.Fill(T{}); } /** Return the size of the tensor. Always returns 6. */ diff --git a/Modules/Core/Common/include/itkNumericTraitsFixedArrayPixel.h b/Modules/Core/Common/include/itkNumericTraitsFixedArrayPixel.h index 2c3f6c77318..e3ffb5483c7 100644 --- a/Modules/Core/Common/include/itkNumericTraitsFixedArrayPixel.h +++ b/Modules/Core/Common/include/itkNumericTraitsFixedArrayPixel.h @@ -153,7 +153,7 @@ class NumericTraits> { itkGenericExceptionMacro("Cannot set the size of a FixedArray of length " << D << " to " << s); } - m.Fill(NumericTraits::ZeroValue()); + m.Fill(T{}); } /** Return the length of the array. */ diff --git a/Modules/Core/Common/include/itkNumericTraitsPointPixel.h b/Modules/Core/Common/include/itkNumericTraitsPointPixel.h index 8e6e2cbc814..53b2217f87f 100644 --- a/Modules/Core/Common/include/itkNumericTraitsPointPixel.h +++ b/Modules/Core/Common/include/itkNumericTraitsPointPixel.h @@ -144,7 +144,7 @@ class NumericTraits> { itkGenericExceptionMacro("Cannot set the size of a Point of length " << D << " to " << s); } - m.Fill(NumericTraits::ZeroValue()); + m.Fill(T{}); } /** Return the dimensionality of the point. */ diff --git a/Modules/Core/Common/include/itkNumericTraitsRGBAPixel.h b/Modules/Core/Common/include/itkNumericTraitsRGBAPixel.h index 088f67d9371..4d6f324bbe4 100644 --- a/Modules/Core/Common/include/itkNumericTraitsRGBAPixel.h +++ b/Modules/Core/Common/include/itkNumericTraitsRGBAPixel.h @@ -185,7 +185,7 @@ class NumericTraits> itkGenericExceptionMacro("Cannot set the size of a RGBAPixel to anything other " "than 4."); } - m.Fill(NumericTraits::ZeroValue()); + m.Fill(T{}); } /** Return the dimensionality of the pixel. Always returns 4. */ diff --git a/Modules/Core/Common/include/itkNumericTraitsRGBPixel.h b/Modules/Core/Common/include/itkNumericTraitsRGBPixel.h index 90bc35317b0..4e879af642f 100644 --- a/Modules/Core/Common/include/itkNumericTraitsRGBPixel.h +++ b/Modules/Core/Common/include/itkNumericTraitsRGBPixel.h @@ -185,7 +185,7 @@ class NumericTraits> itkGenericExceptionMacro("Cannot set the size of a RGBPixel to anything other " "than 3."); } - m.Fill(NumericTraits::ZeroValue()); + m.Fill(T{}); } /** Return the dimensionality of the pixel. Always returns 3. */ diff --git a/Modules/Core/Common/include/itkNumericTraitsStdVector.h b/Modules/Core/Common/include/itkNumericTraitsStdVector.h index 29bd5b50cac..db00b3b6601 100644 --- a/Modules/Core/Common/include/itkNumericTraitsStdVector.h +++ b/Modules/Core/Common/include/itkNumericTraitsStdVector.h @@ -113,7 +113,7 @@ class NumericTraits> static const Self ZeroValue(const Self & a) { - Self b(a.Size(), NumericTraits::ZeroValue()); + Self b(a.Size(), T{}); return b; } diff --git a/Modules/Core/Common/include/itkNumericTraitsTensorPixel.h b/Modules/Core/Common/include/itkNumericTraitsTensorPixel.h index 88995c37681..9d75a581c69 100644 --- a/Modules/Core/Common/include/itkNumericTraitsTensorPixel.h +++ b/Modules/Core/Common/include/itkNumericTraitsTensorPixel.h @@ -160,7 +160,7 @@ class NumericTraits> "of dimension " << D << " ( = size of " << D * (D + 1) / 2 << ") to " << s); } - m.Fill(NumericTraits::ZeroValue()); + m.Fill(T{}); } /** Return the size of the underlying FixedArray. */ diff --git a/Modules/Core/Common/include/itkNumericTraitsVariableLengthVectorPixel.h b/Modules/Core/Common/include/itkNumericTraitsVariableLengthVectorPixel.h index e37ac22f261..e4b09ebe453 100644 --- a/Modules/Core/Common/include/itkNumericTraitsVariableLengthVectorPixel.h +++ b/Modules/Core/Common/include/itkNumericTraitsVariableLengthVectorPixel.h @@ -115,7 +115,7 @@ class NumericTraits> { Self b(a.Size()); - b.Fill(NumericTraits::ZeroValue()); + b.Fill(T{}); return b; } @@ -142,7 +142,7 @@ class NumericTraits> bool flag = false; for (unsigned int i = 0; i < GetLength(a); ++i) { - if (a[i] > NumericTraits::ZeroValue()) + if (a[i] > ValueType{}) { flag = true; } @@ -170,7 +170,7 @@ class NumericTraits> bool flag = false; for (unsigned int i = 0; i < GetLength(a); ++i) { - if (a[i] < NumericTraits::ZeroValue()) + if (a[i] < ValueType{}) { flag = true; } @@ -202,7 +202,7 @@ class NumericTraits> SetLength(VariableLengthVector & m, const unsigned int s) { m.SetSize(s); - m.Fill(NumericTraits::ZeroValue()); + m.Fill(T{}); } /** Return the size of the vector. */ diff --git a/Modules/Core/Common/include/itkNumericTraitsVectorPixel.h b/Modules/Core/Common/include/itkNumericTraitsVectorPixel.h index 943d98a0b62..b705717e0d3 100644 --- a/Modules/Core/Common/include/itkNumericTraitsVectorPixel.h +++ b/Modules/Core/Common/include/itkNumericTraitsVectorPixel.h @@ -135,7 +135,7 @@ class NumericTraits> bool flag = false; for (unsigned int i = 0; i < GetLength(a); ++i) { - if (a[i] > NumericTraits::ZeroValue()) + if (a[i] > ValueType{}) { flag = true; } @@ -199,7 +199,7 @@ class NumericTraits> { itkGenericExceptionMacro("Cannot set the size of a Vector of length " << D << " to " << s); } - m.Fill(NumericTraits::ZeroValue()); + m.Fill(T{}); } /** Return the size of the vector. */ diff --git a/Modules/Core/Common/include/itkPoint.hxx b/Modules/Core/Common/include/itkPoint.hxx index c9c9a784e58..e51d8479407 100644 --- a/Modules/Core/Common/include/itkPoint.hxx +++ b/Modules/Core/Common/include/itkPoint.hxx @@ -197,7 +197,7 @@ template void Point::SetToBarycentricCombination(const Self * P, const double * weights, unsigned int N) { - this->Fill(NumericTraits::ZeroValue()); // put this point to null + this->Fill(T{}); // put this point to null double weightSum = 0.0; for (unsigned int j = 0; j < N - 1; ++j) { @@ -225,7 +225,7 @@ BarycentricCombination::Evaluate(const PointC { using ValueType = typename PointType::ValueType; PointType barycentre; - barycentre.Fill(NumericTraits::ZeroValue()); // set to null + barycentre.Fill(ValueType{}); // set to null typename TPointContainer::Iterator point = points->Begin(); typename TPointContainer::Iterator final = points->End(); diff --git a/Modules/Core/Common/include/itkPointSetToImageFilter.hxx b/Modules/Core/Common/include/itkPointSetToImageFilter.hxx index cbe69e457cb..387424ce4a6 100644 --- a/Modules/Core/Common/include/itkPointSetToImageFilter.hxx +++ b/Modules/Core/Common/include/itkPointSetToImageFilter.hxx @@ -36,7 +36,7 @@ PointSetToImageFilter::PointSetToImageFilter() this->m_Spacing.Fill(1.0); this->m_Direction.SetIdentity(); this->m_InsideValue = NumericTraits::OneValue(); - this->m_OutsideValue = NumericTraits::ZeroValue(); + this->m_OutsideValue = ValueType{}; } template @@ -143,7 +143,7 @@ PointSetToImageFilter::GenerateData() bool specified = false; for (i = 0; i < OutputImageDimension; ++i) { - if (m_Size[i] != NumericTraits::ZeroValue()) + if (m_Size[i] != SizeValueType{}) { specified = true; break; @@ -169,8 +169,7 @@ PointSetToImageFilter::GenerateData() specified = false; for (i = 0; i < OutputImageDimension; ++i) { - if (Math::NotExactlyEquals(m_Spacing[i], - NumericTraits::ValueType>::ZeroValue())) + if (Math::NotExactlyEquals(m_Spacing[i], typename NumericTraits::ValueType{})) { specified = true; break; @@ -185,7 +184,7 @@ PointSetToImageFilter::GenerateData() specified = false; for (i = 0; i < OutputImageDimension; ++i) { - if (Math::NotExactlyEquals(m_Origin[i], NumericTraits::ValueType>::ZeroValue())) + if (Math::NotExactlyEquals(m_Origin[i], typename NumericTraits::ValueType{})) { specified = true; break; diff --git a/Modules/Core/Common/include/itkQuadrilateralCell.hxx b/Modules/Core/Common/include/itkQuadrilateralCell.hxx index 4b2622e8bbf..36551042363 100644 --- a/Modules/Core/Common/include/itkQuadrilateralCell.hxx +++ b/Modules/Core/Common/include/itkQuadrilateralCell.hxx @@ -498,7 +498,7 @@ QuadrilateralCell::EvaluateLocation(int & it for (unsigned int ii = 0; ii < PointDimension; ++ii) { - x[ii] = NumericTraits::ZeroValue(); + x[ii] = CoordRepType{}; } for (unsigned int ii = 0; ii < NumberOfPoints; ++ii) diff --git a/Modules/Core/Common/include/itkResourceProbe.hxx b/Modules/Core/Common/include/itkResourceProbe.hxx index c70a5bb24d0..9af6cff8aff 100644 --- a/Modules/Core/Common/include/itkResourceProbe.hxx +++ b/Modules/Core/Common/include/itkResourceProbe.hxx @@ -91,15 +91,15 @@ template void ResourceProbe::Reset() { - this->m_TotalValue = NumericTraits::ZeroValue(); - this->m_StartValue = NumericTraits::ZeroValue(); + this->m_TotalValue = ValueType{}; + this->m_StartValue = ValueType{}; this->m_MinimumValue = NumericTraits::max(); this->m_MaximumValue = NumericTraits::NonpositiveMin(); - this->m_StandardDeviation = NumericTraits::ZeroValue(); + this->m_StandardDeviation = ValueType{}; - this->m_NumberOfStarts = NumericTraits::ZeroValue(); - this->m_NumberOfStops = NumericTraits::ZeroValue(); - this->m_NumberOfIteration = NumericTraits::ZeroValue(); + this->m_NumberOfStarts = CountType{}; + this->m_NumberOfStops = CountType{}; + this->m_NumberOfIteration = CountType{}; this->m_ProbeValueList.clear(); } @@ -223,13 +223,12 @@ ResourceProbe::GetStandardDeviation() diff.begin(), // Subtract mean from every value; [realMean](const ValueType v) { return (static_cast(v) - realMean); }); - const InternalComputeType sqsum = - std::inner_product(diff.begin(), diff.end(), diff.begin(), NumericTraits::ZeroValue()); + const InternalComputeType sqsum = std::inner_product(diff.begin(), diff.end(), diff.begin(), InternalComputeType{}); const InternalComputeType sz = static_cast(this->m_ProbeValueList.size()) - 1.0; if (sz <= 0.0) { - this->m_StandardDeviation = NumericTraits::ZeroValue(); + this->m_StandardDeviation = ValueType{}; } else { @@ -351,7 +350,7 @@ ResourceProbe::ExpandedReport(std::ostream & os, ValueType ratioOfMeanToMinimum; if (Math::ExactlyEquals(this->GetMinimum(), 0.0)) { - ratioOfMeanToMinimum = NumericTraits::ZeroValue(); + ratioOfMeanToMinimum = ValueType{}; } else { @@ -361,7 +360,7 @@ ResourceProbe::ExpandedReport(std::ostream & os, ValueType ratioOfMaximumToMean; if (Math::ExactlyEquals(this->GetMean(), 0.0)) { - ratioOfMaximumToMean = NumericTraits::ZeroValue(); + ratioOfMaximumToMean = ValueType{}; } else { @@ -433,7 +432,7 @@ ResourceProbe::JSONReport(std::ostream & os) ValueType ratioOfMeanToMinimum; if (Math::ExactlyEquals(this->GetMinimum(), 0.0)) { - ratioOfMeanToMinimum = NumericTraits::ZeroValue(); + ratioOfMeanToMinimum = ValueType{}; } else { @@ -443,7 +442,7 @@ ResourceProbe::JSONReport(std::ostream & os) ValueType ratioOfMaximumToMean; if (Math::ExactlyEquals(this->GetMean(), 0.0)) { - ratioOfMaximumToMean = NumericTraits::ZeroValue(); + ratioOfMaximumToMean = ValueType{}; } else { diff --git a/Modules/Core/Common/include/itkShapedFloodFilledFunctionConditionalConstIterator.h b/Modules/Core/Common/include/itkShapedFloodFilledFunctionConditionalConstIterator.h index ae0c02197b7..5d42b304544 100644 --- a/Modules/Core/Common/include/itkShapedFloodFilledFunctionConditionalConstIterator.h +++ b/Modules/Core/Common/include/itkShapedFloodFilledFunctionConditionalConstIterator.h @@ -194,7 +194,7 @@ class ITK_TEMPLATE_EXPORT ShapedFloodFilledFunctionConditionalConstIterator : pu this->m_IsAtEnd = true; // Initialize the temporary image - m_TempPtr->FillBuffer(NumericTraits::ZeroValue()); + m_TempPtr->FillBuffer(typename TTempImage::PixelType{}); for (unsigned int i = 0; i < m_Seeds.size(); ++i) { diff --git a/Modules/Core/Common/include/itkSinRegularizedHeavisideStepFunction.hxx b/Modules/Core/Common/include/itkSinRegularizedHeavisideStepFunction.hxx index 8465d3a0a19..060b113690b 100644 --- a/Modules/Core/Common/include/itkSinRegularizedHeavisideStepFunction.hxx +++ b/Modules/Core/Common/include/itkSinRegularizedHeavisideStepFunction.hxx @@ -34,7 +34,7 @@ SinRegularizedHeavisideStepFunction::Evaluate(const InputType & { if (static_cast(input) <= -this->GetEpsilon()) { - return NumericTraits::ZeroValue(); + return OutputType{}; } else { @@ -52,7 +52,7 @@ SinRegularizedHeavisideStepFunction::EvaluateDerivative(const I { if (itk::Math::abs(static_cast(input)) >= this->GetEpsilon()) { - return NumericTraits::ZeroValue(); + return OutputType{}; } else { diff --git a/Modules/Core/Common/include/itkSymmetricSecondRankTensor.hxx b/Modules/Core/Common/include/itkSymmetricSecondRankTensor.hxx index 11262551363..1f14cc3ec18 100644 --- a/Modules/Core/Common/include/itkSymmetricSecondRankTensor.hxx +++ b/Modules/Core/Common/include/itkSymmetricSecondRankTensor.hxx @@ -224,7 +224,7 @@ template void SymmetricSecondRankTensor::SetIdentity() { - this->Fill(NumericTraits::ZeroValue()); + this->Fill(T{}); for (unsigned int i = 0; i < Dimension; ++i) { (*this)(i, i) = NumericTraits::OneValue(); diff --git a/Modules/Core/Common/include/itkTriangleHelper.hxx b/Modules/Core/Common/include/itkTriangleHelper.hxx index 1822d23bff6..42bdd5de2ea 100644 --- a/Modules/Core/Common/include/itkTriangleHelper.hxx +++ b/Modules/Core/Common/include/itkTriangleHelper.hxx @@ -78,14 +78,14 @@ TriangleHelper::Cotangent(const PointType & iA, const PointType & iB, co CoordRepType v21_l2 = v21.GetSquaredNorm(); - if (Math::NotAlmostEquals(v21_l2, NumericTraits::ZeroValue())) + if (Math::NotAlmostEquals(v21_l2, CoordRepType{})) { v21 /= std::sqrt(v21_l2); } VectorType v23 = iC - iB; CoordRepType v23_l2 = v23.GetSquaredNorm(); - if (Math::NotAlmostEquals(v23_l2, NumericTraits::ZeroValue())) + if (Math::NotAlmostEquals(v23_l2, CoordRepType{})) { v23 /= std::sqrt(v23_l2); } @@ -110,7 +110,7 @@ TriangleHelper::ComputeBarycenter(const CoordRepType & iA1, CoordRepType total = iA1 + iA2 + iA3; - if (Math::AlmostEquals(total, NumericTraits::ZeroValue())) + if (Math::AlmostEquals(total, CoordRepType{})) { // in such case there is no barycenter; oPt.Fill(0.); @@ -243,7 +243,7 @@ TriangleHelper::ComputeMixedArea(const PointType & iP1, const PointType { auto area = static_cast(TriangleType::ComputeArea(iP1, iP2, iP3)); - if ((iP2 - iP1) * (iP3 - iP1) < NumericTraits::ZeroValue()) + if ((iP2 - iP1) * (iP3 - iP1) < CoordRepType{}) { return 0.5 * area; } diff --git a/Modules/Core/Common/include/itkVector.hxx b/Modules/Core/Common/include/itkVector.hxx index b9909201638..d421f214df7 100644 --- a/Modules/Core/Common/include/itkVector.hxx +++ b/Modules/Core/Common/include/itkVector.hxx @@ -103,7 +103,7 @@ template auto Vector::GetSquaredNorm() const -> RealValueType { - typename NumericTraits::AccumulateType sum = NumericTraits::ZeroValue(); + typename NumericTraits::AccumulateType sum = T{}; for (unsigned int i = 0; i < TVectorDimension; ++i) { const RealValueType value = (*this)[i]; @@ -200,7 +200,7 @@ operator>>(std::istream & is, Vector & vct) template typename Vector::ValueType Vector::operator*(const Self & other) const { - typename NumericTraits::AccumulateType value = NumericTraits::ZeroValue(); + typename NumericTraits::AccumulateType value = T{}; for (unsigned int i = 0; i < TVectorDimension; ++i) { value += (*this)[i] * other[i]; diff --git a/Modules/Core/Common/include/itkVersor.hxx b/Modules/Core/Common/include/itkVersor.hxx index 04c8fce1c37..ba4071aa3d5 100644 --- a/Modules/Core/Common/include/itkVersor.hxx +++ b/Modules/Core/Common/include/itkVersor.hxx @@ -48,9 +48,9 @@ template void Versor::SetIdentity() { - m_X = NumericTraits::ZeroValue(); - m_Y = NumericTraits::ZeroValue(); - m_Z = NumericTraits::ZeroValue(); + m_X = T{}; + m_Y = T{}; + m_Z = T{}; m_W = NumericTraits::OneValue(); } @@ -209,11 +209,11 @@ Versor::GetAxis() const -> VectorType const RealType vectorNorm = std::sqrt(ax * ax + ay * ay + az * az); - if (vectorNorm == NumericTraits::ZeroValue()) + if (vectorNorm == RealType{}) { - axis[0] = NumericTraits::ZeroValue(); - axis[1] = NumericTraits::ZeroValue(); - axis[2] = NumericTraits::ZeroValue(); + axis[0] = T{}; + axis[1] = T{}; + axis[2] = T{}; } else { @@ -468,8 +468,8 @@ Versor::SetRotationAroundX(ValueType angle) const ValueType cosangle2 = std::cos(angle / 2.0); m_X = sinangle2; - m_Y = NumericTraits::ZeroValue(); - m_Z = NumericTraits::ZeroValue(); + m_Y = T{}; + m_Z = T{}; m_W = cosangle2; } @@ -480,9 +480,9 @@ Versor::SetRotationAroundY(ValueType angle) const ValueType sinangle2 = std::sin(angle / 2.0); const ValueType cosangle2 = std::cos(angle / 2.0); - m_X = NumericTraits::ZeroValue(); + m_X = T{}; m_Y = sinangle2; - m_Z = NumericTraits::ZeroValue(); + m_Z = T{}; m_W = cosangle2; } @@ -493,8 +493,8 @@ Versor::SetRotationAroundZ(ValueType angle) const ValueType sinangle2 = std::sin(angle / 2.0); const ValueType cosangle2 = std::cos(angle / 2.0); - m_X = NumericTraits::ZeroValue(); - m_Y = NumericTraits::ZeroValue(); + m_X = T{}; + m_Y = T{}; m_Z = sinangle2; m_W = cosangle2; } diff --git a/Modules/Core/Common/src/itkRealTimeInterval.cxx b/Modules/Core/Common/src/itkRealTimeInterval.cxx index 2595387c03f..7cbdf70503c 100644 --- a/Modules/Core/Common/src/itkRealTimeInterval.cxx +++ b/Modules/Core/Common/src/itkRealTimeInterval.cxx @@ -42,8 +42,8 @@ namespace itk */ RealTimeInterval::RealTimeInterval() { - this->m_Seconds = itk::NumericTraits::ZeroValue(); - this->m_MicroSeconds = itk::NumericTraits::ZeroValue(); + this->m_Seconds = SecondsDifferenceType{}; + this->m_MicroSeconds = MicroSecondsDifferenceType{}; } /** diff --git a/Modules/Core/Common/src/itkRealTimeStamp.cxx b/Modules/Core/Common/src/itkRealTimeStamp.cxx index 15063a131b8..3817b63ad62 100644 --- a/Modules/Core/Common/src/itkRealTimeStamp.cxx +++ b/Modules/Core/Common/src/itkRealTimeStamp.cxx @@ -68,8 +68,8 @@ namespace itk */ RealTimeStamp::RealTimeStamp() { - this->m_Seconds = itk::NumericTraits::ZeroValue(); - this->m_MicroSeconds = itk::NumericTraits::ZeroValue(); + this->m_Seconds = SecondsCounterType{}; + this->m_MicroSeconds = MicroSecondsCounterType{}; } /** diff --git a/Modules/Core/Common/test/itkBoundingBoxTest.cxx b/Modules/Core/Common/test/itkBoundingBoxTest.cxx index 1f490392239..184c9c2b9ce 100644 --- a/Modules/Core/Common/test/itkBoundingBoxTest.cxx +++ b/Modules/Core/Common/test/itkBoundingBoxTest.cxx @@ -38,7 +38,7 @@ itkBoundingBoxTest(int, char *[]) const BB::BoundsArrayType & bounds = myBox->GetBounds(); for (unsigned int i = 0; i < bounds.Size(); ++i) { - if (itk::Math::NotExactlyEquals(bounds[i], itk::NumericTraits::ZeroValue())) + if (itk::Math::NotExactlyEquals(bounds[i], BB::CoordRepType{})) { std::cerr << "Bounding Box initialization test failed" << std::endl; std::cerr << bounds << std::endl; @@ -52,7 +52,7 @@ itkBoundingBoxTest(int, char *[]) BB::PointType center = myBox->GetCenter(); for (unsigned int i = 0; i < 1; ++i) { - if (itk::Math::NotExactlyEquals(center[i], itk::NumericTraits::ZeroValue())) + if (itk::Math::NotExactlyEquals(center[i], BB::CoordRepType{})) { std::cerr << "Empty Box GetCenter initialization test failed" << std::endl; return EXIT_FAILURE; diff --git a/Modules/Core/Common/test/itkCompensatedSummationTest.cxx b/Modules/Core/Common/test/itkCompensatedSummationTest.cxx index 3e60ceb848d..47dc02e0ab6 100644 --- a/Modules/Core/Common/test/itkCompensatedSummationTest.cxx +++ b/Modules/Core/Common/test/itkCompensatedSummationTest.cxx @@ -105,7 +105,7 @@ itkCompensatedSummationTest(int, char *[]) } floatAccumulator.ResetToZero(); - if (itk::Math::NotAlmostEquals(floatAccumulator.GetSum(), itk::NumericTraits::ZeroValue())) + if (itk::Math::NotAlmostEquals(floatAccumulator.GetSum(), FloatType{})) { std::cerr << "GetSize() did return the correct value!" << std::endl; return EXIT_FAILURE; diff --git a/Modules/Core/Common/test/itkImageIteratorsForwardBackwardTest.cxx b/Modules/Core/Common/test/itkImageIteratorsForwardBackwardTest.cxx index 2f58935114b..f39b866efbf 100644 --- a/Modules/Core/Common/test/itkImageIteratorsForwardBackwardTest.cxx +++ b/Modules/Core/Common/test/itkImageIteratorsForwardBackwardTest.cxx @@ -53,7 +53,7 @@ itkImageIteratorsForwardBackwardTest(int, char *[]) ImageType::PixelType value; - value = itk::NumericTraits::ZeroValue(); + value = ImageType::PixelType{}; // Store information on the Image std::cout << "Storing data on the image ... " << std::endl; @@ -70,7 +70,7 @@ itkImageIteratorsForwardBackwardTest(int, char *[]) IteratorType ot(myImage, region); std::cout << "Verifying the data forwards... "; - value = itk::NumericTraits::ZeroValue(); + value = ImageType::PixelType{}; while (!ot.IsAtEnd()) { @@ -120,7 +120,7 @@ itkImageIteratorsForwardBackwardTest(int, char *[]) ConstIteratorType cot(myImage, region); std::cout << "Const Iterator: Verifying the data forwards... "; - value = itk::NumericTraits::ZeroValue(); + value = ImageType::PixelType{}; while (!cot.IsAtEnd()) { diff --git a/Modules/Core/Common/test/itkMathCastWithRangeCheckTest.cxx b/Modules/Core/Common/test/itkMathCastWithRangeCheckTest.cxx index 71d7718f72b..7b400545701 100644 --- a/Modules/Core/Common/test/itkMathCastWithRangeCheckTest.cxx +++ b/Modules/Core/Common/test/itkMathCastWithRangeCheckTest.cxx @@ -84,7 +84,7 @@ DoCastWithRangeCheckTest(const T1 * = nullptr, const T2 * = nullptr) bool pass = true; pass &= DoCastWithRangeCheckTestVerify(itk::NumericTraits::NonpositiveMin()); pass &= DoCastWithRangeCheckTestVerify(itk::NumericTraits::max()); - pass &= DoCastWithRangeCheckTestVerify(itk::NumericTraits::ZeroValue()); + pass &= DoCastWithRangeCheckTestVerify(T2{}); pass &= DoCastWithRangeCheckTestVerify(itk::NumericTraits::OneValue()); pass &= DoCastWithRangeCheckTestVerify(static_cast(itk::NumericTraits::OneValue() * minus_one)); diff --git a/Modules/Core/Common/test/itkTimeProbeTest.cxx b/Modules/Core/Common/test/itkTimeProbeTest.cxx index f3ac2bba3a7..05ed9acbf5c 100644 --- a/Modules/Core/Common/test/itkTimeProbeTest.cxx +++ b/Modules/Core/Common/test/itkTimeProbeTest.cxx @@ -65,18 +65,17 @@ itkTimeProbeTest(int, char *[]) std::cerr << "Reset() failure" << std::endl; return EXIT_FAILURE; } - if (localTimer.GetNumberOfStops() != itk::NumericTraits::ZeroValue()) + if (localTimer.GetNumberOfStops() != itk::TimeProbe::CountType{}) { std::cerr << "Reset() failure" << std::endl; return EXIT_FAILURE; } - if (itk::Math::NotExactlyEquals(localTimer.GetTotal(), - itk::NumericTraits::ZeroValue())) + if (itk::Math::NotExactlyEquals(localTimer.GetTotal(), itk::TimeProbe::TimeStampType{})) { std::cerr << "Reset() failure" << std::endl; return EXIT_FAILURE; } - if (itk::Math::NotExactlyEquals(localTimer.GetMean(), itk::NumericTraits::ZeroValue())) + if (itk::Math::NotExactlyEquals(localTimer.GetMean(), itk::TimeProbe::TimeStampType{})) { std::cerr << "Reset() failure" << std::endl; return EXIT_FAILURE; diff --git a/Modules/Core/Common/test/itkTimeProbeTest2.cxx b/Modules/Core/Common/test/itkTimeProbeTest2.cxx index 819d87b4487..b99448d0b47 100644 --- a/Modules/Core/Common/test/itkTimeProbeTest2.cxx +++ b/Modules/Core/Common/test/itkTimeProbeTest2.cxx @@ -109,18 +109,17 @@ itkTimeProbeTest2(int, char *[]) std::cerr << "Reset() failure" << std::endl; return EXIT_FAILURE; } - if (localTimer.GetNumberOfStops() != itk::NumericTraits::ZeroValue()) + if (localTimer.GetNumberOfStops() != itk::TimeProbe::CountType{}) { std::cerr << "Reset() failure" << std::endl; return EXIT_FAILURE; } - if (itk::Math::NotExactlyEquals(localTimer.GetTotal(), - itk::NumericTraits::ZeroValue())) + if (itk::Math::NotExactlyEquals(localTimer.GetTotal(), itk::TimeProbe::TimeStampType{})) { std::cerr << "Reset() failure" << std::endl; return EXIT_FAILURE; } - if (itk::Math::NotExactlyEquals(localTimer.GetMean(), itk::NumericTraits::ZeroValue())) + if (itk::Math::NotExactlyEquals(localTimer.GetMean(), itk::TimeProbe::TimeStampType{})) { std::cerr << "Reset() failure" << std::endl; return EXIT_FAILURE; diff --git a/Modules/Core/FiniteDifference/include/itkDenseFiniteDifferenceImageFilter.hxx b/Modules/Core/FiniteDifference/include/itkDenseFiniteDifferenceImageFilter.hxx index 792084e0eba..54f4e0e8a9c 100644 --- a/Modules/Core/FiniteDifference/include/itkDenseFiniteDifferenceImageFilter.hxx +++ b/Modules/Core/FiniteDifference/include/itkDenseFiniteDifferenceImageFilter.hxx @@ -125,7 +125,7 @@ DenseFiniteDifferenceImageFilter::CalculateChange() - DenseFDThreadStruct str; str.Filter = this; - str.TimeStep = NumericTraits::ZeroValue(); // Not used during the + str.TimeStep = TimeStepType{}; // Not used during the // calculate change step. this->GetMultiThreader()->SetNumberOfWorkUnits(this->GetNumberOfWorkUnits()); this->GetMultiThreader()->SetSingleMethod(this->CalculateChangeThreaderCallback, &str); @@ -136,7 +136,7 @@ DenseFiniteDifferenceImageFilter::CalculateChange() - ThreadIdType workUnitCount = this->GetMultiThreader()->GetNumberOfWorkUnits(); str.TimeStepList.clear(); - str.TimeStepList.resize(workUnitCount, NumericTraits::ZeroValue()); + str.TimeStepList.resize(workUnitCount, TimeStepType{}); str.ValidTimeStepList.clear(); str.ValidTimeStepList.resize(workUnitCount, false); diff --git a/Modules/Core/FiniteDifference/include/itkFiniteDifferenceSparseImageFilter.hxx b/Modules/Core/FiniteDifference/include/itkFiniteDifferenceSparseImageFilter.hxx index 8c957183792..5cc71d3f959 100644 --- a/Modules/Core/FiniteDifference/include/itkFiniteDifferenceSparseImageFilter.hxx +++ b/Modules/Core/FiniteDifference/include/itkFiniteDifferenceSparseImageFilter.hxx @@ -153,7 +153,7 @@ FiniteDifferenceSparseImageFilter::Calc // Set up for multithreaded processing. FDThreadStruct str; str.Filter = this; - str.TimeStep = NumericTraits::ZeroValue(); + str.TimeStep = TimeStepType{}; // Not used during the calculate change step for normals. this->GetMultiThreader()->SetNumberOfWorkUnits(this->GetNumberOfWorkUnits()); diff --git a/Modules/Core/ImageAdaptors/include/itkAbsImageAdaptor.h b/Modules/Core/ImageAdaptors/include/itkAbsImageAdaptor.h index 56fbd1c26e2..84c89a70570 100644 --- a/Modules/Core/ImageAdaptors/include/itkAbsImageAdaptor.h +++ b/Modules/Core/ImageAdaptors/include/itkAbsImageAdaptor.h @@ -51,13 +51,13 @@ class AbsPixelAccessor static inline void Set(TInternalType & output, const TExternalType & input) { - output = (TInternalType)((input > NumericTraits::ZeroValue()) ? input : -input); + output = (TInternalType)((input > TExternalType{}) ? input : -input); } static inline TExternalType Get(const TInternalType & input) { - return (TExternalType)((input > NumericTraits::ZeroValue()) ? input : -input); + return (TExternalType)((input > TInternalType{}) ? input : -input); } }; } // end namespace Accessor diff --git a/Modules/Core/ImageAdaptors/include/itkAddPixelAccessor.h b/Modules/Core/ImageAdaptors/include/itkAddPixelAccessor.h index abcd70ee7f4..e579d0031ac 100644 --- a/Modules/Core/ImageAdaptors/include/itkAddPixelAccessor.h +++ b/Modules/Core/ImageAdaptors/include/itkAddPixelAccessor.h @@ -94,7 +94,7 @@ class AddPixelAccessor /** Constructors */ AddPixelAccessor() - : m_Value(NumericTraits::ZeroValue()) + : m_Value(TPixel{}) {} AddPixelAccessor(const Self & apa) : m_Value(apa.m_Value) diff --git a/Modules/Core/ImageAdaptors/test/itkVectorImageTest.cxx b/Modules/Core/ImageAdaptors/test/itkVectorImageTest.cxx index 58a4ae39f80..417b7d11c77 100644 --- a/Modules/Core/ImageAdaptors/test/itkVectorImageTest.cxx +++ b/Modules/Core/ImageAdaptors/test/itkVectorImageTest.cxx @@ -474,7 +474,7 @@ itkVectorImageTest(int, char * argv[]) VectorImageType::IndexType start; itk::VariableLengthVector f(VectorLength); itk::VariableLengthVector ZeroPixel(VectorLength); - ZeroPixel.Fill(itk::NumericTraits::ZeroValue()); + ZeroPixel.Fill(PixelType{}); for (unsigned int i = 0; i < VectorLength; ++i) { f[i] = i; diff --git a/Modules/Core/ImageFunction/include/itkBSplineDecompositionImageFilter.hxx b/Modules/Core/ImageFunction/include/itkBSplineDecompositionImageFilter.hxx index a3ff9fdf95a..ebb265165f6 100644 --- a/Modules/Core/ImageFunction/include/itkBSplineDecompositionImageFilter.hxx +++ b/Modules/Core/ImageFunction/include/itkBSplineDecompositionImageFilter.hxx @@ -46,7 +46,7 @@ BSplineDecompositionImageFilter::BSplineDecomposition m_Scratch[i] = 0; } - m_DataLength.Fill(itk::NumericTraits::ZeroValue()); + m_DataLength.Fill(typename TInputImage::SizeType::SizeValueType{}); } template diff --git a/Modules/Core/ImageFunction/include/itkCentralDifferenceImageFunction.hxx b/Modules/Core/ImageFunction/include/itkCentralDifferenceImageFunction.hxx index 916b19a45e7..1304330e261 100644 --- a/Modules/Core/ImageFunction/include/itkCentralDifferenceImageFunction.hxx +++ b/Modules/Core/ImageFunction/include/itkCentralDifferenceImageFunction.hxx @@ -132,7 +132,7 @@ CentralDifferenceImageFunction::EvaluateAtI // is in-bounds, so we don't do anything else if the point is out of bounds. if (index[dim] < start[dim] + 1 || index[dim] > (start[dim] + static_cast(size[dim]) - 2)) { - derivative[dim] = NumericTraits::ZeroValue(); + derivative[dim] = OutputValueType{}; continue; } @@ -200,7 +200,7 @@ CentralDifferenceImageFunction::EvaluateAtI // bounds checking if (dimOutOfBounds[dim]) { - componentDerivative[dim] = NumericTraits::ZeroValue(); + componentDerivative[dim] = OutputValueType{}; continue; } @@ -283,7 +283,7 @@ CentralDifferenceImageFunction::EvaluateSpe neighPoint1[dim] = point[dim] - offset; if (!this->IsInsideBuffer(neighPoint1)) { - orientedDerivative[dim] = NumericTraits::ZeroValue(); + orientedDerivative[dim] = DerivativeValueType{}; neighPoint1[dim] = point[dim]; neighPoint2[dim] = point[dim]; continue; @@ -291,7 +291,7 @@ CentralDifferenceImageFunction::EvaluateSpe neighPoint2[dim] = point[dim] + offset; if (!this->IsInsideBuffer(neighPoint2)) { - orientedDerivative[dim] = NumericTraits::ZeroValue(); + orientedDerivative[dim] = DerivativeValueType{}; neighPoint1[dim] = point[dim]; neighPoint2[dim] = point[dim]; continue; @@ -347,14 +347,14 @@ CentralDifferenceImageFunction::EvaluateSpe ScalarDerivativeType componentDerivativeOut; ScalarDerivativeType componentDerivative; - componentDerivative.Fill(NumericTraits::ZeroValue()); + componentDerivative.Fill(OutputValueType{}); for (unsigned int dim = 0; dim < Self::ImageDimension; ++dim) { // initialize to quiet compiler warnings neighPixels[dim][0] = zeroPixel; neighPixels[dim][1] = zeroPixel; - delta[dim] = NumericTraits::ZeroValue(); + delta[dim] = PointValueType{}; dimOutOfBounds[dim] = true; } @@ -376,7 +376,7 @@ CentralDifferenceImageFunction::EvaluateSpe if (dimOutOfBounds[dim]) { - componentDerivative[dim] = NumericTraits::ZeroValue(); + componentDerivative[dim] = OutputValueType{}; neighPoint1[dim] = point[dim]; neighPoint2[dim] = point[dim]; continue; @@ -406,7 +406,7 @@ CentralDifferenceImageFunction::EvaluateSpe } else { - componentDerivative[dim] = NumericTraits::ZeroValue(); + componentDerivative[dim] = OutputValueType{}; } } @@ -474,7 +474,7 @@ CentralDifferenceImageFunction::EvaluateAtC if (cindex[dim] < static_cast(start[dim] + 1) || cindex[dim] > static_cast(start[dim] + static_cast(size[dim]) - 2)) { - derivative[dim] = NumericTraits::ZeroValue(); + derivative[dim] = DerivativeValueType{}; continue; } @@ -545,7 +545,7 @@ CentralDifferenceImageFunction::EvaluateAtC { if (dimOutOfBounds[dim]) { - componentDerivative[dim] = NumericTraits::ZeroValue(); + componentDerivative[dim] = DerivativeValueType{}; continue; } diff --git a/Modules/Core/ImageFunction/include/itkCovarianceImageFunction.hxx b/Modules/Core/ImageFunction/include/itkCovarianceImageFunction.hxx index 57013c2c517..d78d0034845 100644 --- a/Modules/Core/ImageFunction/include/itkCovarianceImageFunction.hxx +++ b/Modules/Core/ImageFunction/include/itkCovarianceImageFunction.hxx @@ -54,11 +54,11 @@ CovarianceImageFunction::EvaluateAtIndex(const IndexType } - covariance.fill(NumericTraits::ZeroValue()); + covariance.fill(PixelComponentRealType{}); using MeanVectorType = vnl_vector; MeanVectorType mean(VectorDimension); - mean.fill(NumericTraits::ZeroValue()); + mean.fill(PixelComponentRealType{}); // Create an N-d neighborhood kernel, using a zeroflux boundary condition typename InputImageType::SizeType kernelSize; diff --git a/Modules/Core/ImageFunction/include/itkLinearInterpolateImageFunction.h b/Modules/Core/ImageFunction/include/itkLinearInterpolateImageFunction.h index 8fd7a61477c..5eda15f5c57 100644 --- a/Modules/Core/ImageFunction/include/itkLinearInterpolateImageFunction.h +++ b/Modules/Core/ImageFunction/include/itkLinearInterpolateImageFunction.h @@ -517,7 +517,7 @@ class ITK_TEMPLATE_EXPORT LinearInterpolateImageFunction : public InterpolateIma const typename TInputImage::PixelType & tempPixel = inputImagePtr->GetPixel(idx); const unsigned int sizeOfVarLengthVector = tempPixel.GetSize(); tempZeros.SetSize(sizeOfVarLengthVector); - tempZeros.Fill(NumericTraits::ZeroValue()); + tempZeros.Fill(RealTypeScalarRealType{}); } template @@ -525,7 +525,7 @@ class ITK_TEMPLATE_EXPORT LinearInterpolateImageFunction : public InterpolateIma MakeZeroInitializer(const TInputImage * const itkNotUsed(inputImagePtr), RealTypeScalarRealType & tempZeros) const { // All other cases - tempZeros = NumericTraits::ZeroValue(); + tempZeros = RealTypeScalarRealType{}; } }; } // end namespace itk diff --git a/Modules/Core/ImageFunction/include/itkMeanImageFunction.hxx b/Modules/Core/ImageFunction/include/itkMeanImageFunction.hxx index 79e618342e2..3e1928f170d 100644 --- a/Modules/Core/ImageFunction/include/itkMeanImageFunction.hxx +++ b/Modules/Core/ImageFunction/include/itkMeanImageFunction.hxx @@ -36,7 +36,7 @@ MeanImageFunction::EvaluateAtIndex(const IndexType & ind { RealType sum; - sum = NumericTraits::ZeroValue(); + sum = RealType{}; const InputImageType * const image = this->GetInputImage(); diff --git a/Modules/Core/ImageFunction/include/itkScatterMatrixImageFunction.hxx b/Modules/Core/ImageFunction/include/itkScatterMatrixImageFunction.hxx index d51c1110fb8..97bfde53667 100644 --- a/Modules/Core/ImageFunction/include/itkScatterMatrixImageFunction.hxx +++ b/Modules/Core/ImageFunction/include/itkScatterMatrixImageFunction.hxx @@ -51,7 +51,7 @@ ScatterMatrixImageFunction::EvaluateAtIndex(const IndexT const unsigned int VectorDimension = PixelType::Dimension; covariance = vnl_matrix(VectorDimension, VectorDimension); - covariance.fill(NumericTraits::ZeroValue()); + covariance.fill(PixelComponentRealType{}); if (!this->GetInputImage()) { diff --git a/Modules/Core/ImageFunction/include/itkSumOfSquaresImageFunction.hxx b/Modules/Core/ImageFunction/include/itkSumOfSquaresImageFunction.hxx index 4b6186a3911..734221a74c4 100644 --- a/Modules/Core/ImageFunction/include/itkSumOfSquaresImageFunction.hxx +++ b/Modules/Core/ImageFunction/include/itkSumOfSquaresImageFunction.hxx @@ -37,7 +37,7 @@ SumOfSquaresImageFunction::EvaluateAtIndex(const IndexTy { RealType sumOfSquares; - sumOfSquares = NumericTraits::ZeroValue(); + sumOfSquares = RealType{}; const InputImageType * const image = this->GetInputImage(); diff --git a/Modules/Core/ImageFunction/include/itkVarianceImageFunction.hxx b/Modules/Core/ImageFunction/include/itkVarianceImageFunction.hxx index 189b8ef3300..1a3ea528f6e 100644 --- a/Modules/Core/ImageFunction/include/itkVarianceImageFunction.hxx +++ b/Modules/Core/ImageFunction/include/itkVarianceImageFunction.hxx @@ -46,8 +46,8 @@ VarianceImageFunction::EvaluateAtIndex(const IndexType & RealType sumOfSquares; RealType var; - sum = NumericTraits::ZeroValue(); - sumOfSquares = NumericTraits::ZeroValue(); + sum = RealType{}; + sumOfSquares = RealType{}; if (!this->GetInputImage()) { diff --git a/Modules/Core/ImageFunction/test/itkCentralDifferenceImageFunctionOnVectorTest.cxx b/Modules/Core/ImageFunction/test/itkCentralDifferenceImageFunctionOnVectorTest.cxx index 1b81e49a6b9..9e4a9580350 100644 --- a/Modules/Core/ImageFunction/test/itkCentralDifferenceImageFunctionOnVectorTest.cxx +++ b/Modules/Core/ImageFunction/test/itkCentralDifferenceImageFunctionOnVectorTest.cxx @@ -173,7 +173,7 @@ itkCentralDifferenceImageFunctionOnVectorTestRun() } for (itk::SizeValueType n = 0; n < VectorLength; ++n) { - if (itk::Math::NotAlmostEquals(indexOutput(n, 0), itk::NumericTraits::ZeroValue())) + if (itk::Math::NotAlmostEquals(indexOutput(n, 0), OutputValueType{})) { std::cout << "ERROR: Index: " << index << " expected output dim 0 to be 0. << std::endl; " << std::endl; result = EXIT_FAILURE; @@ -220,7 +220,7 @@ itkCentralDifferenceImageFunctionOnVectorTestRun() } for (itk::SizeValueType n = 0; n < VectorLength; ++n) { - if (itk::Math::NotAlmostEquals(indexOutput(n, 1), itk::NumericTraits::ZeroValue())) + if (itk::Math::NotAlmostEquals(indexOutput(n, 1), OutputValueType{})) { std::cout << "ERROR: Index: " << index << " expected output dim 1 to be 0. " << std::endl; result = EXIT_FAILURE; diff --git a/Modules/Core/ImageFunction/test/itkCentralDifferenceImageFunctionTest.cxx b/Modules/Core/ImageFunction/test/itkCentralDifferenceImageFunctionTest.cxx index 90515157406..17cadc6e06b 100644 --- a/Modules/Core/ImageFunction/test/itkCentralDifferenceImageFunctionTest.cxx +++ b/Modules/Core/ImageFunction/test/itkCentralDifferenceImageFunctionTest.cxx @@ -114,7 +114,7 @@ itkCentralDifferenceImageFunctionTest(int, char *[]) { std::cout << "Index: " << index << " is inside the BufferedRegion." << std::endl; } - if (itk::Math::NotExactlyEquals(indexOutput[0], itk::NumericTraits::ZeroValue())) + if (itk::Math::NotExactlyEquals(indexOutput[0], OutputValueType{})) { std::cout << "ERROR: Index: " << index << " - expected result dim 0 to have value 0. " << std::endl; result = EXIT_FAILURE; @@ -157,7 +157,7 @@ itkCentralDifferenceImageFunctionTest(int, char *[]) { std::cout << "Index: " << index << " is inside the BufferedRegion." << std::endl; } - if (itk::Math::NotExactlyEquals(indexOutput[1], itk::NumericTraits::ZeroValue())) + if (itk::Math::NotExactlyEquals(indexOutput[1], OutputValueType{})) { std::cout << "ERROR: Index: " << index << " - expected result dim 1 to have value 0. " << std::endl; result = EXIT_FAILURE; diff --git a/Modules/Core/Mesh/include/itkConnectedRegionsMeshFilter.hxx b/Modules/Core/Mesh/include/itkConnectedRegionsMeshFilter.hxx index 0a0e9ad5881..266342ed2b0 100644 --- a/Modules/Core/Mesh/include/itkConnectedRegionsMeshFilter.hxx +++ b/Modules/Core/Mesh/include/itkConnectedRegionsMeshFilter.hxx @@ -41,8 +41,8 @@ namespace itk template ConnectedRegionsMeshFilter::ConnectedRegionsMeshFilter() : m_ExtractionMode(Self::LargestRegion) - , m_NumberOfCellsInRegion(NumericTraits::ZeroValue()) - , m_RegionNumber(NumericTraits::ZeroValue()) + , m_NumberOfCellsInRegion(SizeValueType{}) + , m_RegionNumber(IdentifierType{}) { m_ClosestPoint.Fill(0); diff --git a/Modules/Core/Mesh/include/itkTriangleMeshToBinaryImageFilter.hxx b/Modules/Core/Mesh/include/itkTriangleMeshToBinaryImageFilter.hxx index 632d5011e98..b0d10b4e219 100644 --- a/Modules/Core/Mesh/include/itkTriangleMeshToBinaryImageFilter.hxx +++ b/Modules/Core/Mesh/include/itkTriangleMeshToBinaryImageFilter.hxx @@ -40,7 +40,7 @@ TriangleMeshToBinaryImageFilter::TriangleMeshToBinaryI } m_InsideValue = NumericTraits::OneValue(); - m_OutsideValue = NumericTraits::ZeroValue(); + m_OutsideValue = ValueType{}; m_Direction.GetVnlMatrix().set_identity(); m_Tolerance = 1e-5; diff --git a/Modules/Core/Mesh/include/itkVTKPolyDataReader.hxx b/Modules/Core/Mesh/include/itkVTKPolyDataReader.hxx index 99880a827df..0615a5a9a25 100644 --- a/Modules/Core/Mesh/include/itkVTKPolyDataReader.hxx +++ b/Modules/Core/Mesh/include/itkVTKPolyDataReader.hxx @@ -121,7 +121,7 @@ VTKPolyDataReader::GenerateData() itkDebugMacro("pointLine " << pointLine); // we must use long here because this is the exact type specified by scanf - long numberOfPoints = NumericTraits::ZeroValue(); + long numberOfPoints = PointIdentifier{}; if (sscanf(pointLine.c_str(), "%ld", &numberOfPoints) != 1) { @@ -187,8 +187,8 @@ VTKPolyDataReader::GenerateData() // // we must use long here because this is the exact type specified by scanf - long numberOfPolygons = NumericTraits::ZeroValue(); - long numberOfIndices = NumericTraits::ZeroValue(); + long numberOfPolygons = CellIdentifier{}; + long numberOfIndices = CellIdentifier{}; if (sscanf(polygonLine.c_str(), "%ld %ld", &numberOfPolygons, &numberOfIndices) != 2) { diff --git a/Modules/Core/QuadEdgeMesh/include/itkQuadEdgeMesh.h b/Modules/Core/QuadEdgeMesh/include/itkQuadEdgeMesh.h index 254c36b9053..d3e5fb6e8fc 100644 --- a/Modules/Core/QuadEdgeMesh/include/itkQuadEdgeMesh.h +++ b/Modules/Core/QuadEdgeMesh/include/itkQuadEdgeMesh.h @@ -320,14 +320,14 @@ class ITK_TEMPLATE_EXPORT QuadEdgeMesh : public Mesh::ZeroValue(); + return CellIdentifier{}; } /** NOTE ALEX: this method do not use CellFeature and thus could be recoded */ CellIdentifier GetCellNeighbors(CellIdentifier itkNotUsed(cellId), std::set * itkNotUsed(cellSet)) { - return NumericTraits::ZeroValue(); + return CellIdentifier{}; } /** overloaded method for backward compatibility */ diff --git a/Modules/Core/QuadEdgeMesh/include/itkQuadEdgeMeshTopologyChecker.hxx b/Modules/Core/QuadEdgeMesh/include/itkQuadEdgeMeshTopologyChecker.hxx index b48c2823eb5..f43a5398329 100644 --- a/Modules/Core/QuadEdgeMesh/include/itkQuadEdgeMeshTopologyChecker.hxx +++ b/Modules/Core/QuadEdgeMesh/include/itkQuadEdgeMeshTopologyChecker.hxx @@ -24,11 +24,11 @@ namespace itk template QuadEdgeMeshTopologyChecker::QuadEdgeMeshTopologyChecker() { - m_ExpectedNumberOfPoints = NumericTraits::ZeroValue(); - m_ExpectedNumberOfEdges = NumericTraits::ZeroValue(); - m_ExpectedNumberOfFaces = NumericTraits::ZeroValue(); - m_ExpectedNumberOfBoundaries = NumericTraits::ZeroValue(); - m_ExpectedGenus = NumericTraits::ZeroValue(); + m_ExpectedNumberOfPoints = PointIdentifier{}; + m_ExpectedNumberOfEdges = CellIdentifier{}; + m_ExpectedNumberOfFaces = CellIdentifier{}; + m_ExpectedNumberOfBoundaries = CellIdentifier{}; + m_ExpectedGenus = OffsetValueType{}; m_Mesh = nullptr; } diff --git a/Modules/Core/SpatialObjects/include/itkImageMaskSpatialObject.hxx b/Modules/Core/SpatialObjects/include/itkImageMaskSpatialObject.hxx index 5b944321efd..f6a4322c8ce 100644 --- a/Modules/Core/SpatialObjects/include/itkImageMaskSpatialObject.hxx +++ b/Modules/Core/SpatialObjects/include/itkImageMaskSpatialObject.hxx @@ -39,8 +39,7 @@ ImageMaskSpatialObject::IsInsideInObjectSpace(const PointTyp const IndexType index = image->TransformPhysicalPointToIndex(point); - return Superclass::GetBufferedRegion().IsInside(index) && - Math::NotExactlyEquals(image->GetPixel(index), NumericTraits::ZeroValue()); + return Superclass::GetBufferedRegion().IsInside(index) && Math::NotExactlyEquals(image->GetPixel(index), PixelType{}); } @@ -143,7 +142,7 @@ ImageMaskSpatialObject::ComputeMyBoundingBoxInIndexSpace() c const auto HasForegroundPixels = [&image](const RegionType & region) { for (const PixelType pixelValue : ImageRegionRange{ image, region }) { - constexpr auto zeroValue = NumericTraits::ZeroValue(); + constexpr auto zeroValue = PixelType{}; if (pixelValue != zeroValue) { diff --git a/Modules/Core/SpatialObjects/include/itkMetaImageConverter.hxx b/Modules/Core/SpatialObjects/include/itkMetaImageConverter.hxx index 6545e047d44..e0d3f9a9c78 100644 --- a/Modules/Core/SpatialObjects/include/itkMetaImageConverter.hxx +++ b/Modules/Core/SpatialObjects/include/itkMetaImageConverter.hxx @@ -55,7 +55,7 @@ MetaImageConverter::AllocateImage(con for (unsigned int i = 0; i < VDimension; ++i) { size[i] = image->DimSize()[i]; - if (Math::ExactlyEquals(image->ElementSpacing()[i], NumericTraits::ZeroValue())) + if (Math::ExactlyEquals(image->ElementSpacing()[i], typename SpacingType::ValueType{})) { spacing[i] = 1; } diff --git a/Modules/Core/SpatialObjects/include/itkPointBasedSpatialObject.hxx b/Modules/Core/SpatialObjects/include/itkPointBasedSpatialObject.hxx index 5d245a05f58..b811546015b 100644 --- a/Modules/Core/SpatialObjects/include/itkPointBasedSpatialObject.hxx +++ b/Modules/Core/SpatialObjects/include/itkPointBasedSpatialObject.hxx @@ -155,7 +155,7 @@ PointBasedSpatialObject::ComputeMyBoundingB if (it == end) { typename BoundingBoxType::PointType pnt; - pnt.Fill(NumericTraits::ZeroValue()); + pnt.Fill(typename BoundingBoxType::PointType::ValueType{}); this->GetModifiableMyBoundingBoxInObjectSpace()->SetMinimum(pnt); this->GetModifiableMyBoundingBoxInObjectSpace()->SetMaximum(pnt); return; diff --git a/Modules/Core/SpatialObjects/include/itkSpatialObject.hxx b/Modules/Core/SpatialObjects/include/itkSpatialObject.hxx index f35e65c18e9..39d675d8815 100644 --- a/Modules/Core/SpatialObjects/include/itkSpatialObject.hxx +++ b/Modules/Core/SpatialObjects/include/itkSpatialObject.hxx @@ -39,7 +39,7 @@ void SpatialObject::Clear() { typename BoundingBoxType::PointType pnt; - pnt.Fill(NumericTraits::ZeroValue()); + pnt.Fill(typename BoundingBoxType::PointType::ValueType{}); m_FamilyBoundingBoxInObjectSpace->SetMinimum(pnt); m_FamilyBoundingBoxInObjectSpace->SetMaximum(pnt); m_FamilyBoundingBoxInWorldSpace->SetMinimum(pnt); @@ -602,7 +602,7 @@ void SpatialObject::ComputeMyBoundingBox() { typename BoundingBoxType::PointType pnt; - pnt.Fill(NumericTraits::ZeroValue()); + pnt.Fill(typename BoundingBoxType::PointType::ValueType{}); if (m_MyBoundingBoxInObjectSpace->GetMinimum() != pnt || m_MyBoundingBoxInObjectSpace->GetMaximum() != pnt) { m_MyBoundingBoxInObjectSpace->SetMinimum(pnt); @@ -639,7 +639,7 @@ SpatialObject::ComputeFamilyBoundingBox(unsigned int depth, const st itkDebugMacro("Computing Bounding Box"); typename BoundingBoxType::PointType zeroPnt; - zeroPnt.Fill(NumericTraits::ZeroValue()); + zeroPnt.Fill(typename BoundingBoxType::PointType::ValueType{}); m_FamilyBoundingBoxInObjectSpace->SetMinimum(zeroPnt); m_FamilyBoundingBoxInObjectSpace->SetMaximum(zeroPnt); bool bbDefined = false; diff --git a/Modules/Core/SpatialObjects/include/itkSpatialObjectToImageFilter.hxx b/Modules/Core/SpatialObjects/include/itkSpatialObjectToImageFilter.hxx index fb4235129da..fb0b64ab1aa 100644 --- a/Modules/Core/SpatialObjects/include/itkSpatialObjectToImageFilter.hxx +++ b/Modules/Core/SpatialObjects/include/itkSpatialObjectToImageFilter.hxx @@ -336,8 +336,7 @@ SpatialObjectToImageFilter::GenerateData() double val = 0; bool evaluable = InputObject->ValueAtInWorldSpace(objectPoint, val, m_ChildrenDepth); - if (Math::NotExactlyEquals(m_InsideValue, NumericTraits::ZeroValue()) || - Math::NotExactlyEquals(m_OutsideValue, NumericTraits::ZeroValue())) + if (Math::NotExactlyEquals(m_InsideValue, ValueType{}) || Math::NotExactlyEquals(m_OutsideValue, ValueType{})) { if (evaluable) { diff --git a/Modules/Core/SpatialObjects/include/itkTubeSpatialObject.hxx b/Modules/Core/SpatialObjects/include/itkTubeSpatialObject.hxx index 030869d3b67..7e71b11df9c 100644 --- a/Modules/Core/SpatialObjects/include/itkTubeSpatialObject.hxx +++ b/Modules/Core/SpatialObjects/include/itkTubeSpatialObject.hxx @@ -128,7 +128,7 @@ TubeSpatialObject::ComputeMyBoundingBox() if (it == end) { typename BoundingBoxType::PointType pnt; - pnt.Fill(NumericTraits::ZeroValue()); + pnt.Fill(typename BoundingBoxType::PointType::ValueType{}); this->GetModifiableMyBoundingBoxInObjectSpace()->SetMinimum(pnt); this->GetModifiableMyBoundingBoxInObjectSpace()->SetMaximum(pnt); return; diff --git a/Modules/Core/SpatialObjects/test/itkImageMaskSpatialObjectTest2.cxx b/Modules/Core/SpatialObjects/test/itkImageMaskSpatialObjectTest2.cxx index a38dd32d1eb..b1d1fe00587 100644 --- a/Modules/Core/SpatialObjects/test/itkImageMaskSpatialObjectTest2.cxx +++ b/Modules/Core/SpatialObjects/test/itkImageMaskSpatialObjectTest2.cxx @@ -201,7 +201,7 @@ itkImageMaskSpatialObjectTest2(int, char *[]) const bool isInside = maskSO->IsInsideInWorldSpace(point); double value{}; maskSO->ValueAtInWorldSpace(point, value); - const bool isZero = (itk::Math::ExactlyEquals(value, itk::NumericTraits::ZeroValue())); + const bool isZero = (itk::Math::ExactlyEquals(value, PixelType{})); if ((isInside && isZero) || (!isInside && !isZero)) { ImageType::IndexType pointIndex = image->TransformPhysicalPointToIndex(point); diff --git a/Modules/Core/SpatialObjects/test/itkMetaArrowConverterTest.cxx b/Modules/Core/SpatialObjects/test/itkMetaArrowConverterTest.cxx index adbb0e42f88..3c93b5498a9 100644 --- a/Modules/Core/SpatialObjects/test/itkMetaArrowConverterTest.cxx +++ b/Modules/Core/SpatialObjects/test/itkMetaArrowConverterTest.cxx @@ -269,12 +269,9 @@ itkMetaArrowConverterTest(int argc, char * argv[]) mDirectionNorm[0] = mDirection[0]; mDirectionNorm[1] = mDirection[1]; mDirectionNorm[2] = mDirection[2]; - if (itk::Math::NotExactlyEquals(mDirection[0], - itk::NumericTraits::ZeroValue()) || - itk::Math::NotExactlyEquals(mDirection[1], - itk::NumericTraits::ZeroValue()) || - itk::Math::NotExactlyEquals(mDirection[2], - itk::NumericTraits::ZeroValue())) + if (itk::Math::NotExactlyEquals(mDirection[0], SpatialObjectType::VectorType::ValueType{}) || + itk::Math::NotExactlyEquals(mDirection[1], SpatialObjectType::VectorType::ValueType{}) || + itk::Math::NotExactlyEquals(mDirection[2], SpatialObjectType::VectorType::ValueType{})) { mDirectionNorm.Normalize(); } @@ -344,12 +341,9 @@ itkMetaArrowConverterTest(int argc, char * argv[]) // check direction (note: need to normalize before comparing) SpatialObjectType::VectorType reLoadDirectionNorm = reLoad->GetDirectionInWorldSpace(); - if (itk::Math::NotExactlyEquals(reLoadDirectionNorm[0], - itk::NumericTraits::ZeroValue()) || - itk::Math::NotExactlyEquals(reLoadDirectionNorm[1], - itk::NumericTraits::ZeroValue()) || - itk::Math::NotExactlyEquals(reLoadDirectionNorm[2], - itk::NumericTraits::ZeroValue())) + if (itk::Math::NotExactlyEquals(reLoadDirectionNorm[0], SpatialObjectType::VectorType::ValueType{}) || + itk::Math::NotExactlyEquals(reLoadDirectionNorm[1], SpatialObjectType::VectorType::ValueType{}) || + itk::Math::NotExactlyEquals(reLoadDirectionNorm[2], SpatialObjectType::VectorType::ValueType{})) { reLoadDirectionNorm.Normalize(); } diff --git a/Modules/Core/SpatialObjects/test/itkSpatialObjectToImageStatisticsCalculatorTest.cxx b/Modules/Core/SpatialObjects/test/itkSpatialObjectToImageStatisticsCalculatorTest.cxx index fb8ade4a406..369ba0511bb 100644 --- a/Modules/Core/SpatialObjects/test/itkSpatialObjectToImageStatisticsCalculatorTest.cxx +++ b/Modules/Core/SpatialObjects/test/itkSpatialObjectToImageStatisticsCalculatorTest.cxx @@ -82,8 +82,7 @@ itkSpatialObjectToImageStatisticsCalculatorTest(int, char *[]) std::cout << "Sample covariance = " << calculator->GetCovarianceMatrix(); if (calculator->GetMean() != itk::MakeFilled(255) || - itk::Math::NotAlmostEquals(calculator->GetCovarianceMatrix()[0][0], - itk::NumericTraits::ZeroValue())) + itk::Math::NotAlmostEquals(calculator->GetCovarianceMatrix()[0][0], CalculatorType::MatrixType::ValueType{})) { std::cout << "[FAILED]" << std::endl; return EXIT_FAILURE; diff --git a/Modules/Core/TestKernel/include/itkTestingComparisonImageFilter.hxx b/Modules/Core/TestKernel/include/itkTestingComparisonImageFilter.hxx index f58c27c910e..4b2b44ee2a6 100644 --- a/Modules/Core/TestKernel/include/itkTestingComparisonImageFilter.hxx +++ b/Modules/Core/TestKernel/include/itkTestingComparisonImageFilter.hxx @@ -33,7 +33,7 @@ template ComparisonImageFilter::ComparisonImageFilter() { // Set the default DifferenceThreshold. - m_DifferenceThreshold = NumericTraits::ZeroValue(); + m_DifferenceThreshold = OutputPixelType{}; // Set the default ToleranceRadius. m_ToleranceRadius = 0; @@ -41,8 +41,8 @@ ComparisonImageFilter::ComparisonImageFilter() // Initialize statistics about difference image. m_MinimumDifference = NumericTraits::max(); m_MaximumDifference = NumericTraits::NonpositiveMin(); - m_MeanDifference = NumericTraits::ZeroValue(); - m_TotalDifference = NumericTraits::ZeroValue(); + m_MeanDifference = RealType{}; + m_TotalDifference = AccumulateType{}; m_NumberOfPixelsWithDifferences = 0; m_IgnoreBoundaryPixels = false; m_VerifyInputInformation = true; @@ -82,8 +82,8 @@ ComparisonImageFilter::BeforeThreadedGenerateData() // Initialize statistics about difference image. m_MinimumDifference = NumericTraits::max(); m_MaximumDifference = NumericTraits::NonpositiveMin(); - m_MeanDifference = NumericTraits::ZeroValue(); - m_TotalDifference = NumericTraits::ZeroValue(); + m_MeanDifference = RealType{}; + m_TotalDifference = AccumulateType{}; m_NumberOfPixelsWithDifferences = 0; // Resize the thread temporaries @@ -95,7 +95,7 @@ ComparisonImageFilter::BeforeThreadedGenerateData() // Initialize the temporaries m_ThreadMinimumDifference.Fill(NumericTraits::max()); m_ThreadMaximumDifference.Fill(NumericTraits::NonpositiveMin()); - m_ThreadDifferenceSum.Fill(NumericTraits::ZeroValue()); + m_ThreadDifferenceSum.Fill(AccumulateType{}); m_ThreadNumberOfPixels.Fill(0); } @@ -215,7 +215,7 @@ ComparisonImageFilter::ThreadedGenerateData(const Out else { // Difference is below threshold. - out.Set(NumericTraits::ZeroValue()); + out.Set(OutputPixelType{}); } // Update progress. @@ -226,7 +226,7 @@ ComparisonImageFilter::ThreadedGenerateData(const Out { for (out.GoToBegin(); !out.IsAtEnd(); ++out) { - out.Set(NumericTraits::ZeroValue()); + out.Set(OutputPixelType{}); progress.CompletedPixel(); } } diff --git a/Modules/Core/TestKernel/include/itkTestingStretchIntensityImageFilter.hxx b/Modules/Core/TestKernel/include/itkTestingStretchIntensityImageFilter.hxx index 614f43db434..fa9388d4986 100644 --- a/Modules/Core/TestKernel/include/itkTestingStretchIntensityImageFilter.hxx +++ b/Modules/Core/TestKernel/include/itkTestingStretchIntensityImageFilter.hxx @@ -44,7 +44,7 @@ StretchIntensityImageFilter::StretchIntensityImageFil : m_Scale(1.0) , m_Shift(0.0) , m_InputMinimum(NumericTraits::max()) - , m_InputMaximum(NumericTraits::ZeroValue()) + , m_InputMaximum(InputPixelType{}) , m_OutputMinimum(NumericTraits::NonpositiveMin()) , m_OutputMaximum(NumericTraits::max()) { diff --git a/Modules/Core/Transform/include/itkBSplineDeformableTransform.hxx b/Modules/Core/Transform/include/itkBSplineDeformableTransform.hxx index 0775758f296..be9375e1678 100644 --- a/Modules/Core/Transform/include/itkBSplineDeformableTransform.hxx +++ b/Modules/Core/Transform/include/itkBSplineDeformableTransform.hxx @@ -503,7 +503,7 @@ BSplineDeformableTransform::Tran constexpr SizeType supportSize = WeightsFunctionType::SupportSize; const RegionType supportRegion(supportIndex, supportSize); - outputPoint.Fill(NumericTraits::ZeroValue()); + outputPoint.Fill(ScalarType{}); using IteratorType = ImageScanlineConstIterator; IteratorType coeffIterator[SpaceDimension]; diff --git a/Modules/Core/Transform/include/itkBSplineTransform.hxx b/Modules/Core/Transform/include/itkBSplineTransform.hxx index b9313b9e55a..8196af60fca 100644 --- a/Modules/Core/Transform/include/itkBSplineTransform.hxx +++ b/Modules/Core/Transform/include/itkBSplineTransform.hxx @@ -543,7 +543,7 @@ BSplineTransform::TransformPoint constexpr auto supportSize = SizeType::Filled(SplineOrder + 1); const RegionType supportRegion(supportIndex, supportSize); - outputPoint.Fill(NumericTraits::ZeroValue()); + outputPoint.Fill(ScalarType{}); using IteratorType = ImageScanlineConstIterator; IteratorType coeffIterator[SpaceDimension]; diff --git a/Modules/Core/Transform/include/itkComposeScaleSkewVersor3DTransform.hxx b/Modules/Core/Transform/include/itkComposeScaleSkewVersor3DTransform.hxx index e0c36c95fa6..9395df1586e 100644 --- a/Modules/Core/Transform/include/itkComposeScaleSkewVersor3DTransform.hxx +++ b/Modules/Core/Transform/include/itkComposeScaleSkewVersor3DTransform.hxx @@ -30,7 +30,7 @@ ComposeScaleSkewVersor3DTransform::ComposeScaleSkewVersor3 : Superclass(ParametersDimension) { m_Scale.Fill(NumericTraits::OneValue()); - m_Skew.Fill(NumericTraits::ZeroValue()); + m_Skew.Fill(TParametersValueType{}); } // Constructor with arguments @@ -182,7 +182,7 @@ void ComposeScaleSkewVersor3DTransform::SetIdentity() { m_Scale.Fill(NumericTraits::OneValue()); - m_Skew.Fill(NumericTraits::ZeroValue()); + m_Skew.Fill(SkewVectorValueType{}); Superclass::SetIdentity(); } diff --git a/Modules/Core/Transform/include/itkElasticBodyReciprocalSplineKernelTransform.hxx b/Modules/Core/Transform/include/itkElasticBodyReciprocalSplineKernelTransform.hxx index 6798e0bf518..06c6911b990 100644 --- a/Modules/Core/Transform/include/itkElasticBodyReciprocalSplineKernelTransform.hxx +++ b/Modules/Core/Transform/include/itkElasticBodyReciprocalSplineKernelTransform.hxx @@ -34,7 +34,7 @@ ElasticBodyReciprocalSplineKernelTransform::Co GMatrixType & gmatrix) const { const TParametersValueType r = x.GetNorm(); - const TParametersValueType factor = (r > 1e-8) ? (-1.0 / r) : NumericTraits::ZeroValue(); + const TParametersValueType factor = (r > 1e-8) ? (-1.0 / r) : TParametersValueType{}; const TParametersValueType radial = m_Alpha * r; for (unsigned int i = 0; i < VDimension; ++i) diff --git a/Modules/Core/Transform/include/itkEuler3DTransform.hxx b/Modules/Core/Transform/include/itkEuler3DTransform.hxx index d1eeeccb55c..d164c95f526 100644 --- a/Modules/Core/Transform/include/itkEuler3DTransform.hxx +++ b/Modules/Core/Transform/include/itkEuler3DTransform.hxx @@ -27,7 +27,7 @@ Euler3DTransform::Euler3DTransform() : Superclass(ParametersDimension) { m_ComputeZYX = false; - m_AngleX = m_AngleY = m_AngleZ = NumericTraits::ZeroValue(); + m_AngleX = m_AngleY = m_AngleZ = ScalarType{}; this->m_FixedParameters.SetSize(SpaceDimension + 1); this->m_FixedParameters.Fill(0.0); } @@ -52,7 +52,7 @@ Euler3DTransform::Euler3DTransform(unsigned int parameters : Superclass(parametersDimension) { m_ComputeZYX = false; - m_AngleX = m_AngleY = m_AngleZ = NumericTraits::ZeroValue(); + m_AngleX = m_AngleY = m_AngleZ = ScalarType{}; this->m_FixedParameters.SetSize(SpaceDimension + 1); this->m_FixedParameters.Fill(0.0); } @@ -192,7 +192,7 @@ Euler3DTransform::ComputeMatrixParameters() } else { - m_AngleX = NumericTraits::ZeroValue(); + m_AngleX = ScalarType{}; double x = this->GetMatrix()[1][1]; double y = -this->GetMatrix()[0][1]; m_AngleZ = std::atan2(y, x); @@ -214,7 +214,7 @@ Euler3DTransform::ComputeMatrixParameters() } else { - m_AngleZ = NumericTraits::ZeroValue(); + m_AngleZ = ScalarType{}; double x = this->GetMatrix()[0][0]; double y = this->GetMatrix()[1][0]; m_AngleY = std::atan2(y, x); diff --git a/Modules/Core/Transform/include/itkKernelTransform.hxx b/Modules/Core/Transform/include/itkKernelTransform.hxx index fee197874c4..bdd7057db44 100644 --- a/Modules/Core/Transform/include/itkKernelTransform.hxx +++ b/Modules/Core/Transform/include/itkKernelTransform.hxx @@ -81,7 +81,7 @@ template const typename KernelTransform::GMatrixType & KernelTransform::ComputeReflexiveG(PointsIterator) const { - m_GMatrix.fill(NumericTraits::ZeroValue()); + m_GMatrix.fill(TParametersValueType{}); m_GMatrix.fill_diagonal(m_Stiffness); return m_GMatrix; @@ -326,7 +326,7 @@ KernelTransform::TransformPoint(const InputPoi using ValueType = typename OutputPointType::ValueType; - result.Fill(NumericTraits::ZeroValue()); + result.Fill(ValueType{}); // TODO: It is unclear if the following line is needed. this->ComputeDeformationContribution(thisPoint, result); diff --git a/Modules/Core/Transform/include/itkMatrixOffsetTransformBase.hxx b/Modules/Core/Transform/include/itkMatrixOffsetTransformBase.hxx index 7cc61bb0616..082e11a6fc9 100644 --- a/Modules/Core/Transform/include/itkMatrixOffsetTransformBase.hxx +++ b/Modules/Core/Transform/include/itkMatrixOffsetTransformBase.hxx @@ -97,9 +97,9 @@ MatrixOffsetTransformBase::ZeroValue()); - m_Translation.Fill(NumericTraits::ZeroValue()); - m_Center.Fill(NumericTraits::ZeroValue()); + m_Offset.Fill(OutputVectorValueType{}); + m_Translation.Fill(OutputVectorValueType{}); + m_Center.Fill(InputPointValueType{}); m_Singular = false; m_InverseMatrix.SetIdentity(); m_InverseMatrixMTime = m_MatrixMTime; @@ -206,7 +206,7 @@ MatrixOffsetTransformBase::ZeroValue(); + result[i] = ScalarType{}; for (unsigned int j = 0; j < VInputDimension; ++j) { result[i] += inverseMatrix[j][i] * vec[j]; // Inverse transposed diff --git a/Modules/Core/Transform/include/itkRigid2DTransform.hxx b/Modules/Core/Transform/include/itkRigid2DTransform.hxx index 258fc307d51..a15c23d59f8 100644 --- a/Modules/Core/Transform/include/itkRigid2DTransform.hxx +++ b/Modules/Core/Transform/include/itkRigid2DTransform.hxx @@ -27,7 +27,7 @@ template Rigid2DTransform::Rigid2DTransform() : Superclass(ParametersDimension) { - m_Angle = NumericTraits::ZeroValue(); + m_Angle = TParametersValueType{}; } @@ -35,7 +35,7 @@ template Rigid2DTransform::Rigid2DTransform(unsigned int parametersDimension) : Superclass(parametersDimension) { - m_Angle = NumericTraits::ZeroValue(); + m_Angle = TParametersValueType{}; } @@ -43,7 +43,7 @@ template Rigid2DTransform::Rigid2DTransform(unsigned int, unsigned int parametersDimension) : Superclass(parametersDimension) { - m_Angle = NumericTraits::ZeroValue(); + m_Angle = TParametersValueType{}; } template @@ -176,7 +176,7 @@ void Rigid2DTransform::SetIdentity() { this->Superclass::SetIdentity(); - m_Angle = NumericTraits::ZeroValue(); + m_Angle = TParametersValueType{}; } diff --git a/Modules/Core/Transform/include/itkScalableAffineTransform.hxx b/Modules/Core/Transform/include/itkScalableAffineTransform.hxx index c29c9532fc7..3083d2dd66d 100644 --- a/Modules/Core/Transform/include/itkScalableAffineTransform.hxx +++ b/Modules/Core/Transform/include/itkScalableAffineTransform.hxx @@ -167,8 +167,7 @@ ScalableAffineTransform::ComputeMatrix() typename MatrixType::InternalMatrixType & imat = mat.GetVnlMatrix(); for (unsigned int i = 0; i < VDimension; ++i) { - if (Math::NotAlmostEquals(m_MatrixScale[i], - NumericTraits::ValueType>::ZeroValue()) && + if (Math::NotAlmostEquals(m_MatrixScale[i], typename NumericTraits::ValueType{}) && Math::NotAlmostEquals(m_Scale[i], 0.0)) { imat.put(i, i, m_Scale[i] / m_MatrixScale[i] * this->GetMatrix()[i][i]); diff --git a/Modules/Core/Transform/include/itkScaleSkewVersor3DTransform.hxx b/Modules/Core/Transform/include/itkScaleSkewVersor3DTransform.hxx index f7078e783df..3819ab072b5 100644 --- a/Modules/Core/Transform/include/itkScaleSkewVersor3DTransform.hxx +++ b/Modules/Core/Transform/include/itkScaleSkewVersor3DTransform.hxx @@ -28,7 +28,7 @@ ScaleSkewVersor3DTransform::ScaleSkewVersor3DTransform() : Superclass(ParametersDimension) { m_Scale.Fill(NumericTraits::OneValue()); - m_Skew.Fill(NumericTraits::ZeroValue()); + m_Skew.Fill(TParametersValueType{}); } // Constructor with arguments @@ -184,7 +184,7 @@ void ScaleSkewVersor3DTransform::SetIdentity() { m_Scale.Fill(NumericTraits::OneValue()); - m_Skew.Fill(NumericTraits::ZeroValue()); + m_Skew.Fill(SkewVectorValueType{}); Superclass::SetIdentity(); } diff --git a/Modules/Core/Transform/include/itkThinPlateR2LogRSplineKernelTransform.hxx b/Modules/Core/Transform/include/itkThinPlateR2LogRSplineKernelTransform.hxx index 92a228f7620..223639f9bf5 100644 --- a/Modules/Core/Transform/include/itkThinPlateR2LogRSplineKernelTransform.hxx +++ b/Modules/Core/Transform/include/itkThinPlateR2LogRSplineKernelTransform.hxx @@ -27,9 +27,8 @@ ThinPlateR2LogRSplineKernelTransform::ComputeG { const TParametersValueType r = x.GetNorm(); - gmatrix.fill(NumericTraits::ZeroValue()); - const TParametersValueType R2logR = - (r > 1e-8) ? r * r * std::log(r) : NumericTraits::ZeroValue(); + gmatrix.fill(TParametersValueType{}); + const TParametersValueType R2logR = (r > 1e-8) ? r * r * std::log(r) : TParametersValueType{}; gmatrix.fill_diagonal(R2logR); } @@ -48,8 +47,7 @@ ThinPlateR2LogRSplineKernelTransform::ComputeD { InputVectorType position = thisPoint - sp->Value(); const TParametersValueType r = position.GetNorm(); - const TParametersValueType R2logR = - (r > 1e-8) ? r * r * std::log(r) : NumericTraits::ZeroValue(); + const TParametersValueType R2logR = (r > 1e-8) ? r * r * std::log(r) : TParametersValueType{}; for (unsigned int odim = 0; odim < VDimension; ++odim) { result[odim] += R2logR * this->m_DMatrix(odim, lnd); diff --git a/Modules/Core/Transform/include/itkThinPlateSplineKernelTransform.hxx b/Modules/Core/Transform/include/itkThinPlateSplineKernelTransform.hxx index 54df78641a5..ab79381644c 100644 --- a/Modules/Core/Transform/include/itkThinPlateSplineKernelTransform.hxx +++ b/Modules/Core/Transform/include/itkThinPlateSplineKernelTransform.hxx @@ -27,7 +27,7 @@ ThinPlateSplineKernelTransform::ComputeG(const { const TParametersValueType r = x.GetNorm(); - gmatrix.fill(NumericTraits::ZeroValue()); + gmatrix.fill(TParametersValueType{}); for (unsigned int i = 0; i < VDimension; ++i) { gmatrix[i][i] = r; diff --git a/Modules/Core/Transform/include/itkTransform.hxx b/Modules/Core/Transform/include/itkTransform.hxx index ff3b3c3a2db..9251f0b5b6a 100644 --- a/Modules/Core/Transform/include/itkTransform.hxx +++ b/Modules/Core/Transform/include/itkTransform.hxx @@ -130,7 +130,7 @@ Transform::TransformVec OutputVectorType result; for (unsigned int i = 0; i < VOutputDimension; ++i) { - result[i] = NumericTraits::ZeroValue(); + result[i] = TParametersValueType{}; for (unsigned int j = 0; j < VInputDimension; ++j) { result[i] += jacobian[i][j] * vector[j]; @@ -152,7 +152,7 @@ Transform::TransformVec OutputVnlVectorType result; for (unsigned int i = 0; i < VOutputDimension; ++i) { - result[i] = NumericTraits::ZeroValue(); + result[i] = ParametersValueType{}; for (unsigned int j = 0; j < VInputDimension; ++j) { result[i] += jacobian[i][j] * vector[j]; @@ -183,7 +183,7 @@ Transform::TransformVec for (unsigned int i = 0; i < VOutputDimension; ++i) { - result[i] = NumericTraits::ZeroValue(); + result[i] = ParametersValueType{}; for (unsigned int j = 0; j < VInputDimension; ++j) { result[i] += jacobian[i][j] * vector[j]; @@ -205,7 +205,7 @@ Transform::TransformCov OutputCovariantVectorType result; for (unsigned int i = 0; i < VOutputDimension; ++i) { - result[i] = NumericTraits::ZeroValue(); + result[i] = TParametersValueType{}; for (unsigned int j = 0; j < VInputDimension; ++j) { result[i] += jacobian[j][i] * vector[j]; @@ -236,7 +236,7 @@ Transform::TransformCov for (unsigned int i = 0; i < VOutputDimension; ++i) { - result[i] = NumericTraits::ZeroValue(); + result[i] = ParametersValueType{}; for (unsigned int j = 0; j < VInputDimension; ++j) { result[i] += jacobian[j][i] * vector[j]; diff --git a/Modules/Core/Transform/include/itkVolumeSplineKernelTransform.hxx b/Modules/Core/Transform/include/itkVolumeSplineKernelTransform.hxx index b75d813d439..4fa8f5c10fa 100644 --- a/Modules/Core/Transform/include/itkVolumeSplineKernelTransform.hxx +++ b/Modules/Core/Transform/include/itkVolumeSplineKernelTransform.hxx @@ -27,7 +27,7 @@ VolumeSplineKernelTransform::ComputeG(const In { const TParametersValueType r = x.GetNorm(); - gmatrix.fill(NumericTraits::ZeroValue()); + gmatrix.fill(TParametersValueType{}); const TParametersValueType r3 = r * r * r; for (unsigned int i = 0; i < VDimension; ++i) { diff --git a/Modules/Core/Transform/test/itkBSplineDeformableTransformTest.cxx b/Modules/Core/Transform/test/itkBSplineDeformableTransformTest.cxx index 4272d522453..fe883ab501a 100644 --- a/Modules/Core/Transform/test/itkBSplineDeformableTransformTest.cxx +++ b/Modules/Core/Transform/test/itkBSplineDeformableTransformTest.cxx @@ -103,7 +103,7 @@ itkBSplineDeformableTransformTest1() */ unsigned long numberOfParameters = transform->GetNumberOfParameters(); ParametersType parameters(numberOfParameters); - parameters.Fill(itk::NumericTraits::ZeroValue()); + parameters.Fill(ParametersType::ValueType{}); /** * Define N * N-D grid of spline coefficients by wrapping the diff --git a/Modules/Core/Transform/test/itkBSplineTransformTest.cxx b/Modules/Core/Transform/test/itkBSplineTransformTest.cxx index 59e951e06d8..b865457329f 100644 --- a/Modules/Core/Transform/test/itkBSplineTransformTest.cxx +++ b/Modules/Core/Transform/test/itkBSplineTransformTest.cxx @@ -133,7 +133,7 @@ itkBSplineTransformTest1() */ unsigned long numberOfParameters = transform->GetNumberOfParameters(); ParametersType parameters(numberOfParameters); - parameters.Fill(itk::NumericTraits::ZeroValue()); + parameters.Fill(ParametersType::ValueType{}); /** * Define N * N-D grid of spline coefficients by wrapping the @@ -647,7 +647,7 @@ itkBSplineTransformTest3() */ unsigned long numberOfParameters = transform->GetNumberOfParameters(); ParametersType parameters(numberOfParameters); - parameters.Fill(itk::NumericTraits::ZeroValue()); + parameters.Fill(ParametersType::ValueType{}); /** * Define N * N-D grid of spline coefficients by wrapping the diff --git a/Modules/Filtering/AnisotropicSmoothing/include/itkGradientNDAnisotropicDiffusionFunction.hxx b/Modules/Filtering/AnisotropicSmoothing/include/itkGradientNDAnisotropicDiffusionFunction.hxx index 6c568742ba0..d6b63895706 100644 --- a/Modules/Filtering/AnisotropicSmoothing/include/itkGradientNDAnisotropicDiffusionFunction.hxx +++ b/Modules/Filtering/AnisotropicSmoothing/include/itkGradientNDAnisotropicDiffusionFunction.hxx @@ -94,7 +94,7 @@ GradientNDAnisotropicDiffusionFunction::ComputeUpdate(const Neighborhood PixelRealType dx_aug; PixelRealType dx_dim; - delta = NumericTraits::ZeroValue(); + delta = PixelRealType{}; // Calculate the centralized derivatives for each dimension. for (i = 0; i < ImageDimension; ++i) diff --git a/Modules/Filtering/AnisotropicSmoothing/include/itkScalarAnisotropicDiffusionFunction.hxx b/Modules/Filtering/AnisotropicSmoothing/include/itkScalarAnisotropicDiffusionFunction.hxx index b9fe4ddfa9e..34e08d7f064 100644 --- a/Modules/Filtering/AnisotropicSmoothing/include/itkScalarAnisotropicDiffusionFunction.hxx +++ b/Modules/Filtering/AnisotropicSmoothing/include/itkScalarAnisotropicDiffusionFunction.hxx @@ -64,8 +64,8 @@ ScalarAnisotropicDiffusionFunction::CalculateAverageGradientMagnitudeSqu fit = faceList.begin(); // Now do the actual processing - accumulator = NumericTraits::ZeroValue(); - counter = NumericTraits::ZeroValue(); + accumulator = AccumulateType{}; + counter = SizeValueType{}; // First process the non-boundary region diff --git a/Modules/Filtering/AnisotropicSmoothing/include/itkVectorAnisotropicDiffusionFunction.hxx b/Modules/Filtering/AnisotropicSmoothing/include/itkVectorAnisotropicDiffusionFunction.hxx index dbc67aa2030..cc51ffad642 100644 --- a/Modules/Filtering/AnisotropicSmoothing/include/itkVectorAnisotropicDiffusionFunction.hxx +++ b/Modules/Filtering/AnisotropicSmoothing/include/itkVectorAnisotropicDiffusionFunction.hxx @@ -64,7 +64,7 @@ VectorAnisotropicDiffusionFunction::CalculateAverageGradientMagnitudeSqu // Now do the actual processing accumulator = 0.0; - counter = NumericTraits::ZeroValue(); + counter = SizeValueType{}; // First process the non-boundary region diff --git a/Modules/Filtering/AnisotropicSmoothing/include/itkVectorGradientNDAnisotropicDiffusionFunction.hxx b/Modules/Filtering/AnisotropicSmoothing/include/itkVectorGradientNDAnisotropicDiffusionFunction.hxx index 446c003e961..d999cdfc399 100644 --- a/Modules/Filtering/AnisotropicSmoothing/include/itkVectorGradientNDAnisotropicDiffusionFunction.hxx +++ b/Modules/Filtering/AnisotropicSmoothing/include/itkVectorGradientNDAnisotropicDiffusionFunction.hxx @@ -148,7 +148,7 @@ VectorGradientNDAnisotropicDiffusionFunction::ComputeUpdate(const Neighb // Compute update value for (k = 0; k < VectorDimension; ++k) { - delta[k] = NumericTraits::ZeroValue(); + delta[k] = ScalarValueType{}; for (i = 0; i < ImageDimension; ++i) { diff --git a/Modules/Filtering/AntiAlias/include/itkAntiAliasBinaryImageFilter.hxx b/Modules/Filtering/AntiAlias/include/itkAntiAliasBinaryImageFilter.hxx index df03a1331e4..47e5b094dcc 100644 --- a/Modules/Filtering/AntiAlias/include/itkAntiAliasBinaryImageFilter.hxx +++ b/Modules/Filtering/AntiAlias/include/itkAntiAliasBinaryImageFilter.hxx @@ -27,7 +27,7 @@ namespace itk template AntiAliasBinaryImageFilter::AntiAliasBinaryImageFilter() : m_UpperBinaryValue(NumericTraits::OneValue()) - , m_LowerBinaryValue(NumericTraits::ZeroValue()) + , m_LowerBinaryValue(BinaryValueType{}) , m_InputImage(nullptr) { m_CurvatureFunction = CurvatureFunctionType::New(); diff --git a/Modules/Filtering/BiasCorrection/include/itkN4BiasFieldCorrectionImageFilter.hxx b/Modules/Filtering/BiasCorrection/include/itkN4BiasFieldCorrectionImageFilter.hxx index eaa13e73ad8..51be5ccbb8d 100644 --- a/Modules/Filtering/BiasCorrection/include/itkN4BiasFieldCorrectionImageFilter.hxx +++ b/Modules/Filtering/BiasCorrection/include/itkN4BiasFieldCorrectionImageFilter.hxx @@ -45,7 +45,7 @@ CLANG_SUPPRESS_Wfloat_equal template N4BiasFieldCorrectionImageFilter::N4BiasFieldCorrectionImageFilter() : m_MaskLabel(NumericTraits::OneValue()) - , m_CurrentConvergenceMeasurement(NumericTraits::ZeroValue()) + , m_CurrentConvergenceMeasurement(RealType{}) { // implicit: @@ -129,13 +129,13 @@ CLANG_SUPPRESS_Wfloat_equal for (size_t indexValue = 0; indexValue < numberOfPixels; ++indexValue) { if ((maskImageBufferRange.empty() || (useMaskLabel && maskImageBufferRange[indexValue] == maskLabel) || - (!useMaskLabel && maskImageBufferRange[indexValue] != NumericTraits::ZeroValue())) && + (!useMaskLabel && maskImageBufferRange[indexValue] != MaskPixelType{})) && (confidenceImageBufferRange.empty() || confidenceImageBufferRange[indexValue] > 0.0)) { ++numberOfIncludedPixels; auto && logInputPixel = logInputImageBufferRange[indexValue]; - if (logInputPixel > NumericTraits::ZeroValue()) + if (logInputPixel > typename InputImageType::PixelType{}) { logInputPixel = std::log(static_cast(logInputPixel)); } @@ -278,7 +278,7 @@ CLANG_SUPPRESS_Wfloat_equal for (size_t indexValue = 0; indexValue < numberOfPixels; ++indexValue) { if ((maskImageBufferRange.empty() || (useMaskLabel && maskImageBufferRange[indexValue] == maskLabel) || - (!useMaskLabel && maskImageBufferRange[indexValue] != NumericTraits::ZeroValue())) && + (!useMaskLabel && maskImageBufferRange[indexValue] != MaskPixelType{})) && (confidenceImageBufferRange.empty() || confidenceImageBufferRange[indexValue] > 0.0)) { RealType pixel = unsharpenedImageBufferRange[indexValue]; @@ -302,7 +302,7 @@ CLANG_SUPPRESS_Wfloat_equal for (size_t indexValue = 0; indexValue < numberOfPixels; ++indexValue) { if ((maskImageBufferRange.empty() || (useMaskLabel && maskImageBufferRange[indexValue] == maskLabel) || - (!useMaskLabel && maskImageBufferRange[indexValue] != NumericTraits::ZeroValue())) && + (!useMaskLabel && maskImageBufferRange[indexValue] != MaskPixelType{})) && (confidenceImageBufferRange.empty() || confidenceImageBufferRange[indexValue] > 0.0)) { RealType pixel = unsharpenedImageBufferRange[indexValue]; @@ -450,7 +450,7 @@ CLANG_SUPPRESS_Wfloat_equal for (size_t indexValue = 0; indexValue < numberOfPixels; ++indexValue) { if ((maskImageBufferRange.empty() || (useMaskLabel && maskImageBufferRange[indexValue] == maskLabel) || - (!useMaskLabel && maskImageBufferRange[indexValue] != NumericTraits::ZeroValue())) && + (!useMaskLabel && maskImageBufferRange[indexValue] != MaskPixelType{})) && (confidenceImageBufferRange.empty() || confidenceImageBufferRange[indexValue] > 0.0)) { RealType cidx = (unsharpenedImageBufferRange[indexValue] - binMinimum) / histogramSlope; @@ -519,7 +519,7 @@ CLANG_SUPPRESS_Wfloat_equal for (size_t indexValue = 0; indexValue < numberOfPixels; ++indexValue, ++It) { if ((maskImageBufferRange.empty() || (useMaskLabel && maskImageBufferRange[indexValue] == maskLabel) || - (!useMaskLabel && maskImageBufferRange[indexValue] != NumericTraits::ZeroValue())) && + (!useMaskLabel && maskImageBufferRange[indexValue] != MaskPixelType{})) && (confidenceImageBufferRange.empty() || confidenceImageBufferRange[indexValue] > 0.0)) { PointType point; @@ -665,7 +665,7 @@ CLANG_SUPPRESS_Wfloat_equal for (size_t indexValue = 0; indexValue < numberOfPixels; ++indexValue) { if ((maskImageBufferRange.empty() || (useMaskLabel && maskImageBufferRange[indexValue] == maskLabel) || - (!useMaskLabel && maskImageBufferRange[indexValue] != NumericTraits::ZeroValue())) && + (!useMaskLabel && maskImageBufferRange[indexValue] != MaskPixelType{})) && (confidenceImageBufferRange.empty() || confidenceImageBufferRange[indexValue] > 0.0)) { RealType pixel = std::exp(subtracterImageBufferRange[indexValue]); diff --git a/Modules/Filtering/BinaryMathematicalMorphology/include/itkBinaryMorphologicalOpeningImageFilter.hxx b/Modules/Filtering/BinaryMathematicalMorphology/include/itkBinaryMorphologicalOpeningImageFilter.hxx index 6e7ce784c23..065cb7162c8 100644 --- a/Modules/Filtering/BinaryMathematicalMorphology/include/itkBinaryMorphologicalOpeningImageFilter.hxx +++ b/Modules/Filtering/BinaryMathematicalMorphology/include/itkBinaryMorphologicalOpeningImageFilter.hxx @@ -37,7 +37,7 @@ template BinaryMorphologicalOpeningImageFilter::BinaryMorphologicalOpeningImageFilter() { m_ForegroundValue = NumericTraits::max(); - m_BackgroundValue = NumericTraits::ZeroValue(); + m_BackgroundValue = PixelType{}; } template diff --git a/Modules/Filtering/BinaryMathematicalMorphology/include/itkBinaryOpeningByReconstructionImageFilter.hxx b/Modules/Filtering/BinaryMathematicalMorphology/include/itkBinaryOpeningByReconstructionImageFilter.hxx index bf23ff3156b..b56d6b65282 100644 --- a/Modules/Filtering/BinaryMathematicalMorphology/include/itkBinaryOpeningByReconstructionImageFilter.hxx +++ b/Modules/Filtering/BinaryMathematicalMorphology/include/itkBinaryOpeningByReconstructionImageFilter.hxx @@ -29,7 +29,7 @@ template BinaryOpeningByReconstructionImageFilter::BinaryOpeningByReconstructionImageFilter() { m_ForegroundValue = NumericTraits::max(); - m_BackgroundValue = NumericTraits::ZeroValue(); + m_BackgroundValue = PixelType{}; m_FullyConnected = false; } diff --git a/Modules/Filtering/BinaryMathematicalMorphology/include/itkBinaryThinningImageFilter.hxx b/Modules/Filtering/BinaryMathematicalMorphology/include/itkBinaryThinningImageFilter.hxx index 1ea2f32e5f3..36c943ce6cd 100644 --- a/Modules/Filtering/BinaryMathematicalMorphology/include/itkBinaryThinningImageFilter.hxx +++ b/Modules/Filtering/BinaryMathematicalMorphology/include/itkBinaryThinningImageFilter.hxx @@ -81,7 +81,7 @@ BinaryThinningImageFilter::PrepareData() } else { - ot.Set(NumericTraits::ZeroValue()); + ot.Set(OutputImagePixelType{}); } ++it; ++ot; diff --git a/Modules/Filtering/BinaryMathematicalMorphology/include/itkErodeObjectMorphologyImageFilter.hxx b/Modules/Filtering/BinaryMathematicalMorphology/include/itkErodeObjectMorphologyImageFilter.hxx index e4267434cf2..f980da7ce73 100644 --- a/Modules/Filtering/BinaryMathematicalMorphology/include/itkErodeObjectMorphologyImageFilter.hxx +++ b/Modules/Filtering/BinaryMathematicalMorphology/include/itkErodeObjectMorphologyImageFilter.hxx @@ -24,7 +24,7 @@ namespace itk template ErodeObjectMorphologyImageFilter::ErodeObjectMorphologyImageFilter() { - m_BackgroundValue = NumericTraits::ZeroValue(); + m_BackgroundValue = PixelType{}; m_ErodeBoundaryCondition.SetConstant(NumericTraits::max()); this->OverrideBoundaryCondition(&m_ErodeBoundaryCondition); diff --git a/Modules/Filtering/BinaryMathematicalMorphology/include/itkObjectMorphologyImageFilter.hxx b/Modules/Filtering/BinaryMathematicalMorphology/include/itkObjectMorphologyImageFilter.hxx index 9b17f0f04b3..e5d3e1e37e8 100644 --- a/Modules/Filtering/BinaryMathematicalMorphology/include/itkObjectMorphologyImageFilter.hxx +++ b/Modules/Filtering/BinaryMathematicalMorphology/include/itkObjectMorphologyImageFilter.hxx @@ -32,7 +32,7 @@ template ObjectMorphologyImageFilter::ObjectMorphologyImageFilter() : m_Kernel() { - m_DefaultBoundaryCondition.SetConstant(NumericTraits::ZeroValue()); + m_DefaultBoundaryCondition.SetConstant(PixelType{}); m_BoundaryCondition = &m_DefaultBoundaryCondition; m_UseBoundaryCondition = false; @@ -92,7 +92,7 @@ template void ObjectMorphologyImageFilter::BeforeThreadedGenerateData() { - if (Math::ExactlyEquals(m_ObjectValue, NumericTraits::ZeroValue())) + if (Math::ExactlyEquals(m_ObjectValue, typename TInputImage::PixelType{})) { this->GetOutput()->FillBuffer(1); } diff --git a/Modules/Filtering/Convolution/include/itkConvolutionImageFilter.hxx b/Modules/Filtering/Convolution/include/itkConvolutionImageFilter.hxx index 9e5f67013c3..9f608da5842 100644 --- a/Modules/Filtering/Convolution/include/itkConvolutionImageFilter.hxx +++ b/Modules/Filtering/Convolution/include/itkConvolutionImageFilter.hxx @@ -106,7 +106,7 @@ ConvolutionImageFilter::ComputeConvolut // Pad the kernel if necessary to an odd size in each dimension. using PadImageFilterType = ConstantPadImageFilter; auto kernelPadImageFilter = PadImageFilterType::New(); - kernelPadImageFilter->SetConstant(NumericTraits::ZeroValue()); + kernelPadImageFilter->SetConstant(KernelImagePixelType{}); kernelPadImageFilter->SetPadLowerBound(this->GetKernelPadSize()); kernelPadImageFilter->SetNumberOfWorkUnits(this->GetNumberOfWorkUnits()); kernelPadImageFilter->ReleaseDataFlagOn(); diff --git a/Modules/Filtering/Convolution/include/itkFFTConvolutionImageFilter.hxx b/Modules/Filtering/Convolution/include/itkFFTConvolutionImageFilter.hxx index 7219745fa8e..deb9cae1738 100644 --- a/Modules/Filtering/Convolution/include/itkFFTConvolutionImageFilter.hxx +++ b/Modules/Filtering/Convolution/include/itkFFTConvolutionImageFilter.hxx @@ -363,7 +363,7 @@ FFTConvolutionImageFilter; using KernelPadPointer = typename KernelPadType::Pointer; KernelPadPointer kernelPadder = KernelPadType::New(); - kernelPadder->SetConstant(NumericTraits::ZeroValue()); + kernelPadder->SetConstant(TInternalPrecision{}); kernelPadder->SetPadUpperBound(kernelUpperBound); kernelPadder->SetNumberOfWorkUnits(this->GetNumberOfWorkUnits()); kernelPadder->SetInput(normalizeFilter->GetOutput()); @@ -378,7 +378,7 @@ FFTConvolutionImageFilter; using KernelPadPointer = typename KernelPadType::Pointer; KernelPadPointer kernelPadder = KernelPadType::New(); - kernelPadder->SetConstant(NumericTraits::ZeroValue()); + kernelPadder->SetConstant(TInternalPrecision{}); kernelPadder->SetPadUpperBound(kernelUpperBound); kernelPadder->SetNumberOfWorkUnits(this->GetNumberOfWorkUnits()); kernelPadder->SetInput(kernel); diff --git a/Modules/Filtering/Convolution/include/itkNormalizedCorrelationImageFilter.hxx b/Modules/Filtering/Convolution/include/itkNormalizedCorrelationImageFilter.hxx index 1861eb54302..e7ab4a5ace6 100644 --- a/Modules/Filtering/Convolution/include/itkNormalizedCorrelationImageFilter.hxx +++ b/Modules/Filtering/Convolution/include/itkNormalizedCorrelationImageFilter.hxx @@ -157,7 +157,7 @@ NormalizedCorrelationImageFilter::ZeroValue(); + OutputPixelRealType zero = OutputPixelType{}; realTemplateSize = static_cast(templateSize); for (const auto & face : faceList) diff --git a/Modules/Filtering/CurvatureFlow/include/itkBinaryMinMaxCurvatureFlowFunction.hxx b/Modules/Filtering/CurvatureFlow/include/itkBinaryMinMaxCurvatureFlowFunction.hxx index e39aebe3fb7..7579f1e1c90 100644 --- a/Modules/Filtering/CurvatureFlow/include/itkBinaryMinMaxCurvatureFlowFunction.hxx +++ b/Modules/Filtering/CurvatureFlow/include/itkBinaryMinMaxCurvatureFlowFunction.hxx @@ -49,11 +49,11 @@ BinaryMinMaxCurvatureFlowFunction::ComputeUpdate(const NeighborhoodType if (avgValue < m_Threshold) { - return (std::min(update, NumericTraits::ZeroValue())); + return (std::min(update, PixelType{})); } else { - return (std::max(update, NumericTraits::ZeroValue())); + return (std::max(update, PixelType{})); } } } // end namespace itk diff --git a/Modules/Filtering/CurvatureFlow/include/itkCurvatureFlowFunction.h b/Modules/Filtering/CurvatureFlow/include/itkCurvatureFlowFunction.h index 6deb7772473..7fc0e0643e3 100644 --- a/Modules/Filtering/CurvatureFlow/include/itkCurvatureFlowFunction.h +++ b/Modules/Filtering/CurvatureFlow/include/itkCurvatureFlowFunction.h @@ -95,7 +95,7 @@ class ITK_TEMPLATE_EXPORT CurvatureFlowFunction : public FiniteDifferenceFunctio { auto * ans = new GlobalDataStruct(); - ans->m_MaxChange = NumericTraits::ZeroValue(); + ans->m_MaxChange = ScalarValueType{}; return ans; } @@ -136,7 +136,7 @@ class ITK_TEMPLATE_EXPORT CurvatureFlowFunction : public FiniteDifferenceFunctio * values that are needed in calculating the time step. */ struct GlobalDataStruct { - GlobalDataStruct() { m_MaxChange = NumericTraits::ZeroValue(); } + GlobalDataStruct() { m_MaxChange = ScalarValueType{}; } ~GlobalDataStruct() = default; diff --git a/Modules/Filtering/CurvatureFlow/include/itkCurvatureFlowFunction.hxx b/Modules/Filtering/CurvatureFlow/include/itkCurvatureFlowFunction.hxx index 0b0173559eb..86686c838ab 100644 --- a/Modules/Filtering/CurvatureFlow/include/itkCurvatureFlowFunction.hxx +++ b/Modules/Filtering/CurvatureFlow/include/itkCurvatureFlowFunction.hxx @@ -95,7 +95,7 @@ CurvatureFlowFunction::ComputeUpdate(const NeighborhoodType & it, if (magnitudeSqr < 1e-9) { - return NumericTraits::ZeroValue(); + return PixelType{}; } // compute the update value = mean curvature * magnitude diff --git a/Modules/Filtering/CurvatureFlow/include/itkMinMaxCurvatureFlowFunction.hxx b/Modules/Filtering/CurvatureFlow/include/itkMinMaxCurvatureFlowFunction.hxx index 40621e7c186..f35b5d4ca81 100644 --- a/Modules/Filtering/CurvatureFlow/include/itkMinMaxCurvatureFlowFunction.hxx +++ b/Modules/Filtering/CurvatureFlow/include/itkMinMaxCurvatureFlowFunction.hxx @@ -78,7 +78,7 @@ MinMaxCurvatureFlowFunction::InitializeStencilOperator() for (opIter = m_StencilOperator.Begin(); opIter < opEnd; ++opIter) { - *opIter = NumericTraits::ZeroValue(); + *opIter = PixelType{}; RadiusValueType length = 0; for (j = 0; j < ImageDimension; ++j) @@ -131,7 +131,7 @@ MinMaxCurvatureFlowFunction::ComputeThreshold(const DispatchBase &, cons center = it.Size() / 2; - gradMagnitude = NumericTraits::ZeroValue(); + gradMagnitude = PixelType{}; for (j = 0; j < ImageDimension; ++j) { stride = it.GetStride((SizeValueType)j); @@ -339,7 +339,7 @@ MinMaxCurvatureFlowFunction::ComputeThreshold(const Dispatch<3> &, const } theta = std::acos(gradient[2]); - if (Math::AlmostEquals(gradient[0], NumericTraits::ZeroValue())) + if (Math::AlmostEquals(gradient[0], PixelType{})) { phi = Math::pi * 0.5; } @@ -412,11 +412,11 @@ MinMaxCurvatureFlowFunction::ComputeUpdate(const NeighborhoodType & it, if (avgValue < threshold) { - return (std::max(update, NumericTraits::ZeroValue())); + return (std::max(update, PixelType{})); } else { - return (std::min(update, NumericTraits::ZeroValue())); + return (std::min(update, PixelType{})); } } } // end namespace itk diff --git a/Modules/Filtering/Denoising/include/itkPatchBasedDenoisingImageFilter.hxx b/Modules/Filtering/Denoising/include/itkPatchBasedDenoisingImageFilter.hxx index 818fe945293..3b6b61cfeca 100644 --- a/Modules/Filtering/Denoising/include/itkPatchBasedDenoisingImageFilter.hxx +++ b/Modules/Filtering/Denoising/include/itkPatchBasedDenoisingImageFilter.hxx @@ -401,7 +401,7 @@ PatchBasedDenoisingImageFilter::EnforceConstraints() { for (unsigned int ic = 0; ic < m_NumIndependentComponents; ++ic) { - if (m_ImageMin[ic] < NumericTraits::ZeroValue()) + if (m_ImageMin[ic] < PixelValueType{}) { itkExceptionMacro("When using POISSON or RICIAN noise models, " << "all components of all pixels in the image must " @@ -879,9 +879,9 @@ PatchBasedDenoisingImageFilter::Compute3x3EigenAnalys // If these occur, default to the standard eigen analysis. // These basically enforce that the spdMatrix is in fact // symmetric positive definite. - if ((I3 < NumericTraits::epsilon()) || (D0 < NumericTraits::ZeroValue()) || - (D3 < NumericTraits::ZeroValue()) || (D5 < NumericTraits::ZeroValue()) || - (D0 * D3 < DSq1) || (D0 * D5 < DSq2) || (D3 * D5 < DSq4) || (n < NumericTraits::epsilon())) + if ((I3 < NumericTraits::epsilon()) || (D0 < RealTensorValueT{}) || (D3 < RealTensorValueT{}) || + (D5 < RealTensorValueT{}) || (D0 * D3 < DSq1) || (D0 * D5 < DSq2) || (D3 * D5 < DSq4) || + (n < NumericTraits::epsilon())) { spdMatrix.ComputeEigenAnalysis(eigenVals, eigenVecs); return; @@ -1852,8 +1852,7 @@ PatchBasedDenoisingImageFilter::ResolveSigmaUpdate() // If second derivative is zero or negative, compute update using gradient // descent - if ((Math::ExactlyEquals(itk::Math::abs(secondDerivative), NumericTraits::ZeroValue())) || - (secondDerivative < 0)) + if ((Math::ExactlyEquals(itk::Math::abs(secondDerivative), RealValueType{})) || (secondDerivative < 0)) { itkDebugMacro("** Second derivative NOT POSITIVE"); sigmaUpdate[ic] = -itk::Math::sgn(firstDerivative) * kernelSigma * 0.3; diff --git a/Modules/Filtering/DiffusionTensorImage/include/itkDiffusionTensor3DReconstructionImageFilter.hxx b/Modules/Filtering/DiffusionTensorImage/include/itkDiffusionTensor3DReconstructionImageFilter.hxx index 1461d6771b7..57d5cc73366 100644 --- a/Modules/Filtering/DiffusionTensorImage/include/itkDiffusionTensor3DReconstructionImageFilter.hxx +++ b/Modules/Filtering/DiffusionTensorImage/include/itkDiffusionTensor3DReconstructionImageFilter.hxx @@ -244,14 +244,13 @@ DiffusionTensor3DReconstructionImageFilterIsInsideInWorldSpace(point); } - if (Math::NotAlmostEquals(b0, itk::NumericTraits::ZeroValue()) && unmaskedPixel && - (b0 >= m_Threshold)) + if (Math::NotAlmostEquals(b0, ReferencePixelType{}) && unmaskedPixel && (b0 >= m_Threshold)) { for (unsigned int i = 0; i < m_NumberOfGradientDirections; ++i) { GradientPixelType b = gradientItContainer[i]->Get(); - if (Math::AlmostEquals(b, itk::NumericTraits::ZeroValue())) + if (Math::AlmostEquals(b, GradientPixelType{})) { B[i] = 0; } @@ -338,7 +337,7 @@ DiffusionTensor3DReconstructionImageFilter::AccumulateType b0 = NumericTraits::ZeroValue(); + typename NumericTraits::AccumulateType b0 = ReferencePixelType{}; // Average the baseline image pixels for (const auto & i : baselineind) @@ -363,12 +362,11 @@ DiffusionTensor3DReconstructionImageFilterIsInsideInWorldSpace(point); } - if (Math::NotAlmostEquals(b0, NumericTraits::ZeroValue()) && unmaskedPixel && - (b0 >= m_Threshold)) + if (Math::NotAlmostEquals(b0, ReferencePixelType{}) && unmaskedPixel && (b0 >= m_Threshold)) { for (unsigned int i = 0; i < m_NumberOfGradientDirections; ++i) { - if (Math::AlmostEquals(b[gradientind[i]], NumericTraits::ZeroValue())) + if (Math::AlmostEquals(b[gradientind[i]], typename GradientVectorType::ValueType{})) { B[i] = 0; } diff --git a/Modules/Filtering/DisplacementField/include/itkInvertDisplacementFieldImageFilter.hxx b/Modules/Filtering/DisplacementField/include/itkInvertDisplacementFieldImageFilter.hxx index 94b1d7bf9b5..fc119466a09 100644 --- a/Modules/Filtering/DisplacementField/include/itkInvertDisplacementFieldImageFilter.hxx +++ b/Modules/Filtering/DisplacementField/include/itkInvertDisplacementFieldImageFilter.hxx @@ -125,8 +125,8 @@ InvertDisplacementFieldImageFilter::GenerateData() this->m_ComposedField->DisconnectPipeline(); // Multithread processing to multiply each element of the composed field by 1 / spacing - this->m_MeanErrorNorm = NumericTraits::ZeroValue(); - this->m_MaxErrorNorm = NumericTraits::ZeroValue(); + this->m_MeanErrorNorm = RealType{}; + this->m_MaxErrorNorm = RealType{}; float newProgress = static_cast(2 * iteration - 1) / (2 * m_MaximumNumberOfIterations); ProgressTransformer pt(oldProgress, newProgress, this); diff --git a/Modules/Filtering/DisplacementField/include/itkTimeVaryingVelocityFieldIntegrationImageFilter.hxx b/Modules/Filtering/DisplacementField/include/itkTimeVaryingVelocityFieldIntegrationImageFilter.hxx index aa119364552..c155272554c 100644 --- a/Modules/Filtering/DisplacementField/include/itkTimeVaryingVelocityFieldIntegrationImageFilter.hxx +++ b/Modules/Filtering/DisplacementField/include/itkTimeVaryingVelocityFieldIntegrationImageFilter.hxx @@ -137,7 +137,7 @@ TimeVaryingVelocityFieldIntegrationImageFilterm_LowerTimeBound, this->m_UpperTimeBound) || this->m_NumberOfIntegrationSteps == 0) { - this->GetOutput()->FillBuffer(itk::NumericTraits::ZeroValue()); + this->GetOutput()->FillBuffer(typename DisplacementFieldType::PixelType{}); return; } diff --git a/Modules/Filtering/DisplacementField/test/itkTransformToDisplacementFieldFilterTest1.cxx b/Modules/Filtering/DisplacementField/test/itkTransformToDisplacementFieldFilterTest1.cxx index b0e02c6ae0d..4e346c0633f 100644 --- a/Modules/Filtering/DisplacementField/test/itkTransformToDisplacementFieldFilterTest1.cxx +++ b/Modules/Filtering/DisplacementField/test/itkTransformToDisplacementFieldFilterTest1.cxx @@ -106,7 +106,7 @@ itkTransformToDisplacementFieldFilterTest1(int argc, char * argv[]) image->SetSpacing(spacing); image->SetOrigin(origin); image->SetDirection(inputDirection); - image->FillBuffer(itk::NumericTraits::ZeroValue()); + image->FillBuffer(ScalarPixelType{}); float incrValue = 100.0; IndexType pixelIndex; diff --git a/Modules/Filtering/DistanceMap/include/itkContourDirectedMeanDistanceImageFilter.hxx b/Modules/Filtering/DistanceMap/include/itkContourDirectedMeanDistanceImageFilter.hxx index ff943aba27b..4fbe2ce262c 100644 --- a/Modules/Filtering/DistanceMap/include/itkContourDirectedMeanDistanceImageFilter.hxx +++ b/Modules/Filtering/DistanceMap/include/itkContourDirectedMeanDistanceImageFilter.hxx @@ -41,7 +41,7 @@ ContourDirectedMeanDistanceImageFilter::ContourDirec m_UseImageSpacing = true; m_DistanceMap = nullptr; - m_ContourDirectedMeanDistance = NumericTraits::ZeroValue(); + m_ContourDirectedMeanDistance = RealType{}; this->DynamicMultiThreadingOff(); } @@ -124,7 +124,7 @@ ContourDirectedMeanDistanceImageFilter::BeforeThread m_Count.SetSize(numberOfWorkUnits); // Initialize the temporaries - m_MeanDistance.Fill(NumericTraits::ZeroValue()); + m_MeanDistance.Fill(RealType{}); m_Count.Fill(0); // Compute Signed distance from non-zero pixels in the second image @@ -161,7 +161,7 @@ ContourDirectedMeanDistanceImageFilter::AfterThreade } else { - m_ContourDirectedMeanDistance = NumericTraits::ZeroValue(); + m_ContourDirectedMeanDistance = RealType{}; } } @@ -204,7 +204,7 @@ ContourDirectedMeanDistanceImageFilter::ThreadedGene { // First test // If current pixel is not on, let's continue - if (Math::NotExactlyEquals(bit.GetCenterPixel(), NumericTraits::ZeroValue())) + if (Math::NotExactlyEquals(bit.GetCenterPixel(), InputImage1PixelType{})) { bool bIsOnContour = false; @@ -212,7 +212,7 @@ ContourDirectedMeanDistanceImageFilter::ThreadedGene { // Second test if at least one neighbour pixel is off // the center pixel belongs to contour - if (Math::ExactlyEquals(bit.GetPixel(i), NumericTraits::ZeroValue())) + if (Math::ExactlyEquals(bit.GetPixel(i), InputImage1PixelType{})) { bIsOnContour = true; break; diff --git a/Modules/Filtering/DistanceMap/include/itkContourMeanDistanceImageFilter.hxx b/Modules/Filtering/DistanceMap/include/itkContourMeanDistanceImageFilter.hxx index ba5c51bec18..94c460cc170 100644 --- a/Modules/Filtering/DistanceMap/include/itkContourMeanDistanceImageFilter.hxx +++ b/Modules/Filtering/DistanceMap/include/itkContourMeanDistanceImageFilter.hxx @@ -31,7 +31,7 @@ ContourMeanDistanceImageFilter::ContourMeanDistanceI // this filter requires two input images this->SetNumberOfRequiredInputs(2); - m_MeanDistance = NumericTraits::ZeroValue(); + m_MeanDistance = RealType{}; m_UseImageSpacing = true; } diff --git a/Modules/Filtering/DistanceMap/include/itkDirectedHausdorffDistanceImageFilter.hxx b/Modules/Filtering/DistanceMap/include/itkDirectedHausdorffDistanceImageFilter.hxx index e91d0207136..7d23a4e741c 100644 --- a/Modules/Filtering/DistanceMap/include/itkDirectedHausdorffDistanceImageFilter.hxx +++ b/Modules/Filtering/DistanceMap/include/itkDirectedHausdorffDistanceImageFilter.hxx @@ -111,7 +111,7 @@ void DirectedHausdorffDistanceImageFilter::BeforeThreadedGenerateData() { // initialize accumulators - m_MaxDistance = NumericTraits::ZeroValue(); + m_MaxDistance = RealType{}; m_PixelCount = 0; m_Sum = 0; @@ -168,11 +168,11 @@ DirectedHausdorffDistanceImageFilter::DynamicThreade // do the work while (!it1.IsAtEnd()) { - if (Math::NotExactlyEquals(it1.Get(), NumericTraits::ZeroValue())) + if (Math::NotExactlyEquals(it1.Get(), InputImage1PixelType{})) { // The signed distance map is calculated, but we want the calculation based on the // unsigned int distance map. Therefore, we set all distance map values less than 0 to 0. - const RealType val2 = std::max(static_cast(it2.Get()), NumericTraits::ZeroValue()); + const RealType val2 = std::max(static_cast(it2.Get()), RealType{}); maxDistance = std::max(maxDistance, val2); sum += val2; ++pixelCount; diff --git a/Modules/Filtering/DistanceMap/include/itkHausdorffDistanceImageFilter.hxx b/Modules/Filtering/DistanceMap/include/itkHausdorffDistanceImageFilter.hxx index 6810c7b1334..cc2856c13f8 100644 --- a/Modules/Filtering/DistanceMap/include/itkHausdorffDistanceImageFilter.hxx +++ b/Modules/Filtering/DistanceMap/include/itkHausdorffDistanceImageFilter.hxx @@ -30,8 +30,8 @@ HausdorffDistanceImageFilter::HausdorffDistanceImage // this filter requires two input images this->SetNumberOfRequiredInputs(2); - m_HausdorffDistance = NumericTraits::ZeroValue(); - m_AverageHausdorffDistance = NumericTraits::ZeroValue(); + m_HausdorffDistance = RealType{}; + m_AverageHausdorffDistance = RealType{}; m_UseImageSpacing = true; } diff --git a/Modules/Filtering/DistanceMap/include/itkIsoContourDistanceImageFilter.hxx b/Modules/Filtering/DistanceMap/include/itkIsoContourDistanceImageFilter.hxx index 2489db1d7f7..a7cead5271b 100644 --- a/Modules/Filtering/DistanceMap/include/itkIsoContourDistanceImageFilter.hxx +++ b/Modules/Filtering/DistanceMap/include/itkIsoContourDistanceImageFilter.hxx @@ -28,7 +28,7 @@ namespace itk template IsoContourDistanceImageFilter::IsoContourDistanceImageFilter() { - m_LevelSetValue = NumericTraits::ZeroValue(); + m_LevelSetValue = InputPixelType{}; m_FarValue = 10 * NumericTraits::OneValue(); @@ -204,7 +204,7 @@ IsoContourDistanceImageFilter::ThreadedGenerateData( } else { - outIt.Set(NumericTraits::ZeroValue()); + outIt.Set(PixelType{}); } ++inIt; ++outIt; diff --git a/Modules/Filtering/DistanceMap/include/itkSignedDanielssonDistanceMapImageFilter.h b/Modules/Filtering/DistanceMap/include/itkSignedDanielssonDistanceMapImageFilter.h index cdd32582159..2399ada7aa5 100644 --- a/Modules/Filtering/DistanceMap/include/itkSignedDanielssonDistanceMapImageFilter.h +++ b/Modules/Filtering/DistanceMap/include/itkSignedDanielssonDistanceMapImageFilter.h @@ -35,7 +35,7 @@ class ITK_TEMPLATE_EXPORT InvertIntensityFunctor { if (input) { - return NumericTraits::ZeroValue(); + return InputPixelType{}; } else { diff --git a/Modules/Filtering/DistanceMap/include/itkSignedMaurerDistanceMapImageFilter.hxx b/Modules/Filtering/DistanceMap/include/itkSignedMaurerDistanceMapImageFilter.hxx index 794fdc3f080..7eb30664d00 100644 --- a/Modules/Filtering/DistanceMap/include/itkSignedMaurerDistanceMapImageFilter.hxx +++ b/Modules/Filtering/DistanceMap/include/itkSignedMaurerDistanceMapImageFilter.hxx @@ -31,7 +31,7 @@ namespace itk { template SignedMaurerDistanceMapImageFilter::SignedMaurerDistanceMapImageFilter() - : m_BackgroundValue(NumericTraits::ZeroValue()) + : m_BackgroundValue(InputPixelType{}) , m_Spacing() , m_InputCache(nullptr) { @@ -126,7 +126,7 @@ SignedMaurerDistanceMapImageFilter::GenerateData() binaryFilter->SetLowerThreshold(this->m_BackgroundValue); binaryFilter->SetUpperThreshold(this->m_BackgroundValue); binaryFilter->SetInsideValue(NumericTraits::max()); - binaryFilter->SetOutsideValue(NumericTraits::ZeroValue()); + binaryFilter->SetOutsideValue(OutputPixelType{}); binaryFilter->SetInput(inputPtr); binaryFilter->SetNumberOfWorkUnits(numberOfWorkUnits); progressAcc->RegisterInternalFilter(binaryFilter, 0.1f); @@ -138,7 +138,7 @@ SignedMaurerDistanceMapImageFilter::GenerateData() using BorderFilterType = BinaryContourImageFilter; auto borderFilter = BorderFilterType::New(); borderFilter->SetInput(binaryFilter->GetOutput()); - borderFilter->SetForegroundValue(NumericTraits::ZeroValue()); + borderFilter->SetForegroundValue(OutputPixelType{}); borderFilter->SetBackgroundValue(NumericTraits::max()); borderFilter->SetFullyConnected(true); borderFilter->SetNumberOfWorkUnits(numberOfWorkUnits); diff --git a/Modules/Filtering/DistanceMap/test/itkContourDirectedMeanDistanceImageFilterTest.cxx b/Modules/Filtering/DistanceMap/test/itkContourDirectedMeanDistanceImageFilterTest.cxx index 48d24b118b2..7b282c11e5d 100644 --- a/Modules/Filtering/DistanceMap/test/itkContourDirectedMeanDistanceImageFilterTest.cxx +++ b/Modules/Filtering/DistanceMap/test/itkContourDirectedMeanDistanceImageFilterTest.cxx @@ -44,8 +44,8 @@ itkContourDirectedMeanDistanceImageFilterTest(int, char *[]) image1->Allocate(); image2->Allocate(); - image1->FillBuffer(itk::NumericTraits::ZeroValue()); - image2->FillBuffer(itk::NumericTraits::ZeroValue()); + image1->FillBuffer(Pixel1Type{}); + image2->FillBuffer(Pixel2Type{}); using RegionType = Image1Type::RegionType; RegionType region1; diff --git a/Modules/Filtering/DistanceMap/test/itkContourMeanDistanceImageFilterTest.cxx b/Modules/Filtering/DistanceMap/test/itkContourMeanDistanceImageFilterTest.cxx index 255570c2404..5af57e853d8 100644 --- a/Modules/Filtering/DistanceMap/test/itkContourMeanDistanceImageFilterTest.cxx +++ b/Modules/Filtering/DistanceMap/test/itkContourMeanDistanceImageFilterTest.cxx @@ -52,8 +52,8 @@ itkContourMeanDistanceImageFilterTest(int argc, char * argv[]) image1->Allocate(); image2->Allocate(); - image1->FillBuffer(itk::NumericTraits::ZeroValue()); - image2->FillBuffer(itk::NumericTraits::ZeroValue()); + image1->FillBuffer(Pixel1Type{}); + image2->FillBuffer(Pixel2Type{}); using RegionType = Image1Type::RegionType; RegionType region1; diff --git a/Modules/Filtering/DistanceMap/test/itkDirectedHausdorffDistanceImageFilterTest1.cxx b/Modules/Filtering/DistanceMap/test/itkDirectedHausdorffDistanceImageFilterTest1.cxx index 38058484de9..9e8bf94895a 100644 --- a/Modules/Filtering/DistanceMap/test/itkDirectedHausdorffDistanceImageFilterTest1.cxx +++ b/Modules/Filtering/DistanceMap/test/itkDirectedHausdorffDistanceImageFilterTest1.cxx @@ -44,8 +44,8 @@ itkDirectedHausdorffDistanceImageFilterTest1(int, char *[]) image1->Allocate(); image2->Allocate(); - image1->FillBuffer(itk::NumericTraits::ZeroValue()); - image2->FillBuffer(itk::NumericTraits::ZeroValue()); + image1->FillBuffer(Pixel1Type{}); + image2->FillBuffer(Pixel2Type{}); using RegionType = Image1Type::RegionType; RegionType region1; diff --git a/Modules/Filtering/DistanceMap/test/itkHausdorffDistanceImageFilterTest.cxx b/Modules/Filtering/DistanceMap/test/itkHausdorffDistanceImageFilterTest.cxx index 24942a10068..e8b82095b52 100644 --- a/Modules/Filtering/DistanceMap/test/itkHausdorffDistanceImageFilterTest.cxx +++ b/Modules/Filtering/DistanceMap/test/itkHausdorffDistanceImageFilterTest.cxx @@ -50,8 +50,8 @@ itkHausdorffDistanceImageFilterTest(int argc, char * argv[]) image1->Allocate(); image2->Allocate(); - image1->FillBuffer(itk::NumericTraits::ZeroValue()); - image2->FillBuffer(itk::NumericTraits::ZeroValue()); + image1->FillBuffer(Pixel1Type{}); + image2->FillBuffer(Pixel2Type{}); using RegionType = Image1Type::RegionType; RegionType region1; diff --git a/Modules/Filtering/DistanceMap/test/itkReflectiveImageRegionIteratorTest.cxx b/Modules/Filtering/DistanceMap/test/itkReflectiveImageRegionIteratorTest.cxx index fc0b5840437..4b7595e827c 100644 --- a/Modules/Filtering/DistanceMap/test/itkReflectiveImageRegionIteratorTest.cxx +++ b/Modules/Filtering/DistanceMap/test/itkReflectiveImageRegionIteratorTest.cxx @@ -64,7 +64,7 @@ itkReflectiveImageRegionIteratorTest(int, char *[]) // set the pixel index as value nit.Set(nit.GetIndex()); // Set the number of visits to zero - vit.Set(itk::NumericTraits::ZeroValue()); + vit.Set(ImageVisitsType::PixelType{}); ++nit; ++vit; } diff --git a/Modules/Filtering/FFT/test/itkRealFFTTest.h b/Modules/Filtering/FFT/test/itkRealFFTTest.h index 39b7ae5c187..23ca317bce8 100644 --- a/Modules/Filtering/FFT/test/itkRealFFTTest.h +++ b/Modules/Filtering/FFT/test/itkRealFFTTest.h @@ -203,7 +203,7 @@ test_fft(unsigned int * SizeOfDimensions) TPixel val = originalImageIterator.Value(); TPixel val2 = inverseFFTImageIterator.Value(); TPixel diff = itk::Math::abs(val - val2); - if (itk::Math::NotAlmostEquals(val, itk::NumericTraits::ZeroValue())) + if (itk::Math::NotAlmostEquals(val, TPixel{})) { diff /= itk::Math::abs(val); } diff --git a/Modules/Filtering/FastMarching/include/itkFastMarchingBase.hxx b/Modules/Filtering/FastMarching/include/itkFastMarchingBase.hxx index 7d4e3455911..91442ce67dc 100644 --- a/Modules/Filtering/FastMarching/include/itkFastMarchingBase.hxx +++ b/Modules/Filtering/FastMarching/include/itkFastMarchingBase.hxx @@ -40,7 +40,7 @@ FastMarchingBase::FastMarchingBase() m_SpeedConstant = 1.; m_InverseSpeed = -1.; m_NormalizationFactor = 1.; - m_TargetReachedValue = NumericTraits::ZeroValue(); + m_TargetReachedValue = OutputPixelType{}; m_TopologyCheck = TopologyCheckEnum::Nothing; m_LargeValue = NumericTraits::max(); m_TopologyValue = m_LargeValue; diff --git a/Modules/Filtering/FastMarching/include/itkFastMarchingExtensionImageFilter.hxx b/Modules/Filtering/FastMarching/include/itkFastMarchingExtensionImageFilter.hxx index 7714af3247a..fee2a254da1 100644 --- a/Modules/Filtering/FastMarching/include/itkFastMarchingExtensionImageFilter.hxx +++ b/Modules/Filtering/FastMarching/include/itkFastMarchingExtensionImageFilter.hxx @@ -249,7 +249,7 @@ FastMarchingExtensionImageFilter::ZeroValue(); + auxVal = AuxValueType{}; } this->GetAuxiliaryImage(k)->SetPixel(index, auxVal); diff --git a/Modules/Filtering/FastMarching/include/itkFastMarchingExtensionImageFilterBase.hxx b/Modules/Filtering/FastMarching/include/itkFastMarchingExtensionImageFilterBase.hxx index db9a555cba2..31f42ad9a3d 100644 --- a/Modules/Filtering/FastMarching/include/itkFastMarchingExtensionImageFilterBase.hxx +++ b/Modules/Filtering/FastMarching/include/itkFastMarchingExtensionImageFilterBase.hxx @@ -258,7 +258,7 @@ FastMarchingExtensionImageFilterBase: } else { - auxVal = NumericTraits::ZeroValue(); + auxVal = AuxValueType{}; } this->m_AuxImages[k]->SetPixel(iNode, auxVal); diff --git a/Modules/Filtering/FastMarching/include/itkFastMarchingImageToNodePairContainerAdaptor.hxx b/Modules/Filtering/FastMarching/include/itkFastMarchingImageToNodePairContainerAdaptor.hxx index e860c6f003d..af6888ce1f8 100644 --- a/Modules/Filtering/FastMarching/include/itkFastMarchingImageToNodePairContainerAdaptor.hxx +++ b/Modules/Filtering/FastMarching/include/itkFastMarchingImageToNodePairContainerAdaptor.hxx @@ -33,8 +33,8 @@ FastMarchingImageToNodePairContainerAdaptor::FastMarchi , m_AlivePoints(nullptr) , m_TrialPoints(nullptr) , m_ForbiddenPoints(nullptr) - , m_AliveValue(NumericTraits::ZeroValue()) - , m_TrialValue(NumericTraits::ZeroValue()) + , m_AliveValue(OutputPixelType{}) + , m_TrialValue(OutputPixelType{}) {} @@ -107,7 +107,7 @@ FastMarchingImageToNodePairContainerAdaptor::GenerateDa if (m_ForbiddenImage.IsNotNull()) { - SetPointsFromImage(m_ForbiddenImage, Traits::Forbidden, NumericTraits::ZeroValue()); + SetPointsFromImage(m_ForbiddenImage, Traits::Forbidden, OutputPixelType{}); is_ok = true; } @@ -138,7 +138,7 @@ FastMarchingImageToNodePairContainerAdaptor::SetPointsF for (it.GoToBegin(); !it.IsAtEnd(); ++it) { // Test if index value is greater than zero, if so add the node - if (Math::NotAlmostEquals(it.Get(), NumericTraits::ZeroValue())) + if (Math::NotAlmostEquals(it.Get(), ImagePixelType{})) { nodes->push_back(NodePairType(it.GetIndex(), iValue)); } // end if image iterator > zero @@ -149,7 +149,7 @@ FastMarchingImageToNodePairContainerAdaptor::SetPointsF for (it.GoToBegin(); !it.IsAtEnd(); ++it) { // Test if index value is greater than zero, if so add the node - if (Math::AlmostEquals(it.Get(), NumericTraits::ZeroValue())) + if (Math::AlmostEquals(it.Get(), ImagePixelType{})) { nodes->push_back(NodePairType(it.GetIndex(), iValue)); } // end if image iterator > zero diff --git a/Modules/Filtering/FastMarching/include/itkFastMarchingNumberOfElementsStoppingCriterion.h b/Modules/Filtering/FastMarching/include/itkFastMarchingNumberOfElementsStoppingCriterion.h index 2c4aba5164a..99d2531f733 100644 --- a/Modules/Filtering/FastMarching/include/itkFastMarchingNumberOfElementsStoppingCriterion.h +++ b/Modules/Filtering/FastMarching/include/itkFastMarchingNumberOfElementsStoppingCriterion.h @@ -77,8 +77,8 @@ class ITK_TEMPLATE_EXPORT FastMarchingNumberOfElementsStoppingCriterion protected: FastMarchingNumberOfElementsStoppingCriterion() : Superclass() - , m_CurrentNumberOfElements(NumericTraits::ZeroValue()) - , m_TargetNumberOfElements(NumericTraits::ZeroValue()) + , m_CurrentNumberOfElements(IdentifierType{}) + , m_TargetNumberOfElements(IdentifierType{}) {} ~FastMarchingNumberOfElementsStoppingCriterion() override = default; @@ -95,7 +95,7 @@ class ITK_TEMPLATE_EXPORT FastMarchingNumberOfElementsStoppingCriterion void Reset() override { - this->m_CurrentNumberOfElements = NumericTraits::ZeroValue(); + this->m_CurrentNumberOfElements = IdentifierType{}; } }; diff --git a/Modules/Filtering/FastMarching/include/itkFastMarchingReachedTargetNodesStoppingCriterion.h b/Modules/Filtering/FastMarching/include/itkFastMarchingReachedTargetNodesStoppingCriterion.h index 6f8afbcb410..370ce204a8a 100644 --- a/Modules/Filtering/FastMarching/include/itkFastMarchingReachedTargetNodesStoppingCriterion.h +++ b/Modules/Filtering/FastMarching/include/itkFastMarchingReachedTargetNodesStoppingCriterion.h @@ -177,8 +177,8 @@ class ITK_TEMPLATE_EXPORT FastMarchingReachedTargetNodesStoppingCriterion /** Constructor */ FastMarchingReachedTargetNodesStoppingCriterion() : Superclass() - , m_TargetOffset(NumericTraits::ZeroValue()) - , m_StoppingValue(NumericTraits::ZeroValue()) + , m_TargetOffset(OutputPixelType{}) + , m_StoppingValue(OutputPixelType{}) {} /** Destructor */ diff --git a/Modules/Filtering/FastMarching/include/itkFastMarchingStoppingCriterionBase.h b/Modules/Filtering/FastMarching/include/itkFastMarchingStoppingCriterionBase.h index b8df1d33cd4..8ee573197a6 100644 --- a/Modules/Filtering/FastMarching/include/itkFastMarchingStoppingCriterionBase.h +++ b/Modules/Filtering/FastMarching/include/itkFastMarchingStoppingCriterionBase.h @@ -57,8 +57,8 @@ class FastMarchingStoppingCriterionBase : public StoppingCriterionBase void Reinitialize() { - m_CurrentValue = NumericTraits::ZeroValue(); - m_PreviousValue = NumericTraits::ZeroValue(); + m_CurrentValue = OutputPixelType{}; + m_PreviousValue = OutputPixelType{}; this->Reset(); } @@ -79,8 +79,8 @@ class FastMarchingStoppingCriterionBase : public StoppingCriterionBase : Superclass() , m_Domain(nullptr) { - m_CurrentValue = NumericTraits::ZeroValue(); - m_PreviousValue = NumericTraits::ZeroValue(); + m_CurrentValue = OutputPixelType{}; + m_PreviousValue = OutputPixelType{}; } /** Destructor */ diff --git a/Modules/Filtering/FastMarching/include/itkFastMarchingThresholdStoppingCriterion.h b/Modules/Filtering/FastMarching/include/itkFastMarchingThresholdStoppingCriterion.h index e968f726a66..8d7152492dd 100644 --- a/Modules/Filtering/FastMarching/include/itkFastMarchingThresholdStoppingCriterion.h +++ b/Modules/Filtering/FastMarching/include/itkFastMarchingThresholdStoppingCriterion.h @@ -71,7 +71,7 @@ class ITK_TEMPLATE_EXPORT FastMarchingThresholdStoppingCriterion protected: FastMarchingThresholdStoppingCriterion() : Superclass() - , m_Threshold(NumericTraits::ZeroValue()) + , m_Threshold(OutputPixelType{}) {} ~FastMarchingThresholdStoppingCriterion() override = default; diff --git a/Modules/Filtering/FastMarching/include/itkFastMarchingUpwindGradientImageFilter.hxx b/Modules/Filtering/FastMarching/include/itkFastMarchingUpwindGradientImageFilter.hxx index 2c9112f4d11..efedce1475e 100644 --- a/Modules/Filtering/FastMarching/include/itkFastMarchingUpwindGradientImageFilter.hxx +++ b/Modules/Filtering/FastMarching/include/itkFastMarchingUpwindGradientImageFilter.hxx @@ -105,7 +105,7 @@ FastMarchingUpwindGradientImageFilter::Initialize(LevelS GradientPixelType zeroGradient; using GradientPixelValueType = typename GradientPixelType::ValueType; - zeroGradient.Fill(NumericTraits::ZeroValue()); + zeroGradient.Fill(GradientPixelValueType{}); for (gradientIt.GoToBegin(); !gradientIt.IsAtEnd(); ++gradientIt) { gradientIt.Set(zeroGradient); diff --git a/Modules/Filtering/FastMarching/include/itkFastMarchingUpwindGradientImageFilterBase.hxx b/Modules/Filtering/FastMarching/include/itkFastMarchingUpwindGradientImageFilterBase.hxx index a347f78ae8a..308eb7e8155 100644 --- a/Modules/Filtering/FastMarching/include/itkFastMarchingUpwindGradientImageFilterBase.hxx +++ b/Modules/Filtering/FastMarching/include/itkFastMarchingUpwindGradientImageFilterBase.hxx @@ -74,7 +74,7 @@ FastMarchingUpwindGradientImageFilterBase::InitializeOutput(Out GradientPixelType zeroGradient; using GradientPixelValueType = typename GradientPixelType::ValueType; - zeroGradient.Fill(NumericTraits::ZeroValue()); + zeroGradient.Fill(GradientPixelValueType{}); while (!gradientIt.IsAtEnd()) { diff --git a/Modules/Filtering/FastMarching/include/itkLevelSetNode.h b/Modules/Filtering/FastMarching/include/itkLevelSetNode.h index 433db7bd88c..202af2be7e2 100644 --- a/Modules/Filtering/FastMarching/include/itkLevelSetNode.h +++ b/Modules/Filtering/FastMarching/include/itkLevelSetNode.h @@ -134,7 +134,7 @@ class LevelSetNode /** Default constructor */ LevelSetNode() - : m_Value(NumericTraits::ZeroValue()) + : m_Value(PixelType{}) { m_Index.Fill(0); } diff --git a/Modules/Filtering/FastMarching/test/itkFastMarchingBaseTest.cxx b/Modules/Filtering/FastMarching/test/itkFastMarchingBaseTest.cxx index 10d4f650e71..fe0635ff89f 100644 --- a/Modules/Filtering/FastMarching/test/itkFastMarchingBaseTest.cxx +++ b/Modules/Filtering/FastMarching/test/itkFastMarchingBaseTest.cxx @@ -65,7 +65,7 @@ class FastMarchingBaseTestHelper : public FastMarchingBase const OutputPixelType GetOutputValue(OutputDomainType *, const NodeType &) const override { - return NumericTraits::ZeroValue(); + return OutputPixelType{}; } unsigned char diff --git a/Modules/Filtering/GPUThresholding/include/itkGPUBinaryThresholdImageFilter.h b/Modules/Filtering/GPUThresholding/include/itkGPUBinaryThresholdImageFilter.h index b00dac73a42..acc2cdf2d8d 100644 --- a/Modules/Filtering/GPUThresholding/include/itkGPUBinaryThresholdImageFilter.h +++ b/Modules/Filtering/GPUThresholding/include/itkGPUBinaryThresholdImageFilter.h @@ -37,7 +37,7 @@ class ITK_TEMPLATE_EXPORT GPUBinaryThreshold : public GPUFunctorBase { m_LowerThreshold = NumericTraits::NonpositiveMin(); m_UpperThreshold = NumericTraits::max(); - m_OutsideValue = NumericTraits::ZeroValue(); + m_OutsideValue = TOutput{}; m_InsideValue = NumericTraits::max(); } diff --git a/Modules/Filtering/ImageCompare/include/itkSimilarityIndexImageFilter.hxx b/Modules/Filtering/ImageCompare/include/itkSimilarityIndexImageFilter.hxx index e01f0e40e2f..76134d41efb 100644 --- a/Modules/Filtering/ImageCompare/include/itkSimilarityIndexImageFilter.hxx +++ b/Modules/Filtering/ImageCompare/include/itkSimilarityIndexImageFilter.hxx @@ -33,7 +33,7 @@ SimilarityIndexImageFilter::SimilarityIndexImageFilt // this filter requires two input images this->SetNumberOfRequiredInputs(2); - m_SimilarityIndex = NumericTraits::ZeroValue(); + m_SimilarityIndex = RealType{}; this->DynamicMultiThreadingOff(); } @@ -103,9 +103,9 @@ SimilarityIndexImageFilter::BeforeThreadedGenerateDa m_CountOfIntersection.SetSize(numberOfWorkUnits); // Initialize the temporaries - m_CountOfImage1.Fill(NumericTraits::ZeroValue()); - m_CountOfImage2.Fill(NumericTraits::ZeroValue()); - m_CountOfIntersection.Fill(NumericTraits::ZeroValue()); + m_CountOfImage1.Fill(SizeValueType{}); + m_CountOfImage2.Fill(SizeValueType{}); + m_CountOfIntersection.Fill(SizeValueType{}); } template @@ -132,7 +132,7 @@ SimilarityIndexImageFilter::AfterThreadedGenerateDat // compute overlap if (!countImage1 && !countImage2) { - m_SimilarityIndex = NumericTraits::ZeroValue(); + m_SimilarityIndex = RealType{}; return; } @@ -155,12 +155,12 @@ SimilarityIndexImageFilter::ThreadedGenerateData(con while (!it1.IsAtEnd()) { bool nonzero = false; - if (it1.Get() != NumericTraits::ZeroValue()) + if (it1.Get() != InputImage1PixelType{}) { m_CountOfImage1[threadId]++; nonzero = true; } - if (Math::NotExactlyEquals(it2.Get(), NumericTraits::ZeroValue())) + if (Math::NotExactlyEquals(it2.Get(), InputImage2PixelType{})) { m_CountOfImage2[threadId]++; if (nonzero) diff --git a/Modules/Filtering/ImageFeature/include/itkCannyEdgeDetectionImageFilter.hxx b/Modules/Filtering/ImageFeature/include/itkCannyEdgeDetectionImageFilter.hxx index 0ed3d594226..ac2162321d0 100644 --- a/Modules/Filtering/ImageFeature/include/itkCannyEdgeDetectionImageFilter.hxx +++ b/Modules/Filtering/ImageFeature/include/itkCannyEdgeDetectionImageFilter.hxx @@ -31,8 +31,8 @@ namespace itk { template CannyEdgeDetectionImageFilter::CannyEdgeDetectionImageFilter() - : m_UpperThreshold(NumericTraits::ZeroValue()) - , m_LowerThreshold(NumericTraits::ZeroValue()) + : m_UpperThreshold(OutputImagePixelType{}) + , m_LowerThreshold(OutputImagePixelType{}) { m_Variance.Fill(0.0); m_MaximumError.Fill(0.01); @@ -286,7 +286,7 @@ CannyEdgeDetectionImageFilter::HysteresisThresholding ImageRegionIterator uit(this->m_OutputImage, this->m_OutputImage->GetRequestedRegion()); while (!uit.IsAtEnd()) { - uit.Value() = NumericTraits::ZeroValue(); + uit.Value() = OutputImagePixelType{}; ++uit; } diff --git a/Modules/Filtering/ImageFeature/include/itkHessian3DToVesselnessMeasureImageFilter.hxx b/Modules/Filtering/ImageFeature/include/itkHessian3DToVesselnessMeasureImageFilter.hxx index 184d0174c9c..b879dfae3b3 100644 --- a/Modules/Filtering/ImageFeature/include/itkHessian3DToVesselnessMeasureImageFilter.hxx +++ b/Modules/Filtering/ImageFeature/include/itkHessian3DToVesselnessMeasureImageFilter.hxx @@ -84,7 +84,7 @@ Hessian3DToVesselnessMeasureImageFilter::GenerateData() } else { - oit.Set(NumericTraits::ZeroValue()); + oit.Set(OutputPixelType{}); } ++it; diff --git a/Modules/Filtering/ImageFeature/include/itkHessianToObjectnessMeasureImageFilter.hxx b/Modules/Filtering/ImageFeature/include/itkHessianToObjectnessMeasureImageFilter.hxx index f4c4ba54f69..79fdd201636 100644 --- a/Modules/Filtering/ImageFeature/include/itkHessianToObjectnessMeasureImageFilter.hxx +++ b/Modules/Filtering/ImageFeature/include/itkHessianToObjectnessMeasureImageFilter.hxx @@ -91,7 +91,7 @@ HessianToObjectnessMeasureImageFilter::DynamicThreade if (!signConstraintsSatisfied) { - oit.Set(NumericTraits::ZeroValue()); + oit.Set(OutputPixelType{}); ++it; ++oit; progress.CompletedPixel(); diff --git a/Modules/Filtering/ImageFeature/include/itkLaplacianRecursiveGaussianImageFilter.hxx b/Modules/Filtering/ImageFeature/include/itkLaplacianRecursiveGaussianImageFilter.hxx index 3c4edf6d2d4..bacffe82064 100644 --- a/Modules/Filtering/ImageFeature/include/itkLaplacianRecursiveGaussianImageFilter.hxx +++ b/Modules/Filtering/ImageFeature/include/itkLaplacianRecursiveGaussianImageFilter.hxx @@ -168,7 +168,7 @@ LaplacianRecursiveGaussianImageFilter::GenerateData() cumulativeImage->SetRegions(outputImage->GetRequestedRegion()); cumulativeImage->CopyInformation(inputImage); cumulativeImage->Allocate(); - cumulativeImage->FillBuffer(NumericTraits::ZeroValue()); + cumulativeImage->FillBuffer(InternalRealType{}); m_DerivativeFilter->SetInput(inputImage); diff --git a/Modules/Filtering/ImageFeature/include/itkMultiScaleHessianBasedMeasureImageFilter.hxx b/Modules/Filtering/ImageFeature/include/itkMultiScaleHessianBasedMeasureImageFilter.hxx index 73052deab09..3197390eb40 100644 --- a/Modules/Filtering/ImageFeature/include/itkMultiScaleHessianBasedMeasureImageFilter.hxx +++ b/Modules/Filtering/ImageFeature/include/itkMultiScaleHessianBasedMeasureImageFilter.hxx @@ -111,7 +111,7 @@ MultiScaleHessianBasedMeasureImageFilterFillBuffer(itk::NumericTraits::ZeroValue()); + m_UpdateBuffer->FillBuffer(BufferValueType{}); } else { diff --git a/Modules/Filtering/ImageFeature/include/itkSimpleContourExtractorImageFilter.hxx b/Modules/Filtering/ImageFeature/include/itkSimpleContourExtractorImageFilter.hxx index f08d0f9cbc1..fe7a47c7861 100644 --- a/Modules/Filtering/ImageFeature/include/itkSimpleContourExtractorImageFilter.hxx +++ b/Modules/Filtering/ImageFeature/include/itkSimpleContourExtractorImageFilter.hxx @@ -30,9 +30,9 @@ namespace itk template SimpleContourExtractorImageFilter::SimpleContourExtractorImageFilter() : m_InputForegroundValue(NumericTraits::max()) - , m_InputBackgroundValue(NumericTraits::ZeroValue()) + , m_InputBackgroundValue(InputPixelType{}) , m_OutputForegroundValue(NumericTraits::max()) - , m_OutputBackgroundValue(NumericTraits::ZeroValue()) + , m_OutputBackgroundValue(OutputPixelType{}) { this->DynamicMultiThreadingOn(); this->ThreaderUpdateProgressOff(); diff --git a/Modules/Filtering/ImageFeature/include/itkZeroCrossingBasedEdgeDetectionImageFilter.hxx b/Modules/Filtering/ImageFeature/include/itkZeroCrossingBasedEdgeDetectionImageFilter.hxx index f8d4439bad1..8ef4fa0bbf8 100644 --- a/Modules/Filtering/ImageFeature/include/itkZeroCrossingBasedEdgeDetectionImageFilter.hxx +++ b/Modules/Filtering/ImageFeature/include/itkZeroCrossingBasedEdgeDetectionImageFilter.hxx @@ -32,7 +32,7 @@ ZeroCrossingBasedEdgeDetectionImageFilter::ZeroCrossi { m_Variance.Fill(1.0); m_MaximumError.Fill(0.01); - m_BackgroundValue = NumericTraits::ZeroValue(); + m_BackgroundValue = OutputImagePixelType{}; m_ForegroundValue = NumericTraits::OneValue(); } diff --git a/Modules/Filtering/ImageFeature/include/itkZeroCrossingImageFilter.h b/Modules/Filtering/ImageFeature/include/itkZeroCrossingImageFilter.h index 13944d27be6..a83742a14e8 100644 --- a/Modules/Filtering/ImageFeature/include/itkZeroCrossingImageFilter.h +++ b/Modules/Filtering/ImageFeature/include/itkZeroCrossingImageFilter.h @@ -42,7 +42,7 @@ namespace itk * By default, zero-crossing pixels are labeled with a default "foreground" * value of itk::NumericTraits::OneValue(), where OutputDataType is * the data type of the output image. All other pixels are labeled with a - * default "background" value of itk::NumericTraits::ZeroValue(). + * default "background" value of OutputDataType{}. * * \par Parameters * There are two parameters for this filter. ForegroundValue is the value diff --git a/Modules/Filtering/ImageFeature/include/itkZeroCrossingImageFilter.hxx b/Modules/Filtering/ImageFeature/include/itkZeroCrossingImageFilter.hxx index c34f8126646..1da5e5bba0d 100644 --- a/Modules/Filtering/ImageFeature/include/itkZeroCrossingImageFilter.hxx +++ b/Modules/Filtering/ImageFeature/include/itkZeroCrossingImageFilter.hxx @@ -30,7 +30,7 @@ namespace itk template ZeroCrossingImageFilter::ZeroCrossingImageFilter() - : m_BackgroundValue(NumericTraits::ZeroValue()) + : m_BackgroundValue(OutputImagePixelType{}) , m_ForegroundValue(NumericTraits::OneValue()) { this->DynamicMultiThreadingOn(); diff --git a/Modules/Filtering/ImageFilterBase/include/itkMaskNeighborhoodOperatorImageFilter.h b/Modules/Filtering/ImageFilterBase/include/itkMaskNeighborhoodOperatorImageFilter.h index 441bbe41dff..61299cbda24 100644 --- a/Modules/Filtering/ImageFilterBase/include/itkMaskNeighborhoodOperatorImageFilter.h +++ b/Modules/Filtering/ImageFilterBase/include/itkMaskNeighborhoodOperatorImageFilter.h @@ -147,7 +147,7 @@ class ITK_TEMPLATE_EXPORT MaskNeighborhoodOperatorImageFilter protected: MaskNeighborhoodOperatorImageFilter() - : m_DefaultValue(NumericTraits::ZeroValue()) + : m_DefaultValue(OutputPixelType{}) {} ~MaskNeighborhoodOperatorImageFilter() override = default; void diff --git a/Modules/Filtering/ImageFilterBase/include/itkNoiseImageFilter.hxx b/Modules/Filtering/ImageFilterBase/include/itkNoiseImageFilter.hxx index 5409395dd04..c8f8a3c223d 100644 --- a/Modules/Filtering/ImageFilterBase/include/itkNoiseImageFilter.hxx +++ b/Modules/Filtering/ImageFilterBase/include/itkNoiseImageFilter.hxx @@ -77,8 +77,8 @@ NoiseImageFilter::DynamicThreadedGenerateData( while (!bit.IsAtEnd()) { - sum = NumericTraits::ZeroValue(); - sumOfSquares = NumericTraits::ZeroValue(); + sum = InputRealType{}; + sumOfSquares = InputRealType{}; for (i = 0; i < neighborhoodSize; ++i) { value = static_cast(bit.GetPixel(i)); diff --git a/Modules/Filtering/ImageFilterBase/include/itkNullImageToImageFilterDriver.hxx b/Modules/Filtering/ImageFilterBase/include/itkNullImageToImageFilterDriver.hxx index 20cfacf96da..3114dd8d294 100644 --- a/Modules/Filtering/ImageFilterBase/include/itkNullImageToImageFilterDriver.hxx +++ b/Modules/Filtering/ImageFilterBase/include/itkNullImageToImageFilterDriver.hxx @@ -114,7 +114,7 @@ NullImageToImageFilterDriver::InitializePixel(const D { for (unsigned int i = 0; i < InputPixelDimension; ++i) { - pixel[i] = NumericTraits::ValueType>::ZeroValue(); + pixel[i] = typename PixelTraits::ValueType{}; } } @@ -122,7 +122,7 @@ template void NullImageToImageFilterDriver::InitializePixel(const Dispatch<1> &, InputPixelType & pixel) { - pixel = NumericTraits::ZeroValue(); + pixel = InputPixelType{}; } /** diff --git a/Modules/Filtering/ImageFrequency/include/itkFrequencyBandImageFilter.hxx b/Modules/Filtering/ImageFrequency/include/itkFrequencyBandImageFilter.hxx index ec852cefed6..5035c4b1697 100644 --- a/Modules/Filtering/ImageFrequency/include/itkFrequencyBandImageFilter.hxx +++ b/Modules/Filtering/ImageFrequency/include/itkFrequencyBandImageFilter.hxx @@ -152,14 +152,14 @@ FrequencyBandImageFilter::BandPass(FrequencyIter { if (scalarFrequency < this->m_LowFrequencyThreshold || scalarFrequency > this->m_HighFrequencyThreshold) { - freqIt.Set(NumericTraits::ZeroValue()); + freqIt.Set(PixelType{}); } } else // Stop Band { if (scalarFrequency > this->m_LowFrequencyThreshold && scalarFrequency < this->m_HighFrequencyThreshold) { - freqIt.Set(NumericTraits::ZeroValue()); + freqIt.Set(PixelType{}); } } @@ -175,7 +175,7 @@ FrequencyBandImageFilter::BandPass(FrequencyIter } else { - freqIt.Set(NumericTraits::ZeroValue()); + freqIt.Set(PixelType{}); } } } @@ -191,7 +191,7 @@ FrequencyBandImageFilter::BandPass(FrequencyIter } else { - freqIt.Set(NumericTraits::ZeroValue()); + freqIt.Set(PixelType{}); } } } diff --git a/Modules/Filtering/ImageFusion/include/itkLabelMapContourOverlayImageFilter.hxx b/Modules/Filtering/ImageFusion/include/itkLabelMapContourOverlayImageFilter.hxx index 4b9464126e8..39f36cec512 100644 --- a/Modules/Filtering/ImageFusion/include/itkLabelMapContourOverlayImageFilter.hxx +++ b/Modules/Filtering/ImageFusion/include/itkLabelMapContourOverlayImageFilter.hxx @@ -154,7 +154,7 @@ LabelMapContourOverlayImageFilter::Befor auto serode = SliceErodeType::New(); using RadiusType = typename SliceKernelType::RadiusType; RadiusType srad; - srad.Fill(NumericTraits::ZeroValue()); + srad.Fill(typename RadiusType::SizeValueType{}); for (unsigned int i = 0, j = 0; i < ImageDimension; ++i) { if (j != static_cast(m_SliceDimension)) diff --git a/Modules/Filtering/ImageFusion/include/itkLabelOverlayFunctor.h b/Modules/Filtering/ImageFusion/include/itkLabelOverlayFunctor.h index 07931f15a8d..8306ef3516b 100644 --- a/Modules/Filtering/ImageFusion/include/itkLabelOverlayFunctor.h +++ b/Modules/Filtering/ImageFusion/include/itkLabelOverlayFunctor.h @@ -54,7 +54,7 @@ class LabelOverlayFunctor // LabelOverlayFunctorImageFilter) Inside LabelOverlayFunctorImageFilter, // the values are always initialized m_Opacity = 1.0; - m_BackgroundValue = NumericTraits::ZeroValue(); + m_BackgroundValue = TLabel{}; } inline TRGBPixel diff --git a/Modules/Filtering/ImageFusion/include/itkLabelOverlayImageFilter.hxx b/Modules/Filtering/ImageFusion/include/itkLabelOverlayImageFilter.hxx index 5d645c85c60..050b30c3038 100644 --- a/Modules/Filtering/ImageFusion/include/itkLabelOverlayImageFilter.hxx +++ b/Modules/Filtering/ImageFusion/include/itkLabelOverlayImageFilter.hxx @@ -26,7 +26,7 @@ template LabelOverlayImageFilter::LabelOverlayImageFilter() { m_Opacity = 0.5; - m_BackgroundValue = NumericTraits::ZeroValue(); + m_BackgroundValue = LabelPixelType{}; } template diff --git a/Modules/Filtering/ImageFusion/include/itkLabelToRGBFunctor.h b/Modules/Filtering/ImageFusion/include/itkLabelToRGBFunctor.h index 95f20c6e23f..1060d57a998 100644 --- a/Modules/Filtering/ImageFusion/include/itkLabelToRGBFunctor.h +++ b/Modules/Filtering/ImageFusion/include/itkLabelToRGBFunctor.h @@ -85,8 +85,8 @@ class LabelToRGBFunctor // LabelToRGBImageFilter) // Inside LabelToRGBImageFilter, the values are always initialized NumericTraits::SetLength(m_BackgroundColor, 3); - m_BackgroundColor.Fill(NumericTraits::ZeroValue()); - m_BackgroundValue = NumericTraits::ZeroValue(); + m_BackgroundColor.Fill(ValueType{}); + m_BackgroundValue = TLabel{}; } inline TRGBPixel diff --git a/Modules/Filtering/ImageFusion/include/itkLabelToRGBImageFilter.hxx b/Modules/Filtering/ImageFusion/include/itkLabelToRGBImageFilter.hxx index 482faf59f02..ce3450068b1 100644 --- a/Modules/Filtering/ImageFusion/include/itkLabelToRGBImageFilter.hxx +++ b/Modules/Filtering/ImageFusion/include/itkLabelToRGBImageFilter.hxx @@ -36,9 +36,9 @@ namespace itk template LabelToRGBImageFilter::LabelToRGBImageFilter() { - m_BackgroundValue = NumericTraits::ZeroValue(); + m_BackgroundValue = LabelPixelType{}; NumericTraits::SetLength(m_BackgroundColor, 3); - m_BackgroundColor.Fill(NumericTraits::ZeroValue()); + m_BackgroundColor.Fill(OutputPixelValueType{}); } template diff --git a/Modules/Filtering/ImageFusion/test/itkLabelToRGBImageFilterTest.cxx b/Modules/Filtering/ImageFusion/test/itkLabelToRGBImageFilterTest.cxx index f926a7cd0a7..30091da1345 100644 --- a/Modules/Filtering/ImageFusion/test/itkLabelToRGBImageFilterTest.cxx +++ b/Modules/Filtering/ImageFusion/test/itkLabelToRGBImageFilterTest.cxx @@ -61,7 +61,7 @@ itkLabelToRGBImageFilterTest(int argc, char * argv[]) ITK_TEST_SET_GET_VALUE(backgroundValue, filter->GetBackgroundValue()); typename FilterType::OutputPixelType backgroundColor; - backgroundColor.Fill(itk::NumericTraits::ZeroValue()); + backgroundColor.Fill(typename FilterType::OutputPixelValueType{}); filter->SetBackgroundColor(backgroundColor); ITK_TEST_SET_GET_VALUE(backgroundColor, filter->GetBackgroundColor()); diff --git a/Modules/Filtering/ImageGradient/include/itkGradientMagnitudeRecursiveGaussianImageFilter.hxx b/Modules/Filtering/ImageGradient/include/itkGradientMagnitudeRecursiveGaussianImageFilter.hxx index 6df895b9717..a9e1c8c3366 100644 --- a/Modules/Filtering/ImageGradient/include/itkGradientMagnitudeRecursiveGaussianImageFilter.hxx +++ b/Modules/Filtering/ImageGradient/include/itkGradientMagnitudeRecursiveGaussianImageFilter.hxx @@ -205,7 +205,7 @@ GradientMagnitudeRecursiveGaussianImageFilter::Genera auto cumulativeImage = CumulativeImageType::New(); cumulativeImage->SetRegions(inputImage->GetBufferedRegion()); cumulativeImage->Allocate(); - cumulativeImage->FillBuffer(NumericTraits::ZeroValue()); + cumulativeImage->FillBuffer(InternalRealType{}); // The output's information must match the input's information cumulativeImage->CopyInformation(this->GetInput()); diff --git a/Modules/Filtering/ImageGradient/include/itkVectorGradientMagnitudeImageFilter.h b/Modules/Filtering/ImageGradient/include/itkVectorGradientMagnitudeImageFilter.h index cef64116239..c3d9b118725 100644 --- a/Modules/Filtering/ImageGradient/include/itkVectorGradientMagnitudeImageFilter.h +++ b/Modules/Filtering/ImageGradient/include/itkVectorGradientMagnitudeImageFilter.h @@ -320,10 +320,10 @@ class ITK_TEMPLATE_EXPORT VectorGradientMagnitudeImageFilter : public ImageToIma unsigned int i, j; TRealType dx, sum, accum; - accum = NumericTraits::ZeroValue(); + accum = TRealType{}; for (i = 0; i < ImageDimension; ++i) { - sum = NumericTraits::ZeroValue(); + sum = TRealType{}; for (j = 0; j < VectorDimension; ++j) { dx = m_DerivativeWeights[i] * m_SqrtComponentWeights[j] * 0.5 * (it.GetNext(i)[j] - it.GetPrevious(i)[j]); diff --git a/Modules/Filtering/ImageGradient/test/itkGradientRecursiveGaussianFilterTest3.cxx b/Modules/Filtering/ImageGradient/test/itkGradientRecursiveGaussianFilterTest3.cxx index 15afc09199c..84dad2836c8 100644 --- a/Modules/Filtering/ImageGradient/test/itkGradientRecursiveGaussianFilterTest3.cxx +++ b/Modules/Filtering/ImageGradient/test/itkGradientRecursiveGaussianFilterTest3.cxx @@ -226,7 +226,7 @@ itkGradientRecursiveGaussianFilterTest3(int argc, char * argv[]) myGradImage1DType::Pointer scalarPixelGradImage = nullptr; myScalarPixelType pixelBorder; myScalarPixelType pixelFill; - pixelBorder = itk::NumericTraits::ZeroValue(); + pixelBorder = myScalarPixelType{}; pixelFill = static_cast(100.0); runResult = itkGradientRecursiveGaussianFilterTest3Run( pixelBorder, pixelFill, scalarPixelGradImage, argv[2]); diff --git a/Modules/Filtering/ImageGrid/include/itkBSplineControlPointImageFilter.hxx b/Modules/Filtering/ImageGrid/include/itkBSplineControlPointImageFilter.hxx index 65e25a7df3b..0f1010adb3c 100644 --- a/Modules/Filtering/ImageGrid/include/itkBSplineControlPointImageFilter.hxx +++ b/Modules/Filtering/ImageGrid/include/itkBSplineControlPointImageFilter.hxx @@ -241,12 +241,12 @@ BSplineControlPointImageFilter::DynamicThreadedGenera { U[i] = static_cast(totalNumberOfSpans[i]) - epsilon[i]; } - if (U[i] < NumericTraits::ZeroValue() && itk::Math::abs(U[i]) <= epsilon[i]) + if (U[i] < RealType{} && itk::Math::abs(U[i]) <= epsilon[i]) { - U[i] = NumericTraits::ZeroValue(); + U[i] = RealType{}; } - if (U[i] < NumericTraits::ZeroValue() || U[i] >= static_cast(totalNumberOfSpans[i])) + if (U[i] < RealType{} || U[i] >= static_cast(totalNumberOfSpans[i])) { itkExceptionMacro("The collapse point component " << U[i] << " is outside the corresponding parametric domain of [0, " << totalNumberOfSpans[i] diff --git a/Modules/Filtering/ImageGrid/include/itkBSplineControlPointImageFunction.hxx b/Modules/Filtering/ImageGrid/include/itkBSplineControlPointImageFunction.hxx index 60849c33e5a..417959ef0d2 100644 --- a/Modules/Filtering/ImageGrid/include/itkBSplineControlPointImageFunction.hxx +++ b/Modules/Filtering/ImageGrid/include/itkBSplineControlPointImageFunction.hxx @@ -171,12 +171,12 @@ BSplineControlPointImageFunction::Evaluate(const PointTy { p[i] = NumericTraits::OneValue() - this->m_BSplineEpsilon; } - if (p[i] < NumericTraits::ZeroValue() && itk::Math::abs(p[i]) <= this->m_BSplineEpsilon) + if (p[i] < RealType{} && itk::Math::abs(p[i]) <= this->m_BSplineEpsilon) { - p[i] = NumericTraits::ZeroValue(); + p[i] = RealType{}; } - if (p[i] < NumericTraits::ZeroValue() || p[i] >= NumericTraits::OneValue()) + if (p[i] < CoordRepType{} || p[i] >= NumericTraits::OneValue()) { itkExceptionMacro("The specified point " << params << " is outside the reparameterized domain [0, 1)."); } @@ -320,12 +320,12 @@ BSplineControlPointImageFunction::EvaluateGradient(const { p[i] = NumericTraits::OneValue() - this->m_BSplineEpsilon; } - if (p[i] < NumericTraits::ZeroValue() && itk::Math::abs(p[i]) <= this->m_BSplineEpsilon) + if (p[i] < RealType{} && itk::Math::abs(p[i]) <= this->m_BSplineEpsilon) { - p[i] = NumericTraits::ZeroValue(); + p[i] = RealType{}; } - if (p[i] < NumericTraits::ZeroValue() || p[i] >= NumericTraits::OneValue()) + if (p[i] < CoordRepType{} || p[i] >= NumericTraits::OneValue()) { itkExceptionMacro("The specified point " << params << " is outside the reparameterized domain [0, 1)."); } @@ -488,12 +488,12 @@ BSplineControlPointImageFunction::EvaluateHessian(const { p[i] = NumericTraits::OneValue() - this->m_BSplineEpsilon; } - if (p[i] < NumericTraits::ZeroValue() && itk::Math::abs(p[i]) <= this->m_BSplineEpsilon) + if (p[i] < RealType{} && itk::Math::abs(p[i]) <= this->m_BSplineEpsilon) { - p[i] = NumericTraits::ZeroValue(); + p[i] = RealType{}; } - if (p[i] < NumericTraits::ZeroValue() || p[i] >= NumericTraits::OneValue()) + if (p[i] < CoordRepType{} || p[i] >= NumericTraits::OneValue()) { itkExceptionMacro("The specified point " << params << " is outside the reparameterized domain [0, 1)."); } diff --git a/Modules/Filtering/ImageGrid/include/itkBSplineScatteredDataPointSetToImageFilter.hxx b/Modules/Filtering/ImageGrid/include/itkBSplineScatteredDataPointSetToImageFilter.hxx index 64c74fba34d..6c6508055aa 100644 --- a/Modules/Filtering/ImageGrid/include/itkBSplineScatteredDataPointSetToImageFilter.hxx +++ b/Modules/Filtering/ImageGrid/include/itkBSplineScatteredDataPointSetToImageFilter.hxx @@ -362,7 +362,7 @@ BSplineScatteredDataPointSetToImageFilter::BeforeT this->m_DeltaLatticePerThread[n] = PointDataImageType::New(); this->m_DeltaLatticePerThread[n]->SetRegions(size); this->m_DeltaLatticePerThread[n]->Allocate(); - this->m_DeltaLatticePerThread[n]->FillBuffer(NumericTraits::ZeroValue()); + this->m_DeltaLatticePerThread[n]->FillBuffer(PointDataType{}); } } } @@ -470,12 +470,12 @@ BSplineScatteredDataPointSetToImageFilter::Threade { p[i] = static_cast(totalNumberOfSpans) - epsilon[i]; } - if (p[i] < NumericTraits::ZeroValue() && itk::Math::abs(p[i]) <= epsilon[i]) + if (p[i] < RealType{} && itk::Math::abs(p[i]) <= epsilon[i]) { - p[i] = NumericTraits::ZeroValue(); + p[i] = RealType{}; } - if (p[i] < NumericTraits::ZeroValue() || p[i] >= static_cast(totalNumberOfSpans)) + if (p[i] < RealType{} || p[i] >= static_cast(totalNumberOfSpans)) { itkExceptionMacro("The reparameterized point component " << p[i] << " is outside the corresponding parametric domain of [0, " << totalNumberOfSpans @@ -623,12 +623,12 @@ BSplineScatteredDataPointSetToImageFilter::Threade { U[i] = static_cast(totalNumberOfSpans[i]) - epsilon[i]; } - if (U[i] < NumericTraits::ZeroValue() && itk::Math::abs(U[i]) <= epsilon[i]) + if (U[i] < RealType{} && itk::Math::abs(U[i]) <= epsilon[i]) { - U[i] = NumericTraits::ZeroValue(); + U[i] = RealType{}; } - if (U[i] < NumericTraits::ZeroValue() || U[i] >= static_cast(totalNumberOfSpans[i])) + if (U[i] < RealType{} || U[i] >= static_cast(totalNumberOfSpans[i])) { itkExceptionMacro("The collapse point component " << U[i] << " is outside the corresponding parametric domain of [0, " << totalNumberOfSpans[i] @@ -705,7 +705,7 @@ BSplineScatteredDataPointSetToImageFilter::AfterTh this->m_PhiLattice = PointDataImageType::New(); this->m_PhiLattice->SetRegions(size); this->m_PhiLattice->Allocate(); - this->m_PhiLattice->FillBuffer(NumericTraits::ZeroValue()); + this->m_PhiLattice->FillBuffer(PointDataType{}); ImageRegionIterator ItP(this->m_PhiLattice, this->m_PhiLattice->GetLargestPossibleRegion()); @@ -713,7 +713,7 @@ BSplineScatteredDataPointSetToImageFilter::AfterTh { PointDataType P; P.Fill(0); - if (Math::NotAlmostEquals(ItO.Get(), NumericTraits::ZeroValue())) + if (Math::NotAlmostEquals(ItO.Get(), typename PointDataType::ValueType{})) { P = ItD.Get() / ItO.Get(); for (unsigned int i = 0; i < P.Size(); ++i) @@ -963,12 +963,12 @@ BSplineScatteredDataPointSetToImageFilter::Threade { U[i] = static_cast(totalNumberOfSpans[i]) - epsilon[i]; } - if (U[i] < NumericTraits::ZeroValue() && itk::Math::abs(U[i]) <= epsilon[i]) + if (U[i] < RealType{} && itk::Math::abs(U[i]) <= epsilon[i]) { - U[i] = NumericTraits::ZeroValue(); + U[i] = RealType{}; } - if (U[i] < NumericTraits::ZeroValue() || U[i] >= static_cast(totalNumberOfSpans[i])) + if (U[i] < RealType{} || U[i] >= static_cast(totalNumberOfSpans[i])) { itkExceptionMacro("The collapse point component " << U[i] << " is outside the corresponding parametric domain of [0, " << totalNumberOfSpans[i] diff --git a/Modules/Filtering/ImageGrid/include/itkConstantPadImageFilter.hxx b/Modules/Filtering/ImageGrid/include/itkConstantPadImageFilter.hxx index 9d2dbfa357b..817db8731b9 100644 --- a/Modules/Filtering/ImageGrid/include/itkConstantPadImageFilter.hxx +++ b/Modules/Filtering/ImageGrid/include/itkConstantPadImageFilter.hxx @@ -29,7 +29,7 @@ namespace itk template ConstantPadImageFilter::ConstantPadImageFilter() { - m_InternalBoundaryCondition.SetConstant(NumericTraits::ZeroValue()); + m_InternalBoundaryCondition.SetConstant(OutputImagePixelType{}); this->InternalSetBoundaryCondition(&m_InternalBoundaryCondition); } diff --git a/Modules/Filtering/ImageGrid/include/itkCyclicShiftImageFilter.hxx b/Modules/Filtering/ImageGrid/include/itkCyclicShiftImageFilter.hxx index c7c42a7e5ff..7cc93e67d8a 100644 --- a/Modules/Filtering/ImageGrid/include/itkCyclicShiftImageFilter.hxx +++ b/Modules/Filtering/ImageGrid/include/itkCyclicShiftImageFilter.hxx @@ -28,7 +28,7 @@ namespace itk template CyclicShiftImageFilter::CyclicShiftImageFilter() { - m_Shift.Fill(NumericTraits::ZeroValue()); + m_Shift.Fill(OffsetValueType{}); this->DynamicMultiThreadingOn(); this->ThreaderUpdateProgressOff(); } diff --git a/Modules/Filtering/ImageGrid/test/itkBSplineScatteredDataPointSetToImageFilterTest.cxx b/Modules/Filtering/ImageGrid/test/itkBSplineScatteredDataPointSetToImageFilterTest.cxx index 5900c53af73..bc225393edc 100644 --- a/Modules/Filtering/ImageGrid/test/itkBSplineScatteredDataPointSetToImageFilterTest.cxx +++ b/Modules/Filtering/ImageGrid/test/itkBSplineScatteredDataPointSetToImageFilterTest.cxx @@ -64,7 +64,7 @@ itkBSplineScatteredDataPointSetToImageFilterTest(int argc, char * argv[]) for (It.GoToBegin(); !It.IsAtEnd(); ++It) { - if (It.Get() != itk::NumericTraits::ZeroValue()) + if (It.Get() != PixelType{}) { // We extract both the 2-D location of the point // and the pixel value of that point. diff --git a/Modules/Filtering/ImageIntensity/include/itkArithmeticOpsFunctors.h b/Modules/Filtering/ImageIntensity/include/itkArithmeticOpsFunctors.h index c90e6454c0d..c100f2441c1 100644 --- a/Modules/Filtering/ImageIntensity/include/itkArithmeticOpsFunctors.h +++ b/Modules/Filtering/ImageIntensity/include/itkArithmeticOpsFunctors.h @@ -145,7 +145,7 @@ class ITK_TEMPLATE_EXPORT Div inline TOutput operator()(const TInput1 & A, const TInput2 & B) const { - if (itk::Math::NotAlmostEquals(B, NumericTraits::ZeroValue())) + if (itk::Math::NotAlmostEquals(B, TInput2{})) { return (TOutput)(A / B); } @@ -169,7 +169,7 @@ class ITK_TEMPLATE_EXPORT DivideOrZeroOut DivideOrZeroOut() { m_Threshold = 1e-5 * NumericTraits::OneValue(); - m_Constant = NumericTraits::ZeroValue(); + m_Constant = TOutput{}; }; ~DivideOrZeroOut() = default; @@ -218,7 +218,7 @@ class ITK_TEMPLATE_EXPORT Modulus inline TOutput operator()(const TInput1 & A, const TInput2 & B) const { - if (B != NumericTraits::ZeroValue()) + if (B != TInput2{}) { return static_cast(A % B); } diff --git a/Modules/Filtering/ImageIntensity/include/itkDivideImageFilter.h b/Modules/Filtering/ImageIntensity/include/itkDivideImageFilter.h index abaa161192c..378627992c2 100644 --- a/Modules/Filtering/ImageIntensity/include/itkDivideImageFilter.h +++ b/Modules/Filtering/ImageIntensity/include/itkDivideImageFilter.h @@ -104,8 +104,7 @@ class ITK_TEMPLATE_EXPORT DivideImageFilter const auto * input = dynamic_cast(this->ProcessObject::GetInput(1)); - if (input != nullptr && - itk::Math::AlmostEquals(input->Get(), itk::NumericTraits::ZeroValue())) + if (input != nullptr && itk::Math::AlmostEquals(input->Get(), typename TInputImage2::PixelType{})) { itkGenericExceptionMacro("The constant value used as denominator should not be set to zero"); } diff --git a/Modules/Filtering/ImageIntensity/include/itkHistogramMatchingImageFilter.hxx b/Modules/Filtering/ImageIntensity/include/itkHistogramMatchingImageFilter.hxx index 8e5303e2756..3c0d6cc87ff 100644 --- a/Modules/Filtering/ImageIntensity/include/itkHistogramMatchingImageFilter.hxx +++ b/Modules/Filtering/ImageIntensity/include/itkHistogramMatchingImageFilter.hxx @@ -27,10 +27,10 @@ namespace itk { template HistogramMatchingImageFilter::HistogramMatchingImageFilter() - : m_SourceMinValue(NumericTraits::ZeroValue()) - , m_SourceMaxValue(NumericTraits::ZeroValue()) - , m_ReferenceMinValue(NumericTraits::ZeroValue()) - , m_ReferenceMaxValue(NumericTraits::ZeroValue()) + : m_SourceMinValue(THistogramMeasurement{}) + , m_SourceMaxValue(THistogramMeasurement{}) + , m_ReferenceMinValue(THistogramMeasurement{}) + , m_ReferenceMaxValue(THistogramMeasurement{}) , m_SourceHistogram(HistogramType::New()) , m_OutputHistogram(HistogramType::New()) @@ -437,7 +437,7 @@ HistogramMatchingImageFilter:: typename HistogramType::IndexType index(1); typename HistogramType::MeasurementVectorType measurement(1); using MeasurementType = typename HistogramType::MeasurementType; - measurement[0] = NumericTraits::ZeroValue(); + measurement[0] = MeasurementType{}; { // put each image pixel into the histogram diff --git a/Modules/Filtering/ImageIntensity/include/itkLogicOpsFunctors.h b/Modules/Filtering/ImageIntensity/include/itkLogicOpsFunctors.h index c11a294b3a7..10624d8ba5e 100644 --- a/Modules/Filtering/ImageIntensity/include/itkLogicOpsFunctors.h +++ b/Modules/Filtering/ImageIntensity/include/itkLogicOpsFunctors.h @@ -63,7 +63,7 @@ class ITK_TEMPLATE_EXPORT LogicOpBase LogicOpBase() { m_ForegroundValue = itk::NumericTraits::OneValue(); - m_BackgroundValue = itk::NumericTraits::ZeroValue(); + m_BackgroundValue = TOutput{}; } ~LogicOpBase() = default; diff --git a/Modules/Filtering/ImageIntensity/include/itkMaskImageFilter.h b/Modules/Filtering/ImageIntensity/include/itkMaskImageFilter.h index e3b8ec45f28..1a51b728ef7 100644 --- a/Modules/Filtering/ImageIntensity/include/itkMaskImageFilter.h +++ b/Modules/Filtering/ImageIntensity/include/itkMaskImageFilter.h @@ -94,7 +94,7 @@ class MaskInput TPixelType DefaultOutsideValue(TPixelType *) { - return NumericTraits::ZeroValue(); + return TPixelType{}; } template @@ -274,12 +274,12 @@ class ITK_TEMPLATE_EXPORT MaskImageFilter : public BinaryGeneratorImageFilter currentValue = this->GetFunctor().GetOutsideValue(); VariableLengthVector zeroVector(currentValue.GetSize()); - zeroVector.Fill(NumericTraits::ZeroValue()); + zeroVector.Fill(TValue{}); if (currentValue == zeroVector) { zeroVector.SetSize(this->GetOutput()->GetVectorLength()); - zeroVector.Fill(NumericTraits::ZeroValue()); + zeroVector.Fill(TValue{}); this->GetFunctor().SetOutsideValue(zeroVector); } else if (this->GetFunctor().GetOutsideValue().GetSize() != this->GetOutput()->GetVectorLength()) diff --git a/Modules/Filtering/ImageIntensity/include/itkMaskNegatedImageFilter.h b/Modules/Filtering/ImageIntensity/include/itkMaskNegatedImageFilter.h index adb30fc7b73..d7c434d63f9 100644 --- a/Modules/Filtering/ImageIntensity/include/itkMaskNegatedImageFilter.h +++ b/Modules/Filtering/ImageIntensity/include/itkMaskNegatedImageFilter.h @@ -92,7 +92,7 @@ class MaskNegatedInput TPixelType DefaultOutsideValue(TPixelType *) { - return NumericTraits::ZeroValue(); + return TPixelType{}; } template @@ -273,12 +273,12 @@ class ITK_TEMPLATE_EXPORT MaskNegatedImageFilter // output image. If not, throw an exception. VariableLengthVector currentValue = this->GetFunctor().GetOutsideValue(); VariableLengthVector zeroVector(currentValue.GetSize()); - zeroVector.Fill(NumericTraits::ZeroValue()); + zeroVector.Fill(TValue{}); if (currentValue == zeroVector) { zeroVector.SetSize(this->GetOutput()->GetVectorLength()); - zeroVector.Fill(NumericTraits::ZeroValue()); + zeroVector.Fill(TValue{}); this->GetFunctor().SetOutsideValue(zeroVector); } else if (this->GetFunctor().GetOutsideValue().GetSize() != this->GetOutput()->GetVectorLength()) diff --git a/Modules/Filtering/ImageIntensity/include/itkNaryAddImageFilter.h b/Modules/Filtering/ImageIntensity/include/itkNaryAddImageFilter.h index eea19965b14..03750327768 100644 --- a/Modules/Filtering/ImageIntensity/include/itkNaryAddImageFilter.h +++ b/Modules/Filtering/ImageIntensity/include/itkNaryAddImageFilter.h @@ -38,7 +38,7 @@ class Add1 inline TOutput operator()(const std::vector & B) const { - AccumulatorType sum = NumericTraits::ZeroValue(); + AccumulatorType sum = TOutput{}; for (unsigned int i = 0; i < B.size(); ++i) { diff --git a/Modules/Filtering/ImageIntensity/include/itkRescaleIntensityImageFilter.hxx b/Modules/Filtering/ImageIntensity/include/itkRescaleIntensityImageFilter.hxx index 863eb3d97bb..2a13edb33ee 100644 --- a/Modules/Filtering/ImageIntensity/include/itkRescaleIntensityImageFilter.hxx +++ b/Modules/Filtering/ImageIntensity/include/itkRescaleIntensityImageFilter.hxx @@ -39,7 +39,7 @@ RescaleIntensityImageFilter::RescaleIntensityImageFil : m_Scale(1.0) , m_Shift(0.0) , m_InputMinimum(NumericTraits::max()) - , m_InputMaximum(NumericTraits::ZeroValue()) + , m_InputMaximum(InputPixelType{}) , m_OutputMinimum(NumericTraits::NonpositiveMin()) , m_OutputMaximum(NumericTraits::max()) {} @@ -69,8 +69,7 @@ RescaleIntensityImageFilter::BeforeThreadedGenerateDa this->m_Scale = (static_cast(this->m_OutputMaximum) - static_cast(this->m_OutputMinimum)) / (static_cast(this->m_InputMaximum) - static_cast(this->m_InputMinimum)); } - else if (itk::Math::NotAlmostEquals(this->m_InputMaximum, - NumericTraits::ValueType>::ZeroValue())) + else if (itk::Math::NotAlmostEquals(this->m_InputMaximum, typename NumericTraits::ValueType{})) { this->m_Scale = (static_cast(this->m_OutputMaximum) - static_cast(this->m_OutputMinimum)) / static_cast(this->m_InputMaximum); diff --git a/Modules/Filtering/ImageIntensity/include/itkVectorRescaleIntensityImageFilter.hxx b/Modules/Filtering/ImageIntensity/include/itkVectorRescaleIntensityImageFilter.hxx index 82351a4f353..b9fcb705359 100644 --- a/Modules/Filtering/ImageIntensity/include/itkVectorRescaleIntensityImageFilter.hxx +++ b/Modules/Filtering/ImageIntensity/include/itkVectorRescaleIntensityImageFilter.hxx @@ -37,15 +37,15 @@ template VectorRescaleIntensityImageFilter::VectorRescaleIntensityImageFilter() : m_Scale(1.0) , m_Shift(1.0) - , m_InputMaximumMagnitude(NumericTraits::ZeroValue()) - , m_OutputMaximumMagnitude(NumericTraits::ZeroValue()) + , m_InputMaximumMagnitude(InputRealType{}) + , m_OutputMaximumMagnitude(OutputRealType{}) {} template void VectorRescaleIntensityImageFilter::BeforeThreadedGenerateData() { - if (m_OutputMaximumMagnitude < NumericTraits::ZeroValue()) + if (m_OutputMaximumMagnitude < OutputRealType{}) { itkExceptionMacro("Maximum output value cannot be negative. You are passing " << m_OutputMaximumMagnitude); } diff --git a/Modules/Filtering/ImageIntensity/test/itkVectorRescaleIntensityImageFilterTest.cxx b/Modules/Filtering/ImageIntensity/test/itkVectorRescaleIntensityImageFilterTest.cxx index 4136bbedda4..61f4aa02cd6 100644 --- a/Modules/Filtering/ImageIntensity/test/itkVectorRescaleIntensityImageFilterTest.cxx +++ b/Modules/Filtering/ImageIntensity/test/itkVectorRescaleIntensityImageFilterTest.cxx @@ -107,8 +107,7 @@ itkVectorRescaleIntensityImageFilterTest(int, char *[]) const OutputPixelType outputValue = ot.Get(); for (unsigned int k = 0; k < VectorDimension; ++k) { - if (itk::Math::NotAlmostEquals(outputValue[k], - itk::NumericTraits::ValueType>::ZeroValue())) + if (itk::Math::NotAlmostEquals(outputValue[k], itk::NumericTraits::ValueType{})) { if (!itk::Math::FloatAlmostEqual( static_cast(outputValue[k]), static_cast(pixelValue[k] * factor), 10, tolerance)) diff --git a/Modules/Filtering/ImageLabel/test/itkChangeLabelImageFilterTest.cxx b/Modules/Filtering/ImageLabel/test/itkChangeLabelImageFilterTest.cxx index 55f0f730eac..f22357cad68 100644 --- a/Modules/Filtering/ImageLabel/test/itkChangeLabelImageFilterTest.cxx +++ b/Modules/Filtering/ImageLabel/test/itkChangeLabelImageFilterTest.cxx @@ -46,7 +46,7 @@ itkChangeLabelImageFilterTest(int, char *[]) // limit to a few labels InputPixelType upper = 10; - source->SetMin(itk::NumericTraits::ZeroValue()); + source->SetMin(InputPixelType{}); source->SetMax(upper); source->SetSize(sizeArray); diff --git a/Modules/Filtering/ImageNoise/test/itkPeakSignalToNoiseRatioCalculator.hxx b/Modules/Filtering/ImageNoise/test/itkPeakSignalToNoiseRatioCalculator.hxx index 3ec3851b561..aa3725ec963 100644 --- a/Modules/Filtering/ImageNoise/test/itkPeakSignalToNoiseRatioCalculator.hxx +++ b/Modules/Filtering/ImageNoise/test/itkPeakSignalToNoiseRatioCalculator.hxx @@ -31,7 +31,7 @@ PeakSignalToNoiseRatioCalculator::PeakSignalToNoiseRatioCalculator( m_Valid = false; m_Image = nullptr; m_NoisyImage = nullptr; - m_Output = NumericTraits::ZeroValue(); + m_Output = InputPixelType{}; } template diff --git a/Modules/Filtering/ImageStatistics/include/itkImageMomentsCalculator.hxx b/Modules/Filtering/ImageStatistics/include/itkImageMomentsCalculator.hxx index 53a57e6c9f8..46bacc6b2e0 100644 --- a/Modules/Filtering/ImageStatistics/include/itkImageMomentsCalculator.hxx +++ b/Modules/Filtering/ImageStatistics/include/itkImageMomentsCalculator.hxx @@ -33,13 +33,13 @@ ImageMomentsCalculator::ImageMomentsCalculator() m_Valid = false; m_Image = nullptr; m_SpatialObjectMask = nullptr; - m_M0 = NumericTraits::ZeroValue(); - m_M1.Fill(NumericTraits::ZeroValue()); - m_M2.Fill(NumericTraits::ZeroValue()); - m_Cg.Fill(NumericTraits::ZeroValue()); - m_Cm.Fill(NumericTraits::ZeroValue()); - m_Pm.Fill(NumericTraits::ZeroValue()); - m_Pa.Fill(NumericTraits::ZeroValue()); + m_M0 = ScalarType{}; + m_M1.Fill(typename VectorType::ValueType{}); + m_M2.Fill(typename MatrixType::ValueType{}); + m_Cg.Fill(typename VectorType::ValueType{}); + m_Cm.Fill(typename MatrixType::ValueType{}); + m_Pm.Fill(typename VectorType::ValueType{}); + m_Pa.Fill(typename MatrixType::ValueType{}); } //---------------------------------------------------------------------- @@ -65,11 +65,11 @@ template void ImageMomentsCalculator::Compute() { - m_M0 = NumericTraits::ZeroValue(); - m_M1.Fill(NumericTraits::ZeroValue()); - m_M2.Fill(NumericTraits::ZeroValue()); - m_Cg.Fill(NumericTraits::ZeroValue()); - m_Cm.Fill(NumericTraits::ZeroValue()); + m_M0 = ScalarType{}; + m_M1.Fill(typename VectorType::ValueType{}); + m_M2.Fill(typename MatrixType::ValueType{}); + m_Cg.Fill(typename VectorType::ValueType{}); + m_Cm.Fill(typename MatrixType::ValueType{}); using IndexType = typename ImageType::IndexType; diff --git a/Modules/Filtering/ImageStatistics/include/itkLabelOverlapMeasuresImageFilter.hxx b/Modules/Filtering/ImageStatistics/include/itkLabelOverlapMeasuresImageFilter.hxx index 5bc9b7602c7..122efa2a504 100644 --- a/Modules/Filtering/ImageStatistics/include/itkLabelOverlapMeasuresImageFilter.hxx +++ b/Modules/Filtering/ImageStatistics/include/itkLabelOverlapMeasuresImageFilter.hxx @@ -149,7 +149,7 @@ LabelOverlapMeasuresImageFilter::GetTotalOverlap() const -> RealTyp for (auto mapIt = this->m_LabelSetMeasures.begin(); mapIt != this->m_LabelSetMeasures.end(); ++mapIt) { // Do not include the background in the final value. - if (mapIt->first == NumericTraits::ZeroValue()) + if (mapIt->first == LabelType{}) { continue; } @@ -200,7 +200,7 @@ LabelOverlapMeasuresImageFilter::GetUnionOverlap() const -> RealTyp for (auto mapIt = this->m_LabelSetMeasures.begin(); mapIt != this->m_LabelSetMeasures.end(); ++mapIt) { // Do not include the background in the final value. - if (mapIt->first == NumericTraits::ZeroValue()) + if (mapIt->first == LabelType{}) { continue; } @@ -267,7 +267,7 @@ LabelOverlapMeasuresImageFilter::GetVolumeSimilarity() const -> Rea for (auto mapIt = this->m_LabelSetMeasures.begin(); mapIt != this->m_LabelSetMeasures.end(); ++mapIt) { // Do not include the background in the final value. - if (mapIt->first == NumericTraits::ZeroValue()) + if (mapIt->first == LabelType{}) { continue; } @@ -310,7 +310,7 @@ LabelOverlapMeasuresImageFilter::GetFalseNegativeError() const -> R for (auto mapIt = this->m_LabelSetMeasures.begin(); mapIt != this->m_LabelSetMeasures.end(); ++mapIt) { // Do not include the background in the final value. - if (mapIt->first == NumericTraits::ZeroValue()) + if (mapIt->first == LabelType{}) { continue; } @@ -364,7 +364,7 @@ LabelOverlapMeasuresImageFilter::GetFalsePositiveError() const -> R for (auto mapIt = this->m_LabelSetMeasures.begin(); mapIt != this->m_LabelSetMeasures.end(); ++mapIt) { // Do not include the background in the final value. - if (mapIt->first == NumericTraits::ZeroValue()) + if (mapIt->first == LabelType{}) { continue; } @@ -421,7 +421,7 @@ LabelOverlapMeasuresImageFilter::GetFalseDiscoveryRate() const -> R for (auto mapIt = this->m_LabelSetMeasures.begin(); mapIt != this->m_LabelSetMeasures.end(); ++mapIt) { // Do not include the background in the final value. - if (mapIt->first == NumericTraits::ZeroValue()) + if (mapIt->first == LabelType{}) { continue; } diff --git a/Modules/Filtering/ImageStatistics/include/itkLabelStatisticsImageFilter.h b/Modules/Filtering/ImageStatistics/include/itkLabelStatisticsImageFilter.h index 6775d05d9cf..debd60bb386 100644 --- a/Modules/Filtering/ImageStatistics/include/itkLabelStatisticsImageFilter.h +++ b/Modules/Filtering/ImageStatistics/include/itkLabelStatisticsImageFilter.h @@ -122,18 +122,18 @@ class ITK_TEMPLATE_EXPORT LabelStatisticsImageFilter : public ImageSink::ZeroValue(); - m_Sum = NumericTraits::ZeroValue(); - m_SumOfSquares = NumericTraits::ZeroValue(); + m_Count = IdentifierType{}; + m_Sum = RealType{}; + m_SumOfSquares = RealType{}; // Set such that the first pixel encountered can be compared m_Minimum = NumericTraits::max(); m_Maximum = NumericTraits::NonpositiveMin(); // Default these to zero - m_Mean = NumericTraits::ZeroValue(); - m_Sigma = NumericTraits::ZeroValue(); - m_Variance = NumericTraits::ZeroValue(); + m_Mean = RealType{}; + m_Sigma = RealType{}; + m_Variance = RealType{}; const unsigned int imageDimension = Self::ImageDimension; m_BoundingBox.resize(imageDimension * 2); @@ -149,18 +149,18 @@ class ITK_TEMPLATE_EXPORT LabelStatisticsImageFilter : public ImageSink::ZeroValue(); - m_Sum = NumericTraits::ZeroValue(); - m_SumOfSquares = NumericTraits::ZeroValue(); + m_Count = IdentifierType{}; + m_Sum = RealType{}; + m_SumOfSquares = RealType{}; // Set such that the first pixel encountered can be compared m_Minimum = NumericTraits::max(); m_Maximum = NumericTraits::NonpositiveMin(); // Default these to zero - m_Mean = NumericTraits::ZeroValue(); - m_Sigma = NumericTraits::ZeroValue(); - m_Variance = NumericTraits::ZeroValue(); + m_Mean = RealType{}; + m_Sigma = RealType{}; + m_Variance = RealType{}; const unsigned int imageDimension = Self::ImageDimension; m_BoundingBox.resize(imageDimension * 2); diff --git a/Modules/Filtering/ImageStatistics/include/itkLabelStatisticsImageFilter.hxx b/Modules/Filtering/ImageStatistics/include/itkLabelStatisticsImageFilter.hxx index 807dd227652..20ba7c65d0b 100644 --- a/Modules/Filtering/ImageStatistics/include/itkLabelStatisticsImageFilter.hxx +++ b/Modules/Filtering/ImageStatistics/include/itkLabelStatisticsImageFilter.hxx @@ -137,7 +137,7 @@ LabelStatisticsImageFilter::AfterStreamedGenerateData( } else { - labelStats.m_Variance = NumericTraits::ZeroValue(); + labelStats.m_Variance = RealType{}; } // sigma @@ -323,7 +323,7 @@ LabelStatisticsImageFilter::GetMean(LabelPixelType lab if (mapIt == m_LabelStatistics.end()) { // label does not exist, return a default value - return NumericTraits::ZeroValue(); + return PixelType{}; } else { @@ -341,7 +341,7 @@ LabelStatisticsImageFilter::GetSum(LabelPixelType labe if (mapIt == m_LabelStatistics.end()) { // label does not exist, return a default value - return NumericTraits::ZeroValue(); + return PixelType{}; } else { @@ -359,7 +359,7 @@ LabelStatisticsImageFilter::GetSigma(LabelPixelType la if (mapIt == m_LabelStatistics.end()) { // label does not exist, return a default value - return NumericTraits::ZeroValue(); + return PixelType{}; } else { @@ -377,7 +377,7 @@ LabelStatisticsImageFilter::GetVariance(LabelPixelType if (mapIt == m_LabelStatistics.end()) { // label does not exist, return a default value - return NumericTraits::ZeroValue(); + return PixelType{}; } else { diff --git a/Modules/Filtering/ImageStatistics/include/itkMeanProjectionImageFilter.h b/Modules/Filtering/ImageStatistics/include/itkMeanProjectionImageFilter.h index 5fd320d3d1c..270c635d0c7 100644 --- a/Modules/Filtering/ImageStatistics/include/itkMeanProjectionImageFilter.h +++ b/Modules/Filtering/ImageStatistics/include/itkMeanProjectionImageFilter.h @@ -53,12 +53,12 @@ class MeanAccumulator MeanAccumulator(SizeValueType size) { m_Size = size; } - ~MeanAccumulator() { m_Size = NumericTraits::ZeroValue(); } + ~MeanAccumulator() { m_Size = SizeValueType{}; } inline void Initialize() { - m_Sum = NumericTraits::ZeroValue(); + m_Sum = TAccumulate{}; } inline void diff --git a/Modules/Filtering/ImageStatistics/include/itkStandardDeviationProjectionImageFilter.h b/Modules/Filtering/ImageStatistics/include/itkStandardDeviationProjectionImageFilter.h index cb943d35795..4bcd27ff891 100644 --- a/Modules/Filtering/ImageStatistics/include/itkStandardDeviationProjectionImageFilter.h +++ b/Modules/Filtering/ImageStatistics/include/itkStandardDeviationProjectionImageFilter.h @@ -63,7 +63,7 @@ class StandardDeviationAccumulator inline void Initialize() { - m_Sum = NumericTraits::ZeroValue(); + m_Sum = TAccumulate{}; m_Values.clear(); } @@ -80,7 +80,7 @@ class StandardDeviationAccumulator // to avoid division by zero if (m_Size <= 1) { - return NumericTraits::ZeroValue(); + return RealType{}; } typename NumericTraits::RealType mean = ((RealType)m_Sum) / m_Size; diff --git a/Modules/Filtering/ImageStatistics/include/itkStatisticsImageFilter.hxx b/Modules/Filtering/ImageStatistics/include/itkStatisticsImageFilter.hxx index 34c56b9693b..d48b35fb693 100644 --- a/Modules/Filtering/ImageStatistics/include/itkStatisticsImageFilter.hxx +++ b/Modules/Filtering/ImageStatistics/include/itkStatisticsImageFilter.hxx @@ -34,8 +34,8 @@ StatisticsImageFilter::StatisticsImageFilter() Self::SetMean(NumericTraits::max()); Self::SetSigma(NumericTraits::max()); Self::SetVariance(NumericTraits::max()); - Self::SetSum(NumericTraits::ZeroValue()); - Self::SetSumOfSquares(NumericTraits::ZeroValue()); + Self::SetSum(RealType{}); + Self::SetSumOfSquares(RealType{}); } template @@ -60,9 +60,9 @@ StatisticsImageFilter::BeforeStreamedGenerateData() Superclass::BeforeStreamedGenerateData(); // Resize the thread temporaries - m_Count = NumericTraits::ZeroValue(); - m_SumOfSquares = NumericTraits::ZeroValue(); - m_ThreadSum = NumericTraits::ZeroValue(); + m_Count = SizeValueType{}; + m_SumOfSquares = RealType{}; + m_ThreadSum = RealType{}; m_ThreadMin = NumericTraits::max(); m_ThreadMax = NumericTraits::NonpositiveMin(); } @@ -99,8 +99,8 @@ void StatisticsImageFilter::ThreadedStreamedGenerateData(const RegionType & regionForThread) { - CompensatedSummation sum = NumericTraits::ZeroValue(); - CompensatedSummation sumOfSquares = NumericTraits::ZeroValue(); + CompensatedSummation sum = RealType{}; + CompensatedSummation sumOfSquares = RealType{}; SizeValueType count{}; PixelType min = NumericTraits::max(); PixelType max = NumericTraits::NonpositiveMin(); diff --git a/Modules/Filtering/ImageStatistics/include/itkSumProjectionImageFilter.h b/Modules/Filtering/ImageStatistics/include/itkSumProjectionImageFilter.h index 4af8da032d1..44eba83cc2f 100644 --- a/Modules/Filtering/ImageStatistics/include/itkSumProjectionImageFilter.h +++ b/Modules/Filtering/ImageStatistics/include/itkSumProjectionImageFilter.h @@ -56,7 +56,7 @@ class SumAccumulator inline void Initialize() { - m_Sum = NumericTraits::ZeroValue(); + m_Sum = TOutputPixel{}; } inline void diff --git a/Modules/Filtering/ImageStatistics/test/itkImageMomentsTest.cxx b/Modules/Filtering/ImageStatistics/test/itkImageMomentsTest.cxx index d47b76cf111..a727bb893dc 100644 --- a/Modules/Filtering/ImageStatistics/test/itkImageMomentsTest.cxx +++ b/Modules/Filtering/ImageStatistics/test/itkImageMomentsTest.cxx @@ -98,7 +98,7 @@ itkImageMomentsTest(int argc, char * argv[]) image->SetSpacing(spacing); image->Allocate(); - image->FillBuffer(itk::NumericTraits::ZeroValue()); + image->FillBuffer(PixelType{}); /* Set a few mass points within the image */ /* FIXME: The method used here to set the points is klutzy, diff --git a/Modules/Filtering/ImageStatistics/test/itkLabelOverlapMeasuresImageFilterGTest.cxx b/Modules/Filtering/ImageStatistics/test/itkLabelOverlapMeasuresImageFilterGTest.cxx index 2c1dadf9b12..df0acb22306 100644 --- a/Modules/Filtering/ImageStatistics/test/itkLabelOverlapMeasuresImageFilterGTest.cxx +++ b/Modules/Filtering/ImageStatistics/test/itkLabelOverlapMeasuresImageFilterGTest.cxx @@ -45,7 +45,7 @@ class LabelOverlapMeasuresImageFilterFixture : public ::testing::Test static typename ImageType::Pointer - CreateImage(PixelType fillValue = itk::NumericTraits::ZeroValue()) + CreateImage(PixelType fillValue = PixelType{}) { auto image = ImageType::New(); diff --git a/Modules/Filtering/LabelMap/include/itkAttributeOpeningLabelMapFilter.hxx b/Modules/Filtering/LabelMap/include/itkAttributeOpeningLabelMapFilter.hxx index ff7cdbce67a..249d34f2945 100644 --- a/Modules/Filtering/LabelMap/include/itkAttributeOpeningLabelMapFilter.hxx +++ b/Modules/Filtering/LabelMap/include/itkAttributeOpeningLabelMapFilter.hxx @@ -27,7 +27,7 @@ namespace itk template AttributeOpeningLabelMapFilter::AttributeOpeningLabelMapFilter() { - m_Lambda = NumericTraits::ZeroValue(); + m_Lambda = AttributeValueType{}; m_ReverseOrdering = false; // create the output image for the removed objects this->SetNumberOfRequiredOutputs(2); diff --git a/Modules/Filtering/LabelMap/include/itkBinaryGrindPeakImageFilter.hxx b/Modules/Filtering/LabelMap/include/itkBinaryGrindPeakImageFilter.hxx index 24309aa02d0..30990c5b763 100644 --- a/Modules/Filtering/LabelMap/include/itkBinaryGrindPeakImageFilter.hxx +++ b/Modules/Filtering/LabelMap/include/itkBinaryGrindPeakImageFilter.hxx @@ -29,7 +29,7 @@ namespace itk template BinaryGrindPeakImageFilter::BinaryGrindPeakImageFilter() : m_ForegroundValue(NumericTraits::max()) - , m_BackgroundValue(NumericTraits::ZeroValue()) + , m_BackgroundValue(InputImagePixelType{}) {} diff --git a/Modules/Filtering/LabelMap/include/itkLabelMapMaskImageFilter.h b/Modules/Filtering/LabelMap/include/itkLabelMapMaskImageFilter.h index e72d40f2319..f4374883ec8 100644 --- a/Modules/Filtering/LabelMap/include/itkLabelMapMaskImageFilter.h +++ b/Modules/Filtering/LabelMap/include/itkLabelMapMaskImageFilter.h @@ -117,7 +117,7 @@ class ITK_TEMPLATE_EXPORT LabelMapMaskImageFilter : public LabelMapFilter::ZeroValue(). + * Defaults to PixelType{}. */ itkSetMacro(BackgroundValue, OutputImagePixelType); itkGetConstMacro(BackgroundValue, OutputImagePixelType); diff --git a/Modules/Filtering/LabelMap/include/itkLabelMapMaskImageFilter.hxx b/Modules/Filtering/LabelMap/include/itkLabelMapMaskImageFilter.hxx index 6701ae74d41..9f2b5780da1 100644 --- a/Modules/Filtering/LabelMap/include/itkLabelMapMaskImageFilter.hxx +++ b/Modules/Filtering/LabelMap/include/itkLabelMapMaskImageFilter.hxx @@ -30,7 +30,7 @@ namespace itk template LabelMapMaskImageFilter::LabelMapMaskImageFilter() : m_Label(NumericTraits::OneValue()) - , m_BackgroundValue(NumericTraits::ZeroValue()) + , m_BackgroundValue(OutputImagePixelType{}) { this->SetNumberOfRequiredInputs(2); diff --git a/Modules/Filtering/LabelMap/include/itkLabelObject.hxx b/Modules/Filtering/LabelMap/include/itkLabelObject.hxx index cfab9cb0db8..633ad683466 100644 --- a/Modules/Filtering/LabelMap/include/itkLabelObject.hxx +++ b/Modules/Filtering/LabelMap/include/itkLabelObject.hxx @@ -27,7 +27,7 @@ namespace itk template LabelObject::LabelObject() { - m_Label = NumericTraits::ZeroValue(); + m_Label = LabelType{}; m_LineContainer.clear(); } diff --git a/Modules/Filtering/LabelMap/include/itkLabelObjectLine.hxx b/Modules/Filtering/LabelMap/include/itkLabelObjectLine.hxx index 9da7774b9c4..70a0e1c3741 100644 --- a/Modules/Filtering/LabelMap/include/itkLabelObjectLine.hxx +++ b/Modules/Filtering/LabelMap/include/itkLabelObjectLine.hxx @@ -23,9 +23,9 @@ namespace itk { template LabelObjectLine::LabelObjectLine() - : m_Length(NumericTraits::ZeroValue()) + : m_Length(SizeValueType{}) { - m_Index.Fill(NumericTraits::ZeroValue()); + m_Index.Fill(IndexValueType{}); } template diff --git a/Modules/Filtering/LabelMap/include/itkObjectByObjectLabelMapFilter.hxx b/Modules/Filtering/LabelMap/include/itkObjectByObjectLabelMapFilter.hxx index 568fdd10059..2a20fdcde71 100644 --- a/Modules/Filtering/LabelMap/include/itkObjectByObjectLabelMapFilter.hxx +++ b/Modules/Filtering/LabelMap/include/itkObjectByObjectLabelMapFilter.hxx @@ -78,7 +78,7 @@ ObjectByObjectLabelMapFilterSetNumberOfWorkUnits(1); // to be sure that no one will use an uninitialized value - m_Label = itk::NumericTraits::ZeroValue(); + m_Label = InputImagePixelType{}; } diff --git a/Modules/Filtering/LabelMap/include/itkShapeLabelMapFilter.hxx b/Modules/Filtering/LabelMap/include/itkShapeLabelMapFilter.hxx index 185114dc0a7..92a54668a58 100644 --- a/Modules/Filtering/LabelMap/include/itkShapeLabelMapFilter.hxx +++ b/Modules/Filtering/LabelMap/include/itkShapeLabelMapFilter.hxx @@ -352,7 +352,7 @@ ShapeLabelMapFilter::ThreadedProcessLabelObject(LabelObject } else { - if (Math::NotAlmostEquals(principalMoments[0], itk::NumericTraits::ZeroValue())) + if (Math::NotAlmostEquals(principalMoments[0], typename VectorType::ValueType{})) { const double flatnessRatio = principalMoments[1] / principalMoments[0]; flatness = 0.0; @@ -361,8 +361,7 @@ ShapeLabelMapFilter::ThreadedProcessLabelObject(LabelObject flatness = std::sqrt(flatnessRatio); } } - if (Math::NotAlmostEquals(principalMoments[ImageDimension - 2], - itk::NumericTraits::ZeroValue())) + if (Math::NotAlmostEquals(principalMoments[ImageDimension - 2], typename VectorType::ValueType{})) { const double elongationRatio = principalMoments[ImageDimension - 1] / principalMoments[ImageDimension - 2]; elongation = 0.0; diff --git a/Modules/Filtering/LabelMap/include/itkStatisticsLabelMapFilter.hxx b/Modules/Filtering/LabelMap/include/itkStatisticsLabelMapFilter.hxx index d4660f4c470..af20356495b 100644 --- a/Modules/Filtering/LabelMap/include/itkStatisticsLabelMapFilter.hxx +++ b/Modules/Filtering/LabelMap/include/itkStatisticsLabelMapFilter.hxx @@ -271,8 +271,7 @@ StatisticsLabelMapFilter::ThreadedProcessLabelObject(Labe elongation = 1; flatness = 1; } - else if (Math::NotAlmostEquals(principalMoments[0], - itk::NumericTraits::ZeroValue())) + else if (Math::NotAlmostEquals(principalMoments[0], typename VectorType::ValueType{})) { // elongation = principalMoments[ImageDimension-1] / // principalMoments[0]; diff --git a/Modules/Filtering/LabelMap/test/itkStatisticsUniqueLabelMapFilterTest1.cxx b/Modules/Filtering/LabelMap/test/itkStatisticsUniqueLabelMapFilterTest1.cxx index 87e42d9279b..c98f058a9ba 100644 --- a/Modules/Filtering/LabelMap/test/itkStatisticsUniqueLabelMapFilterTest1.cxx +++ b/Modules/Filtering/LabelMap/test/itkStatisticsUniqueLabelMapFilterTest1.cxx @@ -72,7 +72,7 @@ itkStatisticsUniqueLabelMapFilterTest1(int argc, char * argv[]) using LabelImageToLabelMapFilterType = itk::LabelImageToLabelMapFilter; auto labelMapConverter = LabelImageToLabelMapFilterType::New(); labelMapConverter->SetInput(reader->GetOutput()); - labelMapConverter->SetBackgroundValue(itk::NumericTraits::ZeroValue()); + labelMapConverter->SetBackgroundValue(PixelType{}); using StructuringElementType = itk::FlatStructuringElement; StructuringElementType::RadiusType radius; diff --git a/Modules/Filtering/MathematicalMorphology/include/itkAnchorErodeDilateImageFilter.hxx b/Modules/Filtering/MathematicalMorphology/include/itkAnchorErodeDilateImageFilter.hxx index 0c69e0b42e2..cfd51e155a6 100644 --- a/Modules/Filtering/MathematicalMorphology/include/itkAnchorErodeDilateImageFilter.hxx +++ b/Modules/Filtering/MathematicalMorphology/include/itkAnchorErodeDilateImageFilter.hxx @@ -24,7 +24,7 @@ namespace itk { template AnchorErodeDilateImageFilter::AnchorErodeDilateImageFilter() - : m_Boundary(NumericTraits::ZeroValue()) + : m_Boundary(InputImagePixelType{}) { this->DynamicMultiThreadingOn(); } diff --git a/Modules/Filtering/MathematicalMorphology/include/itkAnchorOpenCloseImageFilter.hxx b/Modules/Filtering/MathematicalMorphology/include/itkAnchorOpenCloseImageFilter.hxx index c332d8623a0..85fc029e09b 100644 --- a/Modules/Filtering/MathematicalMorphology/include/itkAnchorOpenCloseImageFilter.hxx +++ b/Modules/Filtering/MathematicalMorphology/include/itkAnchorOpenCloseImageFilter.hxx @@ -26,8 +26,8 @@ namespace itk { template AnchorOpenCloseImageFilter::AnchorOpenCloseImageFilter() - : m_Boundary1(NumericTraits::ZeroValue()) - , m_Boundary2(NumericTraits::ZeroValue()) + : m_Boundary1(InputImagePixelType{}) + , m_Boundary2(InputImagePixelType{}) { this->DynamicMultiThreadingOn(); } diff --git a/Modules/Filtering/MathematicalMorphology/include/itkBasicDilateImageFilter.hxx b/Modules/Filtering/MathematicalMorphology/include/itkBasicDilateImageFilter.hxx index 616d3a68d20..686eaed214e 100644 --- a/Modules/Filtering/MathematicalMorphology/include/itkBasicDilateImageFilter.hxx +++ b/Modules/Filtering/MathematicalMorphology/include/itkBasicDilateImageFilter.hxx @@ -44,7 +44,7 @@ BasicDilateImageFilter::Evaluate(const Neigh { // if structuring element is positive, use the pixel under that element // in the image - if (*kernel_it > NumericTraits::ZeroValue()) + if (*kernel_it > KernelPixelType{}) { // note we use GetPixel() on the SmartNeighborhoodIterator to // respect boundary conditions diff --git a/Modules/Filtering/MathematicalMorphology/include/itkBasicErodeImageFilter.hxx b/Modules/Filtering/MathematicalMorphology/include/itkBasicErodeImageFilter.hxx index c3de85a0ab7..163f929995f 100644 --- a/Modules/Filtering/MathematicalMorphology/include/itkBasicErodeImageFilter.hxx +++ b/Modules/Filtering/MathematicalMorphology/include/itkBasicErodeImageFilter.hxx @@ -44,7 +44,7 @@ BasicErodeImageFilter::Evaluate(const Neighb { // if structuring element is positive, use the pixel under that element // in the image - if (*kernel_it > NumericTraits::ZeroValue()) + if (*kernel_it > KernelPixelType{}) { // note we use GetPixel() on the NeighborhoodIterator in order // to respect boundary conditions. diff --git a/Modules/Filtering/MathematicalMorphology/include/itkDoubleThresholdImageFilter.h b/Modules/Filtering/MathematicalMorphology/include/itkDoubleThresholdImageFilter.h index 2913c4caa38..d1cd693fccc 100644 --- a/Modules/Filtering/MathematicalMorphology/include/itkDoubleThresholdImageFilter.h +++ b/Modules/Filtering/MathematicalMorphology/include/itkDoubleThresholdImageFilter.h @@ -77,7 +77,7 @@ class ITK_TEMPLATE_EXPORT DoubleThresholdImageFilter : public ImageToImageFilter using OutputPixelType = typename TOutputImage::PixelType; /** Set the "outside" pixel value. The default value - * NumericTraits::ZeroValue(). */ + * OutputPixelType{}. */ itkSetMacro(OutsideValue, OutputPixelType); /** Get the "outside" pixel value. */ diff --git a/Modules/Filtering/MathematicalMorphology/include/itkDoubleThresholdImageFilter.hxx b/Modules/Filtering/MathematicalMorphology/include/itkDoubleThresholdImageFilter.hxx index 251e94433ba..0c0404073db 100644 --- a/Modules/Filtering/MathematicalMorphology/include/itkDoubleThresholdImageFilter.hxx +++ b/Modules/Filtering/MathematicalMorphology/include/itkDoubleThresholdImageFilter.hxx @@ -33,7 +33,7 @@ DoubleThresholdImageFilter::DoubleThresholdImageFilte m_Threshold3 = NumericTraits::max(); m_Threshold4 = NumericTraits::max(); - m_OutsideValue = NumericTraits::ZeroValue(); + m_OutsideValue = OutputPixelType{}; m_InsideValue = NumericTraits::max(); m_FullyConnected = false; diff --git a/Modules/Filtering/MathematicalMorphology/include/itkGrayscaleConnectedClosingImageFilter.hxx b/Modules/Filtering/MathematicalMorphology/include/itkGrayscaleConnectedClosingImageFilter.hxx index a4a620d169f..f2fd784b399 100644 --- a/Modules/Filtering/MathematicalMorphology/include/itkGrayscaleConnectedClosingImageFilter.hxx +++ b/Modules/Filtering/MathematicalMorphology/include/itkGrayscaleConnectedClosingImageFilter.hxx @@ -29,7 +29,7 @@ template GrayscaleConnectedClosingImageFilter::GrayscaleConnectedClosingImageFilter() { - m_Seed.Fill(NumericTraits::ZeroValue()); + m_Seed.Fill(typename InputImageIndexType::OffsetValueType{}); m_FullyConnected = false; } diff --git a/Modules/Filtering/MathematicalMorphology/include/itkGrayscaleConnectedOpeningImageFilter.hxx b/Modules/Filtering/MathematicalMorphology/include/itkGrayscaleConnectedOpeningImageFilter.hxx index cc11f52da49..e5ebc9ccfd2 100644 --- a/Modules/Filtering/MathematicalMorphology/include/itkGrayscaleConnectedOpeningImageFilter.hxx +++ b/Modules/Filtering/MathematicalMorphology/include/itkGrayscaleConnectedOpeningImageFilter.hxx @@ -29,7 +29,7 @@ template GrayscaleConnectedOpeningImageFilter::GrayscaleConnectedOpeningImageFilter() { - m_Seed.Fill(NumericTraits::ZeroValue()); + m_Seed.Fill(typename InputImageIndexType::OffsetValueType{}); m_FullyConnected = false; } diff --git a/Modules/Filtering/MathematicalMorphology/include/itkGrayscaleFunctionDilateImageFilter.hxx b/Modules/Filtering/MathematicalMorphology/include/itkGrayscaleFunctionDilateImageFilter.hxx index c0b1bfad9b3..97dd6505c4c 100644 --- a/Modules/Filtering/MathematicalMorphology/include/itkGrayscaleFunctionDilateImageFilter.hxx +++ b/Modules/Filtering/MathematicalMorphology/include/itkGrayscaleFunctionDilateImageFilter.hxx @@ -45,7 +45,7 @@ GrayscaleFunctionDilateImageFilter::Evaluate { // if structuring element is positive, use the pixel under that element // in the image plus the structuring element value - if (*kernel_it > NumericTraits::ZeroValue()) + if (*kernel_it > KernelPixelType{}) { // add the structuring element value to the pixel value, note we use // GetPixel() on SmartNeighborhoodIterator to respect boundary diff --git a/Modules/Filtering/MathematicalMorphology/include/itkGrayscaleFunctionErodeImageFilter.hxx b/Modules/Filtering/MathematicalMorphology/include/itkGrayscaleFunctionErodeImageFilter.hxx index 2507e2fe6de..b545f75de68 100644 --- a/Modules/Filtering/MathematicalMorphology/include/itkGrayscaleFunctionErodeImageFilter.hxx +++ b/Modules/Filtering/MathematicalMorphology/include/itkGrayscaleFunctionErodeImageFilter.hxx @@ -45,7 +45,7 @@ GrayscaleFunctionErodeImageFilter::Evaluate( { // if structuring element is positive, use the pixel under that element // in the image minus the structuring element value - if (*kernel_it > NumericTraits::ZeroValue()) + if (*kernel_it > KernelPixelType{}) { // subtract the structuring element value to the pixel value, // note we use GetPixel() on SmartNeighborhoodIterator to respect diff --git a/Modules/Filtering/MathematicalMorphology/include/itkMaskedMovingHistogramImageFilter.hxx b/Modules/Filtering/MathematicalMorphology/include/itkMaskedMovingHistogramImageFilter.hxx index fbfae92a4fd..495539a3364 100644 --- a/Modules/Filtering/MathematicalMorphology/include/itkMaskedMovingHistogramImageFilter.hxx +++ b/Modules/Filtering/MathematicalMorphology/include/itkMaskedMovingHistogramImageFilter.hxx @@ -43,9 +43,9 @@ MaskedMovingHistogramImageFilterSetNumberOfRequiredInputs(2); - this->m_FillValue = NumericTraits::ZeroValue(); + this->m_FillValue = OutputPixelType{}; this->m_MaskValue = NumericTraits::max(); - this->m_BackgroundMaskValue = NumericTraits::ZeroValue(); + this->m_BackgroundMaskValue = MaskPixelType{}; this->m_GenerateOutputMask = true; this->SetGenerateOutputMask(false); this->DynamicMultiThreadingOn(); diff --git a/Modules/Filtering/MathematicalMorphology/include/itkMorphologyImageFilter.hxx b/Modules/Filtering/MathematicalMorphology/include/itkMorphologyImageFilter.hxx index 589a1c32e47..262f2139164 100644 --- a/Modules/Filtering/MathematicalMorphology/include/itkMorphologyImageFilter.hxx +++ b/Modules/Filtering/MathematicalMorphology/include/itkMorphologyImageFilter.hxx @@ -29,7 +29,7 @@ namespace itk template MorphologyImageFilter::MorphologyImageFilter() { - m_DefaultBoundaryCondition.SetConstant(NumericTraits::ZeroValue()); + m_DefaultBoundaryCondition.SetConstant(PixelType{}); m_BoundaryCondition = &m_DefaultBoundaryCondition; this->DynamicMultiThreadingOn(); this->ThreaderUpdateProgressOff(); diff --git a/Modules/Filtering/MathematicalMorphology/include/itkMovingHistogramMorphologicalGradientImageFilter.h b/Modules/Filtering/MathematicalMorphology/include/itkMovingHistogramMorphologicalGradientImageFilter.h index 36d3141fa0a..2a7a73301b9 100644 --- a/Modules/Filtering/MathematicalMorphology/include/itkMovingHistogramMorphologicalGradientImageFilter.h +++ b/Modules/Filtering/MathematicalMorphology/include/itkMovingHistogramMorphologicalGradientImageFilter.h @@ -179,7 +179,7 @@ class VectorMorphologicalGradientHistogram } else { - return NumericTraits::ZeroValue(); + return TInputPixel{}; } } diff --git a/Modules/Filtering/MathematicalMorphology/include/itkMovingHistogramMorphologyImageFilter.hxx b/Modules/Filtering/MathematicalMorphology/include/itkMovingHistogramMorphologyImageFilter.hxx index 516d63924b0..1c633902b27 100644 --- a/Modules/Filtering/MathematicalMorphology/include/itkMovingHistogramMorphologyImageFilter.hxx +++ b/Modules/Filtering/MathematicalMorphology/include/itkMovingHistogramMorphologyImageFilter.hxx @@ -25,7 +25,7 @@ namespace itk template MovingHistogramMorphologyImageFilter:: MovingHistogramMorphologyImageFilter() - : m_Boundary(NumericTraits::ZeroValue()) + : m_Boundary(PixelType{}) {} template diff --git a/Modules/Filtering/MathematicalMorphology/include/itkVanHerkGilWermanErodeDilateImageFilter.hxx b/Modules/Filtering/MathematicalMorphology/include/itkVanHerkGilWermanErodeDilateImageFilter.hxx index 9382b6596c5..cd2ff9139e0 100644 --- a/Modules/Filtering/MathematicalMorphology/include/itkVanHerkGilWermanErodeDilateImageFilter.hxx +++ b/Modules/Filtering/MathematicalMorphology/include/itkVanHerkGilWermanErodeDilateImageFilter.hxx @@ -26,7 +26,7 @@ namespace itk { template VanHerkGilWermanErodeDilateImageFilter::VanHerkGilWermanErodeDilateImageFilter() - : m_Boundary(NumericTraits::ZeroValue()) + : m_Boundary(InputImagePixelType{}) { this->DynamicMultiThreadingOn(); this->ThreaderUpdateProgressOff(); diff --git a/Modules/Filtering/MathematicalMorphology/test/itkFlatStructuringElementTest2.cxx b/Modules/Filtering/MathematicalMorphology/test/itkFlatStructuringElementTest2.cxx index 05bf651b86d..6db3835d359 100644 --- a/Modules/Filtering/MathematicalMorphology/test/itkFlatStructuringElementTest2.cxx +++ b/Modules/Filtering/MathematicalMorphology/test/itkFlatStructuringElementTest2.cxx @@ -62,7 +62,7 @@ GetImage(const itk::FlatStructuringElement & flatElement) } else { - img_it.Set(NumericTraits::ZeroValue()); + img_it.Set(PixelType{}); } } return image; @@ -103,7 +103,7 @@ itkFlatStructuringElementTest2(int argc, char * argv[]) using RescaleType = itk::RescaleIntensityImageFilter; auto rescale = RescaleType::New(); rescale->SetInput(testImg); - rescale->SetOutputMinimum(itk::NumericTraits::ZeroValue()); + rescale->SetOutputMinimum(bool{}); rescale->SetOutputMaximum(itk::NumericTraits::OneValue()); using castFilterType = itk::CastImageFilter; diff --git a/Modules/Filtering/Path/include/itkContourExtractor2DImageFilter.hxx b/Modules/Filtering/Path/include/itkContourExtractor2DImageFilter.hxx index 31b40c42880..4b0f8bb4fcd 100644 --- a/Modules/Filtering/Path/include/itkContourExtractor2DImageFilter.hxx +++ b/Modules/Filtering/Path/include/itkContourExtractor2DImageFilter.hxx @@ -32,7 +32,7 @@ namespace itk template ContourExtractor2DImageFilter::ContourExtractor2DImageFilter() { - this->m_ContourValue = NumericTraits::ZeroValue(); + this->m_ContourValue = InputRealType{}; this->m_ReverseContourOrientation = false; this->m_VertexConnectHighPixels = false; this->m_LabelContours = false; diff --git a/Modules/Filtering/Path/include/itkExtractOrthogonalSwath2DImageFilter.h b/Modules/Filtering/Path/include/itkExtractOrthogonalSwath2DImageFilter.h index b01f0147ab2..9e5cd066fb3 100644 --- a/Modules/Filtering/Path/include/itkExtractOrthogonalSwath2DImageFilter.h +++ b/Modules/Filtering/Path/include/itkExtractOrthogonalSwath2DImageFilter.h @@ -131,7 +131,7 @@ class ITK_TEMPLATE_EXPORT ExtractOrthogonalSwath2DImageFilter protected: ExtractOrthogonalSwath2DImageFilter() { - m_DefaultPixelValue = NumericTraits::ZeroValue(); + m_DefaultPixelValue = ImagePixelType{}; m_Size[0] = 512; m_Size[1] = 16 * 2 + 1; // must be odd m_Origin[0] = m_Origin[1] = 0.0; diff --git a/Modules/Filtering/Path/include/itkPath.h b/Modules/Filtering/Path/include/itkPath.h index f855b94bc72..bf5a0efa012 100644 --- a/Modules/Filtering/Path/include/itkPath.h +++ b/Modules/Filtering/Path/include/itkPath.h @@ -84,7 +84,7 @@ class ITK_TEMPLATE_EXPORT Path : public DataObject virtual inline InputType StartOfInput() const { - return NumericTraits::ZeroValue(); + return InputType{}; } /** Where does the path end (what is the last valid input value)? This value diff --git a/Modules/Filtering/Path/include/itkPathToImageFilter.hxx b/Modules/Filtering/Path/include/itkPathToImageFilter.hxx index e0ec2de8013..0dcd1d12f0b 100644 --- a/Modules/Filtering/Path/include/itkPathToImageFilter.hxx +++ b/Modules/Filtering/Path/include/itkPathToImageFilter.hxx @@ -40,7 +40,7 @@ PathToImageFilter::PathToImageFilter() } m_PathValue = NumericTraits::OneValue(); - m_BackgroundValue = NumericTraits::ZeroValue(); + m_BackgroundValue = ValueType{}; } /** Set the Input SpatialObject */ diff --git a/Modules/Filtering/QuadEdgeMeshFiltering/include/itkCleanQuadEdgeMeshFilter.hxx b/Modules/Filtering/QuadEdgeMeshFiltering/include/itkCleanQuadEdgeMeshFilter.hxx index a4951d23d55..51f459ad851 100644 --- a/Modules/Filtering/QuadEdgeMeshFiltering/include/itkCleanQuadEdgeMeshFilter.hxx +++ b/Modules/Filtering/QuadEdgeMeshFiltering/include/itkCleanQuadEdgeMeshFilter.hxx @@ -26,8 +26,8 @@ namespace itk template CleanQuadEdgeMeshFilter::CleanQuadEdgeMeshFilter() { - this->m_AbsoluteTolerance = NumericTraits::ZeroValue(); - this->m_RelativeTolerance = NumericTraits::ZeroValue(); + this->m_AbsoluteTolerance = InputCoordRepType{}; + this->m_RelativeTolerance = InputCoordRepType{}; this->m_BoundingBox = BoundingBoxType::New(); diff --git a/Modules/Filtering/QuadEdgeMeshFiltering/include/itkLaplacianDeformationQuadEdgeMeshFilter.hxx b/Modules/Filtering/QuadEdgeMeshFiltering/include/itkLaplacianDeformationQuadEdgeMeshFilter.hxx index 7a1f696b014..c5e18380d96 100644 --- a/Modules/Filtering/QuadEdgeMeshFiltering/include/itkLaplacianDeformationQuadEdgeMeshFilter.hxx +++ b/Modules/Filtering/QuadEdgeMeshFiltering/include/itkLaplacianDeformationQuadEdgeMeshFilter.hxx @@ -92,7 +92,7 @@ LaplacianDeformationQuadEdgeMeshFilter:: if (area < itk::Math::eps) { - return NumericTraits::ZeroValue(); + return OutputCoordRepType{}; } else { @@ -101,7 +101,7 @@ LaplacianDeformationQuadEdgeMeshFilter:: } else { - return NumericTraits::ZeroValue(); + return OutputCoordRepType{}; } } diff --git a/Modules/Filtering/QuadEdgeMeshFiltering/include/itkQuadEdgeMeshDecimationCriteria.h b/Modules/Filtering/QuadEdgeMeshFiltering/include/itkQuadEdgeMeshDecimationCriteria.h index ef4383381c2..3f4f1996b3f 100644 --- a/Modules/Filtering/QuadEdgeMeshFiltering/include/itkQuadEdgeMeshDecimationCriteria.h +++ b/Modules/Filtering/QuadEdgeMeshFiltering/include/itkQuadEdgeMeshDecimationCriteria.h @@ -79,7 +79,7 @@ class QuadEdgeMeshDecimationCriterion : public Object this->m_TopologicalChange = true; this->m_SizeCriterion = true; this->m_NumberOfElements = 0; - this->m_MeasureBound = itk::NumericTraits::ZeroValue(); + this->m_MeasureBound = MeasureType{}; } ~QuadEdgeMeshDecimationCriterion() override = default; diff --git a/Modules/Filtering/QuadEdgeMeshFiltering/include/itkQuadEdgeMeshDecimationQuadricElementHelper.h b/Modules/Filtering/QuadEdgeMeshFiltering/include/itkQuadEdgeMeshDecimationQuadricElementHelper.h index a78b9d868ea..0546ab9b285 100644 --- a/Modules/Filtering/QuadEdgeMeshFiltering/include/itkQuadEdgeMeshDecimationQuadricElementHelper.h +++ b/Modules/Filtering/QuadEdgeMeshFiltering/include/itkQuadEdgeMeshDecimationQuadricElementHelper.h @@ -47,9 +47,9 @@ class QuadEdgeMeshDecimationQuadricElementHelper // ***************************************************************** QuadEdgeMeshDecimationQuadricElementHelper() - : m_Coefficients(itk::NumericTraits::ZeroValue()) - , m_A(PointDimension, PointDimension, itk::NumericTraits::ZeroValue()) - , m_B(itk::NumericTraits::ZeroValue()) + : m_Coefficients(CoordType{}) + , m_A(PointDimension, PointDimension, CoordType{}) + , m_B(CoordType{}) , m_SVDAbsoluteThreshold(static_cast(1e-6)) , m_SVDRelativeThreshold(static_cast(1e-3)) { @@ -58,8 +58,8 @@ class QuadEdgeMeshDecimationQuadricElementHelper QuadEdgeMeshDecimationQuadricElementHelper(const CoefficientVectorType & iCoefficients) : m_Coefficients(iCoefficients) - , m_A(PointDimension, PointDimension, itk::NumericTraits::ZeroValue()) - , m_B(itk::NumericTraits::ZeroValue()) + , m_A(PointDimension, PointDimension, CoordType{}) + , m_B(CoordType{}) , m_SVDAbsoluteThreshold(static_cast(1e-3)) , m_SVDRelativeThreshold(static_cast(1e-3)) { diff --git a/Modules/Filtering/QuadEdgeMeshFiltering/include/itkQuadEdgeMeshParamMatrixCoefficients.h b/Modules/Filtering/QuadEdgeMeshFiltering/include/itkQuadEdgeMeshParamMatrixCoefficients.h index 9e2b918a0d0..780a71f2d9a 100644 --- a/Modules/Filtering/QuadEdgeMeshFiltering/include/itkQuadEdgeMeshParamMatrixCoefficients.h +++ b/Modules/Filtering/QuadEdgeMeshFiltering/include/itkQuadEdgeMeshParamMatrixCoefficients.h @@ -164,7 +164,7 @@ class ITK_TEMPLATE_EXPORT ConformalMatrixCoefficients : public MatrixCoefficient oValue += TriangleHelper::Cotangent(pt1, ptB, pt2); } - return std::max(NumericTraits::ZeroValue(), oValue); + return std::max(InputCoordRepType{}, oValue); } }; diff --git a/Modules/Filtering/Smoothing/include/itkBoxUtilities.h b/Modules/Filtering/Smoothing/include/itkBoxUtilities.h index 5c3e6236e0e..c78ce8aebf4 100644 --- a/Modules/Filtering/Smoothing/include/itkBoxUtilities.h +++ b/Modules/Filtering/Smoothing/include/itkBoxUtilities.h @@ -125,7 +125,7 @@ BoxAccumulateFunction(const TInputImage * inputImage, itk_impl_details::setConnectivityEarlyBox(&noutIt, true); ConstantBoundaryCondition oBC; - oBC.SetConstant(NumericTraits::ZeroValue()); + oBC.SetConstant(OutputPixelType{}); noutIt.OverrideBoundaryCondition(&oBC); // This uses several iterators. An alternative and probably better // approach would be to copy the input to the output and convolve @@ -618,7 +618,7 @@ BoxSquareAccumulateFunction(const TInputImage * inputImage, itk_impl_details::setConnectivityEarlyBox(&noutIt, true); ConstantBoundaryCondition oBC; - oBC.SetConstant(NumericTraits::ZeroValue()); + oBC.SetConstant(OutputPixelType{}); noutIt.OverrideBoundaryCondition(&oBC); // This uses several iterators. An alternative and probably better // approach would be to copy the input to the output and convolve diff --git a/Modules/Filtering/Smoothing/include/itkMeanImageFilter.hxx b/Modules/Filtering/Smoothing/include/itkMeanImageFilter.hxx index 2a1fa452da9..520b32ba18e 100644 --- a/Modules/Filtering/Smoothing/include/itkMeanImageFilter.hxx +++ b/Modules/Filtering/Smoothing/include/itkMeanImageFilter.hxx @@ -89,7 +89,7 @@ MeanImageFilter::GenerateDataInSubregion( { neighborhoodRange.SetLocation(index); - auto sum = NumericTraits::ZeroValue(); + auto sum = InputRealType{}; for (const InputPixelType pixelValue : neighborhoodRange) { diff --git a/Modules/Filtering/Smoothing/test/itkRecursiveGaussianImageFilterTest.cxx b/Modules/Filtering/Smoothing/test/itkRecursiveGaussianImageFilterTest.cxx index fe8bf7de0a2..3c05aa4c27e 100644 --- a/Modules/Filtering/Smoothing/test/itkRecursiveGaussianImageFilterTest.cxx +++ b/Modules/Filtering/Smoothing/test/itkRecursiveGaussianImageFilterTest.cxx @@ -206,7 +206,7 @@ itkRecursiveGaussianImageFilterTest(int, char *[]) inputImage->SetRegions(region); inputImage->Allocate(); inputImage->SetSpacing(spacing); - inputImage->FillBuffer(itk::NumericTraits::ZeroValue()); + inputImage->FillBuffer(PixelType{}); IndexType index; index[0] = (size[0] - 1) / 2; // the middle pixel @@ -487,7 +487,7 @@ itkRecursiveGaussianImageFilterTest(int, char *[]) inputImage->SetRegions(region); inputImage->Allocate(); inputImage->SetSpacing(spacing); - inputImage->FillBuffer(itk::NumericTraits::ZeroValue()); + inputImage->FillBuffer(PixelType{}); IndexType index; index[0] = (size[0] - 1) / 2; // the middle pixel diff --git a/Modules/Filtering/Thresholding/include/itkBinaryThresholdImageFilter.h b/Modules/Filtering/Thresholding/include/itkBinaryThresholdImageFilter.h index 902520c312a..a0e75fb973d 100644 --- a/Modules/Filtering/Thresholding/include/itkBinaryThresholdImageFilter.h +++ b/Modules/Filtering/Thresholding/include/itkBinaryThresholdImageFilter.h @@ -71,7 +71,7 @@ class ITK_TEMPLATE_EXPORT BinaryThreshold { m_LowerThreshold = NumericTraits::NonpositiveMin(); m_UpperThreshold = NumericTraits::max(); - m_OutsideValue = NumericTraits::ZeroValue(); + m_OutsideValue = TOutput{}; m_InsideValue = NumericTraits::max(); } @@ -160,7 +160,7 @@ class ITK_TEMPLATE_EXPORT BinaryThresholdImageFilter using InputPixelObjectType = SimpleDataObjectDecorator; /** Set the "outside" pixel value. The default value - * NumericTraits::ZeroValue(). */ + * OutputPixelType{}. */ itkSetMacro(OutsideValue, OutputPixelType); /** Get the "outside" pixel value. */ diff --git a/Modules/Filtering/Thresholding/include/itkBinaryThresholdImageFilter.hxx b/Modules/Filtering/Thresholding/include/itkBinaryThresholdImageFilter.hxx index 24218b4c933..a4e65e027b4 100644 --- a/Modules/Filtering/Thresholding/include/itkBinaryThresholdImageFilter.hxx +++ b/Modules/Filtering/Thresholding/include/itkBinaryThresholdImageFilter.hxx @@ -36,7 +36,7 @@ namespace itk template BinaryThresholdImageFilter::BinaryThresholdImageFilter() : m_InsideValue(NumericTraits::max()) - , m_OutsideValue(NumericTraits::ZeroValue()) + , m_OutsideValue(OutputPixelType{}) { // We are going to create the object with a few default inputs to // hold the threshold values. diff --git a/Modules/Filtering/Thresholding/include/itkBinaryThresholdProjectionImageFilter.h b/Modules/Filtering/Thresholding/include/itkBinaryThresholdProjectionImageFilter.h index b77614e9982..86f354198ab 100644 --- a/Modules/Filtering/Thresholding/include/itkBinaryThresholdProjectionImageFilter.h +++ b/Modules/Filtering/Thresholding/include/itkBinaryThresholdProjectionImageFilter.h @@ -154,7 +154,7 @@ class BinaryThresholdProjectionImageFilter { m_ForegroundValue = NumericTraits::max(); m_BackgroundValue = NumericTraits::NonpositiveMin(); - m_ThresholdValue = NumericTraits::ZeroValue(); + m_ThresholdValue = InputPixelType{}; } ~BinaryThresholdProjectionImageFilter() override = default; diff --git a/Modules/Filtering/Thresholding/include/itkHistogramThresholdImageFilter.h b/Modules/Filtering/Thresholding/include/itkHistogramThresholdImageFilter.h index 696f61b8bcf..c8c4899aea1 100644 --- a/Modules/Filtering/Thresholding/include/itkHistogramThresholdImageFilter.h +++ b/Modules/Filtering/Thresholding/include/itkHistogramThresholdImageFilter.h @@ -138,7 +138,7 @@ class ITK_TEMPLATE_EXPORT HistogramThresholdImageFilter : public ImageToImageFil } /** Set the "outside" pixel value. The default value - * NumericTraits::ZeroValue(). */ + * OutputPixelType{}. */ itkSetMacro(OutsideValue, OutputPixelType); /** Get the "outside" pixel value. */ diff --git a/Modules/Filtering/Thresholding/include/itkHistogramThresholdImageFilter.hxx b/Modules/Filtering/Thresholding/include/itkHistogramThresholdImageFilter.hxx index 7f19ca98393..41eb9343306 100644 --- a/Modules/Filtering/Thresholding/include/itkHistogramThresholdImageFilter.hxx +++ b/Modules/Filtering/Thresholding/include/itkHistogramThresholdImageFilter.hxx @@ -29,8 +29,8 @@ namespace itk template HistogramThresholdImageFilter::HistogramThresholdImageFilter() : m_InsideValue(NumericTraits::max()) - , m_OutsideValue(NumericTraits::ZeroValue()) - , m_Threshold(NumericTraits::ZeroValue()) + , m_OutsideValue(OutputPixelType{}) + , m_Threshold(InputPixelType{}) , m_MaskValue(NumericTraits::max()) { diff --git a/Modules/Filtering/Thresholding/include/itkHuangThresholdCalculator.hxx b/Modules/Filtering/Thresholding/include/itkHuangThresholdCalculator.hxx index 43cbcaf06bf..4f78c522223 100644 --- a/Modules/Filtering/Thresholding/include/itkHuangThresholdCalculator.hxx +++ b/Modules/Filtering/Thresholding/include/itkHuangThresholdCalculator.hxx @@ -32,7 +32,7 @@ HuangThresholdCalculator::GenerateData() const HistogramType * histogram = this->GetInput(); TotalAbsoluteFrequencyType total = histogram->GetTotalFrequency(); - if (total == NumericTraits::ZeroValue()) + if (total == TotalAbsoluteFrequencyType{}) { itkExceptionMacro("Histogram is empty"); } diff --git a/Modules/Filtering/Thresholding/include/itkKappaSigmaThresholdImageCalculator.hxx b/Modules/Filtering/Thresholding/include/itkKappaSigmaThresholdImageCalculator.hxx index 7e96d9152c4..d53a29fece2 100644 --- a/Modules/Filtering/Thresholding/include/itkKappaSigmaThresholdImageCalculator.hxx +++ b/Modules/Filtering/Thresholding/include/itkKappaSigmaThresholdImageCalculator.hxx @@ -26,7 +26,7 @@ namespace itk template KappaSigmaThresholdImageCalculator::KappaSigmaThresholdImageCalculator() : m_MaskValue(NumericTraits::max()) - , m_Output(NumericTraits::ZeroValue()) + , m_Output(InputPixelType{}) {} template diff --git a/Modules/Filtering/Thresholding/include/itkKappaSigmaThresholdImageFilter.h b/Modules/Filtering/Thresholding/include/itkKappaSigmaThresholdImageFilter.h index 57bba2e5ba1..333e3b451b5 100644 --- a/Modules/Filtering/Thresholding/include/itkKappaSigmaThresholdImageFilter.h +++ b/Modules/Filtering/Thresholding/include/itkKappaSigmaThresholdImageFilter.h @@ -78,7 +78,7 @@ class ITK_TEMPLATE_EXPORT KappaSigmaThresholdImageFilter : public ImageToImageFi using MaskImagePointer = typename TMaskImage::Pointer; /** Set the "outside" pixel value. The default value - * NumericTraits::ZeroValue(). */ + * OutputPixelType{}. */ itkSetMacro(OutsideValue, OutputPixelType); /** Get the "outside" pixel value. */ diff --git a/Modules/Filtering/Thresholding/include/itkKappaSigmaThresholdImageFilter.hxx b/Modules/Filtering/Thresholding/include/itkKappaSigmaThresholdImageFilter.hxx index dc3cffd4f2d..daa1389415b 100644 --- a/Modules/Filtering/Thresholding/include/itkKappaSigmaThresholdImageFilter.hxx +++ b/Modules/Filtering/Thresholding/include/itkKappaSigmaThresholdImageFilter.hxx @@ -26,9 +26,9 @@ namespace itk template KappaSigmaThresholdImageFilter::KappaSigmaThresholdImageFilter() : m_MaskValue(NumericTraits::max()) - , m_Threshold(NumericTraits::ZeroValue()) + , m_Threshold(InputPixelType{}) , m_InsideValue(NumericTraits::max()) - , m_OutsideValue(NumericTraits::ZeroValue()) + , m_OutsideValue(OutputPixelType{}) {} template diff --git a/Modules/Filtering/Thresholding/include/itkOtsuMultipleThresholdsCalculator.hxx b/Modules/Filtering/Thresholding/include/itkOtsuMultipleThresholdsCalculator.hxx index 3d258355f2e..4f5c86614a8 100644 --- a/Modules/Filtering/Thresholding/include/itkOtsuMultipleThresholdsCalculator.hxx +++ b/Modules/Filtering/Thresholding/include/itkOtsuMultipleThresholdsCalculator.hxx @@ -27,7 +27,7 @@ OtsuMultipleThresholdsCalculator::OtsuMultipleThresholdsCalcula { m_Output.resize(m_NumberOfThresholds); - std::fill(m_Output.begin(), m_Output.end(), NumericTraits::ZeroValue()); + std::fill(m_Output.begin(), m_Output.end(), MeasurementType{}); } template @@ -77,7 +77,7 @@ OtsuMultipleThresholdsCalculator::IncrementThresholds(InstanceI } else { - classMean[j] = NumericTraits::ZeroValue(); + classMean[j] = MeanType{}; } // Set higher thresholds adjacent to their previous ones, and update mean @@ -92,7 +92,7 @@ OtsuMultipleThresholdsCalculator::IncrementThresholds(InstanceI } else { - classMean[k] = NumericTraits::ZeroValue(); + classMean[k] = MeanType{}; } } @@ -112,7 +112,7 @@ OtsuMultipleThresholdsCalculator::IncrementThresholds(InstanceI } else { - classMean[numberOfClasses - 1] = NumericTraits::ZeroValue(); + classMean[numberOfClasses - 1] = MeanType{}; } // Exit the for loop if a threshold has been incremented @@ -200,7 +200,7 @@ OtsuMultipleThresholdsCalculator::Compute() } else { - classMean[j] = NumericTraits::ZeroValue(); + classMean[j] = MeanType{}; } meanSum += classMean[j] * static_cast(classFrequency[j]); } @@ -212,7 +212,7 @@ OtsuMultipleThresholdsCalculator::Compute() } else { - classMean[numberOfClasses - 1] = NumericTraits::ZeroValue(); + classMean[numberOfClasses - 1] = MeanType{}; } // @@ -297,7 +297,7 @@ OtsuMultipleThresholdsCalculator::Compute() if (m_ValleyEmphasis) { // Sum relevant weights to get valley emphasis factor - valleyEmphasisFactor = NumericTraits::ZeroValue(); + valleyEmphasisFactor = WeightType{}; for (j = 0; j < numberOfClasses - 1; ++j) { valleyEmphasisFactor += imgPDF[thresholdIndexes[j]]; diff --git a/Modules/Filtering/Thresholding/include/itkOtsuMultipleThresholdsImageFilter.h b/Modules/Filtering/Thresholding/include/itkOtsuMultipleThresholdsImageFilter.h index b849d267d55..c899b430c18 100644 --- a/Modules/Filtering/Thresholding/include/itkOtsuMultipleThresholdsImageFilter.h +++ b/Modules/Filtering/Thresholding/include/itkOtsuMultipleThresholdsImageFilter.h @@ -109,10 +109,7 @@ class ITK_TEMPLATE_EXPORT OtsuMultipleThresholdsImageFilter : public ImageToImag itkGetConstMacro(NumberOfThresholds, SizeValueType); /** Set/Get the offset which labels have to start from. Default is 0. */ - itkSetClampMacro(LabelOffset, - OutputPixelType, - NumericTraits::ZeroValue(), - NumericTraits::max()); + itkSetClampMacro(LabelOffset, OutputPixelType, OutputPixelType{}, NumericTraits::max()); itkGetConstMacro(LabelOffset, OutputPixelType); /** Set/Get the use of valley emphasis. Default is false. */ diff --git a/Modules/Filtering/Thresholding/include/itkOtsuMultipleThresholdsImageFilter.hxx b/Modules/Filtering/Thresholding/include/itkOtsuMultipleThresholdsImageFilter.hxx index 20793a7849b..a911075e2cf 100644 --- a/Modules/Filtering/Thresholding/include/itkOtsuMultipleThresholdsImageFilter.hxx +++ b/Modules/Filtering/Thresholding/include/itkOtsuMultipleThresholdsImageFilter.hxx @@ -25,7 +25,7 @@ namespace itk { template OtsuMultipleThresholdsImageFilter::OtsuMultipleThresholdsImageFilter() - : m_LabelOffset(NumericTraits::ZeroValue()) + : m_LabelOffset(OutputPixelType{}) { m_Thresholds.clear(); diff --git a/Modules/Filtering/Thresholding/include/itkRenyiEntropyThresholdCalculator.hxx b/Modules/Filtering/Thresholding/include/itkRenyiEntropyThresholdCalculator.hxx index 65a417ea6b7..542ca32cae5 100644 --- a/Modules/Filtering/Thresholding/include/itkRenyiEntropyThresholdCalculator.hxx +++ b/Modules/Filtering/Thresholding/include/itkRenyiEntropyThresholdCalculator.hxx @@ -32,7 +32,7 @@ RenyiEntropyThresholdCalculator::GenerateData() const HistogramType * histogram = this->GetInput(); TotalAbsoluteFrequencyType total = histogram->GetTotalFrequency(); - if (total == NumericTraits::ZeroValue()) + if (total == TotalAbsoluteFrequencyType{}) { itkExceptionMacro("Histogram is empty"); } @@ -188,7 +188,7 @@ RenyiEntropyThresholdCalculator::MaxEntropyThresholding(con double ent_back = 0.0; for (InstanceIdentifier ih = 0; ih <= it; ++ih) { - if (histogram->GetFrequency(ih, 0) != NumericTraits::ZeroValue()) + if (histogram->GetFrequency(ih, 0) != AbsoluteFrequencyType{}) { double x = (normHisto[ih] / P1[it]); ent_back -= x * std::log(x); @@ -199,7 +199,7 @@ RenyiEntropyThresholdCalculator::MaxEntropyThresholding(con double ent_obj = 0.0; for (InstanceIdentifier ih = it + 1; ih < m_Size; ++ih) { - if (histogram->GetFrequency(ih, 0) != NumericTraits::ZeroValue()) + if (histogram->GetFrequency(ih, 0) != AbsoluteFrequencyType{}) { double x = (normHisto[ih] / P2[it]); ent_obj -= x * std::log(x); diff --git a/Modules/Filtering/Thresholding/include/itkThresholdImageFilter.h b/Modules/Filtering/Thresholding/include/itkThresholdImageFilter.h index 806d6733681..b8965a51521 100644 --- a/Modules/Filtering/Thresholding/include/itkThresholdImageFilter.h +++ b/Modules/Filtering/Thresholding/include/itkThresholdImageFilter.h @@ -97,7 +97,7 @@ class ITK_TEMPLATE_EXPORT ThresholdImageFilter : public InPlaceImageFilter::ZeroValue(). */ + * PixelType{}. */ itkSetMacro(OutsideValue, PixelType); /** Get the "outside" pixel value. */ diff --git a/Modules/Filtering/Thresholding/include/itkThresholdImageFilter.hxx b/Modules/Filtering/Thresholding/include/itkThresholdImageFilter.hxx index 780a84f400a..c70ac006826 100644 --- a/Modules/Filtering/Thresholding/include/itkThresholdImageFilter.hxx +++ b/Modules/Filtering/Thresholding/include/itkThresholdImageFilter.hxx @@ -40,7 +40,7 @@ namespace itk template ThresholdImageFilter::ThresholdImageFilter() - : m_OutsideValue(NumericTraits::ZeroValue()) + : m_OutsideValue(PixelType{}) , m_Lower(NumericTraits::NonpositiveMin()) , m_Upper(NumericTraits::max()) { diff --git a/Modules/Filtering/Thresholding/include/itkThresholdLabelerImageFilter.h b/Modules/Filtering/Thresholding/include/itkThresholdLabelerImageFilter.h index 1a74fc1303b..485fc7d1fe6 100644 --- a/Modules/Filtering/Thresholding/include/itkThresholdLabelerImageFilter.h +++ b/Modules/Filtering/Thresholding/include/itkThresholdLabelerImageFilter.h @@ -197,10 +197,7 @@ class ITK_TEMPLATE_EXPORT ThresholdLabelerImageFilter } /** Set the offset which labels have to start from. */ - itkSetClampMacro(LabelOffset, - OutputPixelType, - NumericTraits::ZeroValue(), - NumericTraits::max()); + itkSetClampMacro(LabelOffset, OutputPixelType, OutputPixelType{}, NumericTraits::max()); itkGetConstMacro(LabelOffset, OutputPixelType); protected: diff --git a/Modules/Filtering/Thresholding/include/itkThresholdLabelerImageFilter.hxx b/Modules/Filtering/Thresholding/include/itkThresholdLabelerImageFilter.hxx index 62bed06168a..652880478c7 100644 --- a/Modules/Filtering/Thresholding/include/itkThresholdLabelerImageFilter.hxx +++ b/Modules/Filtering/Thresholding/include/itkThresholdLabelerImageFilter.hxx @@ -35,7 +35,7 @@ namespace itk template ThresholdLabelerImageFilter::ThresholdLabelerImageFilter() - : m_LabelOffset(NumericTraits::ZeroValue()) + : m_LabelOffset(OutputPixelType{}) { m_Thresholds.clear(); m_RealThresholds.clear(); diff --git a/Modules/Filtering/Thresholding/test/itkBinaryThresholdImageFilterTest.cxx b/Modules/Filtering/Thresholding/test/itkBinaryThresholdImageFilterTest.cxx index 0c9b63067a2..a3bec08e9c0 100644 --- a/Modules/Filtering/Thresholding/test/itkBinaryThresholdImageFilterTest.cxx +++ b/Modules/Filtering/Thresholding/test/itkBinaryThresholdImageFilterTest.cxx @@ -47,7 +47,7 @@ itkBinaryThresholdImageFilterTest(int, char *[]) InputImageType::SizeValueType sizeArray[Dimension] = { 3, 3, 3 }; - source->SetMin(itk::NumericTraits::ZeroValue()); + source->SetMin(InputPixelType{}); source->SetMax(itk::NumericTraits::max()); source->SetSize(sizeArray); diff --git a/Modules/IO/HDF5/test/itkHDF5ImageIOStreamingReadWriteTest.cxx b/Modules/IO/HDF5/test/itkHDF5ImageIOStreamingReadWriteTest.cxx index 019cceaf988..7e11af521a2 100644 --- a/Modules/IO/HDF5/test/itkHDF5ImageIOStreamingReadWriteTest.cxx +++ b/Modules/IO/HDF5/test/itkHDF5ImageIOStreamingReadWriteTest.cxx @@ -60,7 +60,7 @@ class DemoImageSource : public GenerateImageSource itkSetMacro(Value, typename TOutputImage::PixelType); protected: - DemoImageSource() { m_Value = NumericTraits::ZeroValue(); } + DemoImageSource() { m_Value = typename TOutputImage::PixelType{}; } ~DemoImageSource() override = default; /** Does the real work. */ diff --git a/Modules/IO/HDF5/test/itkHDF5ImageIOTest.cxx b/Modules/IO/HDF5/test/itkHDF5ImageIOTest.cxx index 49d8b2e2cf8..4e5cd3623b4 100644 --- a/Modules/IO/HDF5/test/itkHDF5ImageIOTest.cxx +++ b/Modules/IO/HDF5/test/itkHDF5ImageIOTest.cxx @@ -272,7 +272,7 @@ HDF5ReadWriteTest(const char * fileName) } itk::Array metaDataCharArray2; - metaDataCharArray2.Fill(itk::NumericTraits::ZeroValue()); + metaDataCharArray2.Fill(char{}); if (!itk::ExposeMetaData>(metaDict2, "TestCharArray", metaDataCharArray2) || metaDataCharArray2 != metaDataCharArray) { diff --git a/Modules/IO/ImageBase/test/itkVectorImageReadWriteTest.cxx b/Modules/IO/ImageBase/test/itkVectorImageReadWriteTest.cxx index 534f0c6e9f3..539b73012e5 100644 --- a/Modules/IO/ImageBase/test/itkVectorImageReadWriteTest.cxx +++ b/Modules/IO/ImageBase/test/itkVectorImageReadWriteTest.cxx @@ -125,8 +125,7 @@ itkVectorImageReadWriteTest(int argc, char * argv[]) std::cout << "Image of vector pixels write-read [PASSED]" << std::endl; std::cout << "Test << operator:: Vector1 = " << vector1 << "[PASSED]" << std::endl; - std::cout << "Test NumericTraits>::ZeroValue() " << itk::NumericTraits::ZeroValue() - << std::endl; + std::cout << "Test NumericTraits>::ZeroValue() " << PixelType{} << std::endl; std::cout << "Test NumericTraits >::OneValue() " << itk::NumericTraits::OneValue() << std::endl; diff --git a/Modules/IO/MRC/test/itkMRCImageIOTest.cxx b/Modules/IO/MRC/test/itkMRCImageIOTest.cxx index 39c9b38e079..7d6cccccecc 100644 --- a/Modules/IO/MRC/test/itkMRCImageIOTest.cxx +++ b/Modules/IO/MRC/test/itkMRCImageIOTest.cxx @@ -66,7 +66,7 @@ MRCImageIOTester::Write(const std::string & filePrefix, std::string switch (cnt % 4) { case 0: - i.Set(itk::NumericTraits::ZeroValue()); + i.Set(PixelType{}); break; case 1: i.Set(itk::NumericTraits::OneValue()); @@ -228,7 +228,7 @@ MRCImageIOTester::Read(const std::string & filePrefix, std::string & switch (cnt % 4) { case 0: - if (itk::Math::NotExactlyEquals(iter.Get(), itk::NumericTraits::ZeroValue())) + if (itk::Math::NotExactlyEquals(iter.Get(), PixelType{})) { pixelsGood = false; } diff --git a/Modules/IO/MeshBase/src/itkMeshIOBase.cxx b/Modules/IO/MeshBase/src/itkMeshIOBase.cxx index 006d1c0d775..3d7e50f6cfd 100644 --- a/Modules/IO/MeshBase/src/itkMeshIOBase.cxx +++ b/Modules/IO/MeshBase/src/itkMeshIOBase.cxx @@ -21,11 +21,11 @@ namespace itk { MeshIOBase::MeshIOBase() - : m_NumberOfPoints(itk::NumericTraits::ZeroValue()) - , m_NumberOfCells(itk::NumericTraits::ZeroValue()) - , m_NumberOfPointPixels(itk::NumericTraits::ZeroValue()) - , m_NumberOfCellPixels(itk::NumericTraits::ZeroValue()) - , m_CellBufferSize(itk::NumericTraits::ZeroValue()) + : m_NumberOfPoints(SizeValueType{}) + , m_NumberOfCells(SizeValueType{}) + , m_NumberOfPointPixels(SizeValueType{}) + , m_NumberOfCellPixels(SizeValueType{}) + , m_CellBufferSize(SizeValueType{}) {} diff --git a/Modules/IO/MeshFreeSurfer/include/itkFreeSurferAsciiMeshIO.h b/Modules/IO/MeshFreeSurfer/include/itkFreeSurferAsciiMeshIO.h index ba6ea675381..20708bb076e 100644 --- a/Modules/IO/MeshFreeSurfer/include/itkFreeSurferAsciiMeshIO.h +++ b/Modules/IO/MeshFreeSurfer/include/itkFreeSurferAsciiMeshIO.h @@ -115,7 +115,7 @@ class ITKIOMeshFreeSurfer_EXPORT FreeSurferAsciiMeshIO : public MeshIOBase /** Write points to output stream */ template void - WritePoints(T * buffer, std::ofstream & outputFile, T label = itk::NumericTraits::ZeroValue()) + WritePoints(T * buffer, std::ofstream & outputFile, T label = T{}) { outputFile.precision(6); SizeValueType index = 0; @@ -131,7 +131,7 @@ class ITKIOMeshFreeSurfer_EXPORT FreeSurferAsciiMeshIO : public MeshIOBase template void - WriteCells(T * buffer, std::ofstream & outputFile, T label = itk::NumericTraits::ZeroValue()) + WriteCells(T * buffer, std::ofstream & outputFile, T label = T{}) { constexpr unsigned int numberOfCellPoints = 3; SizeValueType index = 0; diff --git a/Modules/IO/MeshOFF/src/itkOFFMeshIO.cxx b/Modules/IO/MeshOFF/src/itkOFFMeshIO.cxx index dbb541d977b..8bffe597777 100644 --- a/Modules/IO/MeshOFF/src/itkOFFMeshIO.cxx +++ b/Modules/IO/MeshOFF/src/itkOFFMeshIO.cxx @@ -27,7 +27,7 @@ OFFMeshIO::OFFMeshIO() { this->AddSupportedWriteExtension(".off"); this->SetByteOrderToBigEndian(); - m_PointsStartPosition = itk::NumericTraits::ZeroValue(); + m_PointsStartPosition = StreamOffsetType{}; m_TriangleCellType = true; } diff --git a/Modules/IO/MeshVTK/include/itkVTKPolyDataMeshIO.h b/Modules/IO/MeshVTK/include/itkVTKPolyDataMeshIO.h index 96455e771e0..6f79411b494 100644 --- a/Modules/IO/MeshVTK/include/itkVTKPolyDataMeshIO.h +++ b/Modules/IO/MeshVTK/include/itkVTKPolyDataMeshIO.h @@ -740,7 +740,7 @@ class ITKIOMeshVTK_EXPORT VTKPolyDataMeshIO : public MeshIOBase // documentation. if (this->m_NumberOfPointPixelComponents == 3) { - T zero(itk::NumericTraits::ZeroValue()); + T zero(T{}); T e12; while (i < num) { @@ -931,7 +931,7 @@ class ITKIOMeshVTK_EXPORT VTKPolyDataMeshIO : public MeshIOBase const SizeValueType num = this->m_NumberOfCellPixelComponents * this->m_NumberOfCellPixels; if (this->m_NumberOfCellPixelComponents == 2) { - T zero(itk::NumericTraits::ZeroValue()); + T zero(T{}); T e12; while (i < num) { diff --git a/Modules/IO/MeshVTK/src/itkVTKPolyDataMeshIO.cxx b/Modules/IO/MeshVTK/src/itkVTKPolyDataMeshIO.cxx index 082068c9a8b..fdf54526733 100644 --- a/Modules/IO/MeshVTK/src/itkVTKPolyDataMeshIO.cxx +++ b/Modules/IO/MeshVTK/src/itkVTKPolyDataMeshIO.cxx @@ -319,8 +319,8 @@ VTKPolyDataMeshIO::ReadMeshInformation() } // Initialize number of cells - this->m_NumberOfCells = itk::NumericTraits::ZeroValue(); - this->m_CellBufferSize = itk::NumericTraits::ZeroValue(); + this->m_NumberOfCells = SizeValueType{}; + this->m_CellBufferSize = SizeValueType{}; MetaDataDictionary & metaDic = this->GetMetaDataDictionary(); // Searching the vtk file diff --git a/Modules/IO/RAW/test/itkRawImageIOTest4.cxx b/Modules/IO/RAW/test/itkRawImageIOTest4.cxx index c1c3cf2d198..02f9b73de38 100644 --- a/Modules/IO/RAW/test/itkRawImageIOTest4.cxx +++ b/Modules/IO/RAW/test/itkRawImageIOTest4.cxx @@ -172,7 +172,7 @@ itkRawImageIOTest4(int argc, char * argv[]) return EXIT_FAILURE; } - value = itk::NumericTraits::ZeroValue(); + value = PixelType{}; for (unsigned int i = 0; i < numberOfPixels; ++i) { PixelType swappedValue = value; diff --git a/Modules/IO/VTK/src/itkVTKImageIO.cxx b/Modules/IO/VTK/src/itkVTKImageIO.cxx index 32ce35ca039..6a4f4764c01 100644 --- a/Modules/IO/VTK/src/itkVTKImageIO.cxx +++ b/Modules/IO/VTK/src/itkVTKImageIO.cxx @@ -723,7 +723,7 @@ WriteTensorBuffer(std::ostream & os, ImageIOBase::SizeType i = 0; if (components == 3) { - PrintType zero(itk::NumericTraits::ZeroValue()); + PrintType zero(TComponent{}); PrintType e12; while (i < num) { diff --git a/Modules/IO/VTK/test/itkVTKImageIO2Test.cxx b/Modules/IO/VTK/test/itkVTKImageIO2Test.cxx index 381517f1bc1..a6eaa49008d 100644 --- a/Modules/IO/VTK/test/itkVTKImageIO2Test.cxx +++ b/Modules/IO/VTK/test/itkVTKImageIO2Test.cxx @@ -114,7 +114,7 @@ class VTKImageIOTester switch (cnt % 4) { case 0: - i.Set(itk::NumericTraits::ZeroValue()); + i.Set(PixelType{}); break; case 1: i.Set(itk::NumericTraits::OneValue()); @@ -123,7 +123,7 @@ class VTKImageIOTester i.Set(itk::NumericTraits::OneValue()); break; case 3: - i.Set(itk::NumericTraits::ZeroValue()); + i.Set(PixelType{}); } ++cnt; ++i; @@ -234,7 +234,7 @@ class VTKImageIOTester { case 0: // Comparison with complex??? - if (itk::Math::NotExactlyEquals(iter.Get(), itk::NumericTraits::ZeroValue())) + if (itk::Math::NotExactlyEquals(iter.Get(), PixelType{})) { pixelsGood = false; } @@ -252,7 +252,7 @@ class VTKImageIOTester } break; case 3: - if (itk::Math::NotExactlyEquals(iter.Get(), itk::NumericTraits::ZeroValue())) + if (itk::Math::NotExactlyEquals(iter.Get(), PixelType{})) { pixelsGood = false; } diff --git a/Modules/IO/VTK/test/itkVTKImageIO2Test2.cxx b/Modules/IO/VTK/test/itkVTKImageIO2Test2.cxx index 6b02df0294e..6690e9f2d2c 100644 --- a/Modules/IO/VTK/test/itkVTKImageIO2Test2.cxx +++ b/Modules/IO/VTK/test/itkVTKImageIO2Test2.cxx @@ -66,7 +66,7 @@ itkVTKImageIO2Test2(int argc, char * argv[]) switch (cnt * 3 % 5) { case 0: - i.Set(itk::NumericTraits::ZeroValue()); + i.Set(PixelType{}); break; case 1: i.Set(itk::NumericTraits::OneValue()); diff --git a/Modules/IO/VTK/test/itkVTKImageIOStreamTest.cxx b/Modules/IO/VTK/test/itkVTKImageIOStreamTest.cxx index ff901741f4a..858e2405777 100644 --- a/Modules/IO/VTK/test/itkVTKImageIOStreamTest.cxx +++ b/Modules/IO/VTK/test/itkVTKImageIOStreamTest.cxx @@ -54,7 +54,7 @@ class ConstantImageSource : public GenerateImageSource itkSetMacro(Value, typename TOutputImage::PixelType); protected: - ConstantImageSource() { m_Value = NumericTraits::ZeroValue(); } + ConstantImageSource() { m_Value = typename TOutputImage::PixelType{}; } ~ConstantImageSource() override = default; /** Does the real work. */ diff --git a/Modules/Nonunit/Review/include/itkDiscreteGaussianDerivativeImageFunction.hxx b/Modules/Nonunit/Review/include/itkDiscreteGaussianDerivativeImageFunction.hxx index c3278a62fba..fcde6043598 100644 --- a/Modules/Nonunit/Review/include/itkDiscreteGaussianDerivativeImageFunction.hxx +++ b/Modules/Nonunit/Review/include/itkDiscreteGaussianDerivativeImageFunction.hxx @@ -110,7 +110,7 @@ DiscreteGaussianDerivativeImageFunction::RecomputeGaussian kernelImage->SetRegions(region); kernelImage->Allocate(); - kernelImage->FillBuffer(itk::NumericTraits::ZeroValue()); + kernelImage->FillBuffer(TOutput{}); // Initially the kernel image will be an impulse at the center typename KernelImageType::IndexType centerIndex; diff --git a/Modules/Nonunit/Review/include/itkDiscreteGradientMagnitudeGaussianImageFunction.hxx b/Modules/Nonunit/Review/include/itkDiscreteGradientMagnitudeGaussianImageFunction.hxx index a276635dc89..dc81f1fbad5 100644 --- a/Modules/Nonunit/Review/include/itkDiscreteGradientMagnitudeGaussianImageFunction.hxx +++ b/Modules/Nonunit/Review/include/itkDiscreteGradientMagnitudeGaussianImageFunction.hxx @@ -123,7 +123,7 @@ DiscreteGradientMagnitudeGaussianImageFunction::RecomputeG kernelImage->SetRegions(region); kernelImage->Allocate(); - kernelImage->FillBuffer(itk::NumericTraits::ZeroValue()); + kernelImage->FillBuffer(TOutput{}); // Initially the kernel image will be an impulse at the center typename KernelImageType::IndexType centerIndex; @@ -146,7 +146,7 @@ DiscreteGradientMagnitudeGaussianImageFunction::RecomputeG for (unsigned int i = 0; i < Self::ImageDimension2; ++i) { // Reset kernel image - kernelImage->FillBuffer(itk::NumericTraits::ZeroValue()); + kernelImage->FillBuffer(TOutput{}); kernelImage->SetPixel(centerIndex, itk::NumericTraits::OneValue()); for (unsigned int direction = 0; direction < Self::ImageDimension2; ++direction) diff --git a/Modules/Nonunit/Review/include/itkDiscreteHessianGaussianImageFunction.hxx b/Modules/Nonunit/Review/include/itkDiscreteHessianGaussianImageFunction.hxx index 66562612aa1..8e7e41a409e 100644 --- a/Modules/Nonunit/Review/include/itkDiscreteHessianGaussianImageFunction.hxx +++ b/Modules/Nonunit/Review/include/itkDiscreteHessianGaussianImageFunction.hxx @@ -116,7 +116,7 @@ DiscreteHessianGaussianImageFunction::RecomputeGaussianKer kernelImage->SetRegions(region); kernelImage->Allocate(); - kernelImage->FillBuffer(itk::NumericTraits::ZeroValue()); + kernelImage->FillBuffer(TOutput{}); // Initially the kernel image will be an impulse at the center typename KernelImageType::IndexType centerIndex; @@ -154,7 +154,7 @@ DiscreteHessianGaussianImageFunction::RecomputeGaussianKer ++orderArray[j]; // Reset kernel image - kernelImage->FillBuffer(itk::NumericTraits::ZeroValue()); + kernelImage->FillBuffer(TOutput{}); kernelImage->SetPixel(centerIndex, itk::NumericTraits::OneValue()); for (unsigned int direction = 0; direction < Self::ImageDimension2; ++direction) diff --git a/Modules/Nonunit/Review/include/itkGridForwardWarpImageFilter.hxx b/Modules/Nonunit/Review/include/itkGridForwardWarpImageFilter.hxx index 49d8897cde8..1bbb789e549 100644 --- a/Modules/Nonunit/Review/include/itkGridForwardWarpImageFilter.hxx +++ b/Modules/Nonunit/Review/include/itkGridForwardWarpImageFilter.hxx @@ -29,7 +29,7 @@ namespace itk template GridForwardWarpImageFilter::GridForwardWarpImageFilter() - : m_BackgroundValue(NumericTraits::ZeroValue()) + : m_BackgroundValue(PixelType{}) , m_ForegroundValue(NumericTraits::OneValue()) {} diff --git a/Modules/Nonunit/Review/include/itkLabelGeometryImageFilter.h b/Modules/Nonunit/Review/include/itkLabelGeometryImageFilter.h index 6e2bd2cc2a1..b31ba9f3a59 100644 --- a/Modules/Nonunit/Review/include/itkLabelGeometryImageFilter.h +++ b/Modules/Nonunit/Review/include/itkLabelGeometryImageFilter.h @@ -157,7 +157,7 @@ class ITK_TEMPLATE_EXPORT LabelGeometryImageFilter : public ImageToImageFilterm_Label = 0; - this->m_Sum = NumericTraits::ZeroValue(); + this->m_Sum = RealType{}; const unsigned int imageDimension = Self::ImageDimension; diff --git a/Modules/Nonunit/Review/include/itkLabelGeometryImageFilter.hxx b/Modules/Nonunit/Review/include/itkLabelGeometryImageFilter.hxx index 19373b771bf..bfec4d226f8 100644 --- a/Modules/Nonunit/Review/include/itkLabelGeometryImageFilter.hxx +++ b/Modules/Nonunit/Review/include/itkLabelGeometryImageFilter.hxx @@ -621,7 +621,7 @@ LabelGeometryImageFilter::GetIntegratedIntensity(L if (mapIt == m_LabelGeometryMapper.end()) { // label does not exist, return a default value - return NumericTraits::ZeroValue(); + return RealType{}; } else { @@ -640,7 +640,7 @@ LabelGeometryImageFilter::GetCentroid(LabelPixelTy { // label does not exist, return a default value LabelPointType emptyCentroid; - emptyCentroid.Fill(NumericTraits::ZeroValue()); + emptyCentroid.Fill(typename LabelPointType::ValueType{}); return emptyCentroid; } else @@ -661,7 +661,7 @@ LabelGeometryImageFilter::GetWeightedCentroid(Labe { // label does not exist, return a default value LabelPointType emptyCentroid; - emptyCentroid.Fill(NumericTraits::ZeroValue()); + emptyCentroid.Fill(typename LabelPointType::ValueType{}); return emptyCentroid; } else @@ -719,7 +719,7 @@ LabelGeometryImageFilter::GetAxesLength(LabelPixel { // label does not exist, return a default value LabelPointType emptyAxesLength; - emptyAxesLength.Fill(NumericTraits::ZeroValue()); + emptyAxesLength.Fill(typename AxesLengthType::ValueType{}); return emptyAxesLength; } else @@ -756,7 +756,7 @@ LabelGeometryImageFilter::GetEccentricity(LabelPix if (mapIt == m_LabelGeometryMapper.end()) { // label does not exist, return a default value - return NumericTraits::ZeroValue(); + return RealType{}; } else { @@ -774,7 +774,7 @@ LabelGeometryImageFilter::GetElongation(LabelPixel if (mapIt == m_LabelGeometryMapper.end()) { // label does not exist, return a default value - return NumericTraits::ZeroValue(); + return RealType{}; } else { @@ -792,7 +792,7 @@ LabelGeometryImageFilter::GetOrientation(LabelPixe if (mapIt == m_LabelGeometryMapper.end()) { // label does not exist, return a default value - return NumericTraits::ZeroValue(); + return RealType{}; } else { @@ -810,7 +810,7 @@ LabelGeometryImageFilter::GetBoundingBox(LabelPixe if (mapIt == m_LabelGeometryMapper.end()) { BoundingBoxType emptyBox; - emptyBox.Fill(NumericTraits::ZeroValue()); + emptyBox.Fill(typename BoundingBoxType::ValueType{}); // label does not exist, return a default value return emptyBox; } @@ -830,7 +830,7 @@ LabelGeometryImageFilter::GetBoundingBoxVolume(Lab if (mapIt == m_LabelGeometryMapper.end()) { // label does not exist, return a default value - return NumericTraits::ZeroValue(); + return RealType{}; } else { @@ -849,7 +849,7 @@ LabelGeometryImageFilter::GetBoundingBoxSize(Label { // label does not exist, return a default value LabelSizeType emptySize; - emptySize.Fill(NumericTraits::ZeroValue()); + emptySize.Fill(typename LabelSizeType::SizeValueType{}); return emptySize; } else @@ -891,7 +891,7 @@ LabelGeometryImageFilter::GetOrientedBoundingBoxVo if (mapIt == m_LabelGeometryMapper.end()) { // label does not exist, return a default value - return NumericTraits::ZeroValue(); + return RealType{}; } else { @@ -911,10 +911,10 @@ LabelGeometryImageFilter::GetOrientedBoundingBoxSi { // label does not exist, return a default value // LabelSizeType emptySize; - // emptySize.Fill( NumericTraits::ZeroValue()); + // emptySize.Fill( LabelSizeType::SizeValueType{}); // return emptySize; LabelPointType emptySize; - emptySize.Fill(NumericTraits::ZeroValue()); + emptySize.Fill(typename LabelPointType::ValueType{}); return emptySize; } else @@ -935,7 +935,7 @@ LabelGeometryImageFilter::GetOrientedBoundingBoxOr { // label does not exist, return a default value LabelPointType emptySize; - emptySize.Fill(NumericTraits::ZeroValue()); + emptySize.Fill(typename LabelPointType::ValueType{}); return emptySize; } else diff --git a/Modules/Nonunit/Review/include/itkMultiphaseSparseFiniteDifferenceImageFilter.hxx b/Modules/Nonunit/Review/include/itkMultiphaseSparseFiniteDifferenceImageFilter.hxx index 248acda7b50..f2b322688ca 100644 --- a/Modules/Nonunit/Review/include/itkMultiphaseSparseFiniteDifferenceImageFilter.hxx +++ b/Modules/Nonunit/Review/include/itkMultiphaseSparseFiniteDifferenceImageFilter.hxx @@ -1331,7 +1331,7 @@ MultiphaseSparseFiniteDifferenceImageFilterGetOutput(); - output->FillBuffer(NumericTraits::ZeroValue()); + output->FillBuffer(OutputPixelType{}); // Set the values in the levelset image for the active layer. this->InitializeActiveLayerValues(); diff --git a/Modules/Nonunit/Review/include/itkRegionBasedLevelSetFunction.hxx b/Modules/Nonunit/Review/include/itkRegionBasedLevelSetFunction.hxx index e2a288de9cf..69da3ad94f6 100644 --- a/Modules/Nonunit/Review/include/itkRegionBasedLevelSetFunction.hxx +++ b/Modules/Nonunit/Review/include/itkRegionBasedLevelSetFunction.hxx @@ -34,12 +34,12 @@ RegionBasedLevelSetFunction::RegionBasedLevelSetF m_Lambda1 = NumericTraits::OneValue(); m_Lambda2 = NumericTraits::OneValue(); - m_OverlapPenaltyWeight = NumericTraits::ZeroValue(); - m_AreaWeight = NumericTraits::ZeroValue(); - m_VolumeMatchingWeight = NumericTraits::ZeroValue(); - m_ReinitializationSmoothingWeight = NumericTraits::ZeroValue(); - m_CurvatureWeight = m_AdvectionWeight = NumericTraits::ZeroValue(); - m_Volume = NumericTraits::ZeroValue(); + m_OverlapPenaltyWeight = ScalarValueType{}; + m_AreaWeight = ScalarValueType{}; + m_VolumeMatchingWeight = ScalarValueType{}; + m_ReinitializationSmoothingWeight = ScalarValueType{}; + m_CurvatureWeight = m_AdvectionWeight = ScalarValueType{}; + m_Volume = ScalarValueType{}; m_FunctionId = 0; @@ -62,7 +62,7 @@ RegionBasedLevelSetFunction::InitializeZeroVector for (unsigned int i = 0; i < ImageDimension; ++i) { - ans[i] = NumericTraits::ZeroValue(); + ans[i] = ScalarValueType{}; } return ans; @@ -156,9 +156,9 @@ RegionBasedLevelSetFunction::ComputeGlobalTimeSte } // Reset the values - d->m_MaxCurvatureChange = NumericTraits::ZeroValue(); - d->m_MaxGlobalChange = NumericTraits::ZeroValue(); - d->m_MaxAdvectionChange = NumericTraits::ZeroValue(); + d->m_MaxCurvatureChange = ScalarValueType{}; + d->m_MaxGlobalChange = ScalarValueType{}; + d->m_MaxAdvectionChange = ScalarValueType{}; return dt; } @@ -253,7 +253,7 @@ RegionBasedLevelSetFunction::ComputeUpdate(const ScalarValueType curvature{}; ScalarValueType globalTerm{}; VectorType advection_field; - ScalarValueType x_energy, advection_term = NumericTraits::ZeroValue(); + ScalarValueType x_energy, advection_term = ScalarValueType{}; // Access the global data structure auto * gd = (GlobalDataStruct *)globalData; @@ -264,7 +264,7 @@ RegionBasedLevelSetFunction::ComputeUpdate(const // Computing the curvature term // Used to regularized using the length of contour - if ((dh != 0.) && (this->m_CurvatureWeight != NumericTraits::ZeroValue())) + if ((dh != 0.) && (this->m_CurvatureWeight != ScalarValueType{})) { curvature = this->ComputeCurvature(it, offset, gd); curvature_term = this->m_CurvatureWeight * curvature * this->CurvatureSpeed(it, offset, gd) * dh; @@ -274,14 +274,14 @@ RegionBasedLevelSetFunction::ComputeUpdate(const // Computing the laplacian term // Used in maintaining squared distance function - if (this->m_ReinitializationSmoothingWeight != NumericTraits::ZeroValue()) + if (this->m_ReinitializationSmoothingWeight != ScalarValueType{}) { laplacian_term = this->ComputeLaplacian(gd) - curvature; laplacian_term *= this->m_ReinitializationSmoothingWeight * this->LaplacianSmoothingSpeed(it, offset, gd); } - if ((dh != 0.) && (m_AdvectionWeight != NumericTraits::ZeroValue())) + if ((dh != 0.) && (m_AdvectionWeight != ScalarValueType{})) { advection_field = this->AdvectionField(it, offset, gd); @@ -290,7 +290,7 @@ RegionBasedLevelSetFunction::ComputeUpdate(const x_energy = m_AdvectionWeight * advection_field[i]; // TODO: Is this condition right ? - if (x_energy > NumericTraits::ZeroValue()) + if (x_energy > ScalarValueType{}) { advection_term += advection_field[i] * gd->m_dx_backward[i]; } diff --git a/Modules/Nonunit/Review/include/itkRobustAutomaticThresholdCalculator.hxx b/Modules/Nonunit/Review/include/itkRobustAutomaticThresholdCalculator.hxx index e65feedfb0c..19405640fc8 100644 --- a/Modules/Nonunit/Review/include/itkRobustAutomaticThresholdCalculator.hxx +++ b/Modules/Nonunit/Review/include/itkRobustAutomaticThresholdCalculator.hxx @@ -26,7 +26,7 @@ namespace itk { template RobustAutomaticThresholdCalculator::RobustAutomaticThresholdCalculator() - : m_Output(NumericTraits::ZeroValue()) + : m_Output(InputPixelType{}) {} template diff --git a/Modules/Nonunit/Review/include/itkRobustAutomaticThresholdImageFilter.h b/Modules/Nonunit/Review/include/itkRobustAutomaticThresholdImageFilter.h index 821768183d1..9accc08b2e6 100644 --- a/Modules/Nonunit/Review/include/itkRobustAutomaticThresholdImageFilter.h +++ b/Modules/Nonunit/Review/include/itkRobustAutomaticThresholdImageFilter.h @@ -92,7 +92,7 @@ class ITK_TEMPLATE_EXPORT RobustAutomaticThresholdImageFilter : public ImageToIm static constexpr unsigned int OutputImageDimension = TOutputImage::ImageDimension; /** Set the "outside" pixel value. The default value - * NumericTraits::ZeroValue(). */ + * OutputPixelType{}. */ itkSetMacro(OutsideValue, OutputPixelType); /** Get the "outside" pixel value. */ diff --git a/Modules/Nonunit/Review/include/itkRobustAutomaticThresholdImageFilter.hxx b/Modules/Nonunit/Review/include/itkRobustAutomaticThresholdImageFilter.hxx index 4004d5aa805..04105dc0a1a 100644 --- a/Modules/Nonunit/Review/include/itkRobustAutomaticThresholdImageFilter.hxx +++ b/Modules/Nonunit/Review/include/itkRobustAutomaticThresholdImageFilter.hxx @@ -26,9 +26,9 @@ namespace itk { template RobustAutomaticThresholdImageFilter::RobustAutomaticThresholdImageFilter() - : m_Threshold(NumericTraits::ZeroValue()) + : m_Threshold(InputPixelType{}) , m_InsideValue(NumericTraits::max()) - , m_OutsideValue(NumericTraits::ZeroValue()) + , m_OutsideValue(OutputPixelType{}) { this->SetNumberOfRequiredInputs(2); } diff --git a/Modules/Nonunit/Review/include/itkStochasticFractalDimensionImageFilter.hxx b/Modules/Nonunit/Review/include/itkStochasticFractalDimensionImageFilter.hxx index 4949b9a7400..230290a7ef1 100644 --- a/Modules/Nonunit/Review/include/itkStochasticFractalDimensionImageFilter.hxx +++ b/Modules/Nonunit/Review/include/itkStochasticFractalDimensionImageFilter.hxx @@ -104,7 +104,7 @@ StochasticFractalDimensionImageFilter::Ge { if (this->m_MaskImage && !this->m_MaskImage->GetPixel(It.GetIndex())) { - ItO.SetCenterPixel(NumericTraits::ZeroValue()); + ItO.SetCenterPixel(OutputPixelType{}); progress.CompletedPixel(); continue; } diff --git a/Modules/Nonunit/Review/test/itkDiscreteGaussianDerivativeImageFunctionTest.cxx b/Modules/Nonunit/Review/test/itkDiscreteGaussianDerivativeImageFunctionTest.cxx index 001c8568486..ce2237c8749 100644 --- a/Modules/Nonunit/Review/test/itkDiscreteGaussianDerivativeImageFunctionTest.cxx +++ b/Modules/Nonunit/Review/test/itkDiscreteGaussianDerivativeImageFunctionTest.cxx @@ -125,7 +125,7 @@ itkDiscreteGaussianDerivativeImageFunctionTestND(int argc, char * argv[]) output->SetRequestedRegion(inputImage->GetRequestedRegion()); output->SetBufferedRegion(inputImage->GetBufferedRegion()); output->Allocate(); - output->FillBuffer(itk::NumericTraits::ZeroValue()); + output->FillBuffer(PixelType{}); // Step over input and output images diff --git a/Modules/Nonunit/Review/test/itkDiscreteGradientMagnitudeGaussianImageFunctionTest.cxx b/Modules/Nonunit/Review/test/itkDiscreteGradientMagnitudeGaussianImageFunctionTest.cxx index 727cf3ba493..d3884ca0cd9 100644 --- a/Modules/Nonunit/Review/test/itkDiscreteGradientMagnitudeGaussianImageFunctionTest.cxx +++ b/Modules/Nonunit/Review/test/itkDiscreteGradientMagnitudeGaussianImageFunctionTest.cxx @@ -126,7 +126,7 @@ itkDiscreteGradientMagnitudeGaussianImageFunctionTestND(int argc, char * argv[]) output->SetRequestedRegion(inputImage->GetRequestedRegion()); output->SetBufferedRegion(inputImage->GetBufferedRegion()); output->Allocate(); - output->FillBuffer(itk::NumericTraits::ZeroValue()); + output->FillBuffer(PixelType{}); // Step over input and output images diff --git a/Modules/Nonunit/Review/test/itkDiscreteHessianGaussianImageFunctionTest.cxx b/Modules/Nonunit/Review/test/itkDiscreteHessianGaussianImageFunctionTest.cxx index 0eec0cc4c91..261da131db4 100644 --- a/Modules/Nonunit/Review/test/itkDiscreteHessianGaussianImageFunctionTest.cxx +++ b/Modules/Nonunit/Review/test/itkDiscreteHessianGaussianImageFunctionTest.cxx @@ -120,7 +120,7 @@ itkDiscreteHessianGaussianImageFunctionTestND(int argc, char * argv[]) output->SetRequestedRegion(reader->GetOutput()->GetRequestedRegion()); output->SetBufferedRegion(reader->GetOutput()->GetBufferedRegion()); output->Allocate(); - output->FillBuffer(itk::NumericTraits::ZeroValue()); + output->FillBuffer(PixelType{}); // Step over input and output images diff --git a/Modules/Numerics/FEM/include/itkFEMLoadPoint.h b/Modules/Numerics/FEM/include/itkFEMLoadPoint.h index 7870811fdc2..de52971f1f4 100644 --- a/Modules/Numerics/FEM/include/itkFEMLoadPoint.h +++ b/Modules/Numerics/FEM/include/itkFEMLoadPoint.h @@ -55,8 +55,8 @@ class ITKFEM_EXPORT LoadPoint : public LoadElement /** Default constructor. */ LoadPoint() - : m_Point(2, NumericTraits::ZeroValue()) - , m_ForcePoint(2, NumericTraits::ZeroValue()) + : m_Point(2, Float{}) + , m_ForcePoint(2, Float{}) { // Default initialization of 2D point and force vector } diff --git a/Modules/Numerics/FEM/include/itkFEMSolver.hxx b/Modules/Numerics/FEM/include/itkFEMSolver.hxx index d3e03a03a00..a96783f1527 100644 --- a/Modules/Numerics/FEM/include/itkFEMSolver.hxx +++ b/Modules/Numerics/FEM/include/itkFEMSolver.hxx @@ -104,7 +104,7 @@ template auto Solver::GetTimeStep() const -> Float { - return NumericTraits::ZeroValue(); + return Float{}; } template diff --git a/Modules/Numerics/NarrowBand/include/itkNarrowBand.h b/Modules/Numerics/NarrowBand/include/itkNarrowBand.h index 84e59045c37..b938bde1ae5 100644 --- a/Modules/Numerics/NarrowBand/include/itkNarrowBand.h +++ b/Modules/Numerics/NarrowBand/include/itkNarrowBand.h @@ -39,7 +39,7 @@ class ITK_TEMPLATE_EXPORT BandNode TIndexType m_Index; signed char m_NodeState{ 0 }; BandNode() - : m_Data(NumericTraits::ZeroValue()) + : m_Data(TDataType{}) {} }; diff --git a/Modules/Numerics/NarrowBand/include/itkNarrowBandImageFilterBase.hxx b/Modules/Numerics/NarrowBand/include/itkNarrowBandImageFilterBase.hxx index a34503a4694..d8fac12f7bf 100644 --- a/Modules/Numerics/NarrowBand/include/itkNarrowBandImageFilterBase.hxx +++ b/Modules/Numerics/NarrowBand/include/itkNarrowBandImageFilterBase.hxx @@ -85,7 +85,7 @@ NarrowBandImageFilterBase::GenerateData() wui.ThreadFunction = nullptr; TimeStepType timeStep; - std::vector timeStepList(numberOfWorkUnits, NumericTraits::ZeroValue()); + std::vector timeStepList(numberOfWorkUnits, TimeStepType{}); BooleanStdVectorType validTimeStepList(numberOfWorkUnits, true); // Implement iterative loop in thread function diff --git a/Modules/Numerics/Optimizers/src/itkSingleValuedVnlCostFunctionAdaptor.cxx b/Modules/Numerics/Optimizers/src/itkSingleValuedVnlCostFunctionAdaptor.cxx index f9dec016d1e..6459468b9b1 100644 --- a/Modules/Numerics/Optimizers/src/itkSingleValuedVnlCostFunctionAdaptor.cxx +++ b/Modules/Numerics/Optimizers/src/itkSingleValuedVnlCostFunctionAdaptor.cxx @@ -26,7 +26,7 @@ SingleValuedVnlCostFunctionAdaptor::SingleValuedVnlCostFunctionAdaptor(unsigned m_ScalesInitialized = false; m_NegateCostFunction = false; m_Reporter = Object::New(); - m_CachedValue = NumericTraits::ZeroValue(); + m_CachedValue = MeasureType{}; m_CachedDerivative.Fill(0); } diff --git a/Modules/Numerics/Optimizersv4/include/itkConjugateGradientLineSearchOptimizerv4.hxx b/Modules/Numerics/Optimizersv4/include/itkConjugateGradientLineSearchOptimizerv4.hxx index 06f152e6f02..43fbb7605fa 100644 --- a/Modules/Numerics/Optimizersv4/include/itkConjugateGradientLineSearchOptimizerv4.hxx +++ b/Modules/Numerics/Optimizersv4/include/itkConjugateGradientLineSearchOptimizerv4.hxx @@ -39,9 +39,9 @@ ConjugateGradientLineSearchOptimizerv4Template::S bool doOnlyInitialization) { this->m_ConjugateGradient.SetSize(this->m_Metric->GetNumberOfParameters()); - this->m_ConjugateGradient.Fill(itk::NumericTraits::ZeroValue()); + this->m_ConjugateGradient.Fill(TInternalComputationValueType{}); this->m_LastGradient.SetSize(this->m_Metric->GetNumberOfParameters()); - this->m_LastGradient.Fill(itk::NumericTraits::ZeroValue()); + this->m_LastGradient.Fill(TInternalComputationValueType{}); Superclass::StartOptimization(doOnlyInitialization); } diff --git a/Modules/Numerics/Optimizersv4/include/itkGradientDescentLineSearchOptimizerv4.hxx b/Modules/Numerics/Optimizersv4/include/itkGradientDescentLineSearchOptimizerv4.hxx index b2663c26d5c..de7b15c4668 100644 --- a/Modules/Numerics/Optimizersv4/include/itkGradientDescentLineSearchOptimizerv4.hxx +++ b/Modules/Numerics/Optimizersv4/include/itkGradientDescentLineSearchOptimizerv4.hxx @@ -28,7 +28,7 @@ GradientDescentLineSearchOptimizerv4Template< { this->m_MaximumLineSearchIterations = 20; this->m_LineSearchIterations = 0U; - this->m_LowerLimit = itk::NumericTraits::ZeroValue(); + this->m_LowerLimit = TInternalComputationValueType{}; this->m_UpperLimit = 5.0; this->m_Phi = 1.618034; this->m_Resphi = 2 - this->m_Phi; diff --git a/Modules/Numerics/Optimizersv4/include/itkGradientDescentOptimizerBasev4.hxx b/Modules/Numerics/Optimizersv4/include/itkGradientDescentOptimizerBasev4.hxx index 53c7a192f11..78c8400a497 100644 --- a/Modules/Numerics/Optimizersv4/include/itkGradientDescentOptimizerBasev4.hxx +++ b/Modules/Numerics/Optimizersv4/include/itkGradientDescentOptimizerBasev4.hxx @@ -43,7 +43,7 @@ GradientDescentOptimizerBasev4Template::GradientD this->m_StopCondition = StopConditionObjectToObjectOptimizerEnum::MAXIMUM_NUMBER_OF_ITERATIONS; this->m_StopConditionDescription << this->GetNameOfClass() << ": "; - this->m_MaximumStepSizeInPhysicalUnits = NumericTraits::ZeroValue(); + this->m_MaximumStepSizeInPhysicalUnits = TInternalComputationValueType{}; this->m_UseConvergenceMonitoring = true; this->m_ConvergenceWindowSize = 50; diff --git a/Modules/Numerics/Optimizersv4/include/itkGradientDescentOptimizerv4.hxx b/Modules/Numerics/Optimizersv4/include/itkGradientDescentOptimizerv4.hxx index 218d748bc64..cdec1c1bc7b 100644 --- a/Modules/Numerics/Optimizersv4/include/itkGradientDescentOptimizerv4.hxx +++ b/Modules/Numerics/Optimizersv4/include/itkGradientDescentOptimizerv4.hxx @@ -30,7 +30,7 @@ GradientDescentOptimizerv4Template::GradientDesce , m_CurrentBestValue(NumericTraits::max()) { - this->m_PreviousGradient.Fill(NumericTraits::ZeroValue()); + this->m_PreviousGradient.Fill(TInternalComputationValueType{}); } template diff --git a/Modules/Numerics/Optimizersv4/include/itkMultiGradientOptimizerv4.hxx b/Modules/Numerics/Optimizersv4/include/itkMultiGradientOptimizerv4.hxx index 229944e04be..08915f7af68 100644 --- a/Modules/Numerics/Optimizersv4/include/itkMultiGradientOptimizerv4.hxx +++ b/Modules/Numerics/Optimizersv4/include/itkMultiGradientOptimizerv4.hxx @@ -110,7 +110,7 @@ MultiGradientOptimizerv4Template::StartOptimizati { itkDebugMacro("StartOptimization"); auto maxOpt = static_cast(this->m_OptimizersList.size()); - if (maxOpt == NumericTraits::ZeroValue()) + if (maxOpt == SizeValueType{}) { itkExceptionMacro(" No optimizers are set."); } diff --git a/Modules/Numerics/Optimizersv4/include/itkObjectToObjectMetric.hxx b/Modules/Numerics/Optimizersv4/include/itkObjectToObjectMetric.hxx index 13b4847302d..a2702de33d8 100644 --- a/Modules/Numerics/Optimizersv4/include/itkObjectToObjectMetric.hxx +++ b/Modules/Numerics/Optimizersv4/include/itkObjectToObjectMetric.hxx @@ -414,7 +414,7 @@ ObjectToObjectMetric::ZeroValue()); + origin.Fill(typename VirtualOriginType::ValueType{}); return origin; } } @@ -541,7 +541,7 @@ ObjectToObjectMetricm_NumberOfValidPoints == 0) { value = NumericTraits::max(); - derivative.Fill(NumericTraits::ZeroValue()); + derivative.Fill(DerivativeValueType{}); itkWarningMacro("No valid points were found during metric evaluation. " "For image metrics, verify that the images overlap appropriately. " "For instance, you can align the image centers by translation. " diff --git a/Modules/Numerics/Optimizersv4/include/itkObjectToObjectMetricBase.hxx b/Modules/Numerics/Optimizersv4/include/itkObjectToObjectMetricBase.hxx index d01f84d6117..b5156aac0c6 100644 --- a/Modules/Numerics/Optimizersv4/include/itkObjectToObjectMetricBase.hxx +++ b/Modules/Numerics/Optimizersv4/include/itkObjectToObjectMetricBase.hxx @@ -28,7 +28,7 @@ ObjectToObjectMetricBaseTemplate::ObjectToObjectM { // Don't call SetGradientSource, to avoid valgrind warning. this->m_GradientSource = GradientSourceEnum::GRADIENT_SOURCE_MOVING; - this->m_Value = NumericTraits::ZeroValue(); + this->m_Value = MeasureType{}; } //------------------------------------------------------------------- diff --git a/Modules/Numerics/Optimizersv4/include/itkQuasiNewtonOptimizerv4.hxx b/Modules/Numerics/Optimizersv4/include/itkQuasiNewtonOptimizerv4.hxx index de5ec057da0..9e067f470d8 100644 --- a/Modules/Numerics/Optimizersv4/include/itkQuasiNewtonOptimizerv4.hxx +++ b/Modules/Numerics/Optimizersv4/include/itkQuasiNewtonOptimizerv4.hxx @@ -36,7 +36,7 @@ QuasiNewtonOptimizerv4Template::QuasiNewtonOptimi // rate estimation. it may be initialized either by calling // SetMaximumNewtonStepSizeInPhysicalUnits manually or by using m_ScalesEstimator // automatically. and the former has higher priority than the latter. - this->m_MaximumNewtonStepSizeInPhysicalUnits = NumericTraits::ZeroValue(); + this->m_MaximumNewtonStepSizeInPhysicalUnits = TInternalComputationValueType{}; /** Threader for Quasi-Newton method */ using OptimizerType = QuasiNewtonOptimizerv4EstimateNewtonStepThreaderTemplate; @@ -259,7 +259,7 @@ QuasiNewtonOptimizerv4Template::ResetNewtonStep(I const SizeValueType numLocalPara = this->m_Metric->GetNumberOfLocalParameters(); // Initialize Hessian to identity matrix - m_HessianArray[loc].Fill(NumericTraits::ZeroValue()); + m_HessianArray[loc].Fill(TInternalComputationValueType{}); for (unsigned int i = 0; i < numLocalPara; ++i) { @@ -271,7 +271,7 @@ QuasiNewtonOptimizerv4Template::ResetNewtonStep(I { // Set to zero for invalid Newton steps. // They must be defined since they will be used during step scale estimation. - this->m_NewtonStep[offset + p] = NumericTraits::ZeroValue(); + this->m_NewtonStep[offset + p] = TInternalComputationValueType{}; } } diff --git a/Modules/Numerics/Optimizersv4/include/itkRegistrationParameterScalesEstimator.hxx b/Modules/Numerics/Optimizersv4/include/itkRegistrationParameterScalesEstimator.hxx index 1949faf301c..72f9e5b843b 100644 --- a/Modules/Numerics/Optimizersv4/include/itkRegistrationParameterScalesEstimator.hxx +++ b/Modules/Numerics/Optimizersv4/include/itkRegistrationParameterScalesEstimator.hxx @@ -287,7 +287,7 @@ RegistrationParameterScalesEstimator::ComputeSquaredJacobianNorms(const for (SizeValueType p = 0; p < numPara; ++p) { - squareNorms[p] = NumericTraits::ZeroValue(); + squareNorms[p] = typename ParametersType::ValueType{}; for (SizeValueType d = 0; d < dim; ++d) { squareNorms[p] += jacobian[d][p] * jacobian[d][p]; @@ -300,7 +300,7 @@ RegistrationParameterScalesEstimator::ComputeSquaredJacobianNorms(const for (SizeValueType p = 0; p < numPara; ++p) { - squareNorms[p] = NumericTraits::ZeroValue(); + squareNorms[p] = typename ParametersType::ValueType{}; for (SizeValueType d = 0; d < dim; ++d) { squareNorms[p] += jacobian[d][p] * jacobian[d][p]; diff --git a/Modules/Numerics/Optimizersv4/include/itkRegistrationParameterScalesFromJacobian.hxx b/Modules/Numerics/Optimizersv4/include/itkRegistrationParameterScalesFromJacobian.hxx index d71400c8a98..8197e3ba118 100644 --- a/Modules/Numerics/Optimizersv4/include/itkRegistrationParameterScalesFromJacobian.hxx +++ b/Modules/Numerics/Optimizersv4/include/itkRegistrationParameterScalesFromJacobian.hxx @@ -38,7 +38,7 @@ RegistrationParameterScalesFromJacobian::EstimateScales(ScalesType & pa const auto numSamples = static_cast(this->m_SamplePoints.size()); - norms.Fill(NumericTraits::ZeroValue()); + norms.Fill(typename ParametersType::ValueType{}); parameterScales.Fill(NumericTraits::OneValue()); // checking each sample point @@ -107,7 +107,7 @@ RegistrationParameterScalesFromJacobian::EstimateLocalStepScales(const const SizeValueType numLocals = numAllPara / numPara; localStepScales.SetSize(numLocals); - localStepScales.Fill(NumericTraits::ZeroValue()); + localStepScales.Fill(typename ScalesType::ValueType{}); // checking each sample point for (SizeValueType c = 0; c < numSamples; ++c) diff --git a/Modules/Numerics/Optimizersv4/include/itkRegistrationParameterScalesFromShiftBase.hxx b/Modules/Numerics/Optimizersv4/include/itkRegistrationParameterScalesFromShiftBase.hxx index 43b4f0782cd..c4f1cade0ae 100644 --- a/Modules/Numerics/Optimizersv4/include/itkRegistrationParameterScalesFromShiftBase.hxx +++ b/Modules/Numerics/Optimizersv4/include/itkRegistrationParameterScalesFromShiftBase.hxx @@ -73,7 +73,7 @@ RegistrationParameterScalesFromShiftBase::EstimateScales(ScalesType & p { // For local support, we need to refill deltaParameters with zeros at each loop // since smoothing may change the values around the local voxel. - deltaParameters.Fill(NumericTraits::ZeroValue()); + deltaParameters.Fill(typename ParametersType::ValueType{}); deltaParameters[offset + i] = this->m_SmallParameterVariation; maxShift = this->ComputeMaximumVoxelShift(deltaParameters); @@ -147,7 +147,7 @@ RegistrationParameterScalesFromShiftBase::EstimateStepScale(const Param } if (maxStep <= NumericTraits::epsilon()) { - return NumericTraits::ZeroValue(); + return FloatType{}; } else { @@ -185,7 +185,7 @@ RegistrationParameterScalesFromShiftBase::EstimateLocalStepScales(const const SizeValueType numLocals = numAllPara / numPara; localStepScales.SetSize(numLocals); - localStepScales.Fill(NumericTraits::ZeroValue()); + localStepScales.Fill(typename ScalesType::ValueType{}); const auto numSamples = static_cast(this->m_SamplePoints.size()); for (SizeValueType c = 0; c < numSamples; ++c) diff --git a/Modules/Numerics/Optimizersv4/include/itkWindowConvergenceMonitoringFunction.hxx b/Modules/Numerics/Optimizersv4/include/itkWindowConvergenceMonitoringFunction.hxx index f0c427cf2cf..bf78da241f8 100644 --- a/Modules/Numerics/Optimizersv4/include/itkWindowConvergenceMonitoringFunction.hxx +++ b/Modules/Numerics/Optimizersv4/include/itkWindowConvergenceMonitoringFunction.hxx @@ -57,7 +57,7 @@ void WindowConvergenceMonitoringFunction::ClearEnergyValues() { Superclass::ClearEnergyValues(); - this->m_TotalEnergy = NumericTraits::ZeroValue(); + this->m_TotalEnergy = RealType{}; } template diff --git a/Modules/Numerics/Optimizersv4/src/itkSingleValuedNonLinearVnlOptimizerv4.cxx b/Modules/Numerics/Optimizersv4/src/itkSingleValuedNonLinearVnlOptimizerv4.cxx index 3e558559785..80d637fc942 100644 --- a/Modules/Numerics/Optimizersv4/src/itkSingleValuedNonLinearVnlOptimizerv4.cxx +++ b/Modules/Numerics/Optimizersv4/src/itkSingleValuedNonLinearVnlOptimizerv4.cxx @@ -25,8 +25,8 @@ SingleValuedNonLinearVnlOptimizerv4::SingleValuedNonLinearVnlOptimizerv4() this->m_Command = CommandType::New(); this->m_Command->SetCallbackFunction(this, &SingleValuedNonLinearVnlOptimizerv4::IterationReport); - this->m_CachedCurrentPosition.Fill(NumericTraits::ZeroValue()); - this->m_CachedDerivative.Fill(NumericTraits::ZeroValue()); + this->m_CachedCurrentPosition.Fill(ParametersType::ValueType{}); + this->m_CachedDerivative.Fill(DerivativeType::ValueType{}); } SingleValuedNonLinearVnlOptimizerv4::~SingleValuedNonLinearVnlOptimizerv4() diff --git a/Modules/Numerics/Optimizersv4/src/itkSingleValuedVnlCostFunctionAdaptorv4.cxx b/Modules/Numerics/Optimizersv4/src/itkSingleValuedVnlCostFunctionAdaptorv4.cxx index 6fdc0c6d3c5..00ac2a3ec08 100644 --- a/Modules/Numerics/Optimizersv4/src/itkSingleValuedVnlCostFunctionAdaptorv4.cxx +++ b/Modules/Numerics/Optimizersv4/src/itkSingleValuedVnlCostFunctionAdaptorv4.cxx @@ -24,7 +24,7 @@ SingleValuedVnlCostFunctionAdaptorv4::SingleValuedVnlCostFunctionAdaptorv4(unsig { m_ScalesInitialized = false; m_Reporter = Object::New(); - m_CachedValue = NumericTraits::ZeroValue(); + m_CachedValue = MeasureType{}; m_CachedDerivative.Fill(0); } diff --git a/Modules/Numerics/Optimizersv4/test/itkGradientDescentOptimizerBasev4Test.cxx b/Modules/Numerics/Optimizersv4/test/itkGradientDescentOptimizerBasev4Test.cxx index 4b2433aff17..4ef6e4469e4 100644 --- a/Modules/Numerics/Optimizersv4/test/itkGradientDescentOptimizerBasev4Test.cxx +++ b/Modules/Numerics/Optimizersv4/test/itkGradientDescentOptimizerBasev4Test.cxx @@ -57,14 +57,14 @@ class GradientDescentOptimizerBasev4TestMetric : public itk::ObjectToObjectMetri void GetDerivative(DerivativeType & derivative) const override { - derivative.Fill(itk::NumericTraits::ZeroValue()); + derivative.Fill(ParametersValueType{}); } void GetValueAndDerivative(MeasureType & value, DerivativeType & derivative) const override { value = itk::NumericTraits::OneValue(); - derivative.Fill(itk::NumericTraits::ZeroValue()); + derivative.Fill(ParametersValueType{}); } unsigned int diff --git a/Modules/Numerics/Optimizersv4/test/itkMultiGradientOptimizerv4Test.cxx b/Modules/Numerics/Optimizersv4/test/itkMultiGradientOptimizerv4Test.cxx index 942976038a5..bb68bf63a70 100644 --- a/Modules/Numerics/Optimizersv4/test/itkMultiGradientOptimizerv4Test.cxx +++ b/Modules/Numerics/Optimizersv4/test/itkMultiGradientOptimizerv4Test.cxx @@ -72,7 +72,7 @@ class MultiGradientOptimizerv4TestMetric : public itk::ObjectToObjectMetricBase void GetDerivative(DerivativeType & derivative) const override { - derivative.Fill(itk::NumericTraits::ZeroValue()); + derivative.Fill(ParametersValueType{}); } void @@ -187,7 +187,7 @@ class MultiGradientOptimizerv4TestMetric2 : public itk::ObjectToObjectMetricBase void GetDerivative(DerivativeType & derivative) const override { - derivative.Fill(itk::NumericTraits::ZeroValue()); + derivative.Fill(ParametersValueType{}); } void diff --git a/Modules/Numerics/Optimizersv4/test/itkMultiStartOptimizerv4Test.cxx b/Modules/Numerics/Optimizersv4/test/itkMultiStartOptimizerv4Test.cxx index 413c480e11d..92c0441438b 100644 --- a/Modules/Numerics/Optimizersv4/test/itkMultiStartOptimizerv4Test.cxx +++ b/Modules/Numerics/Optimizersv4/test/itkMultiStartOptimizerv4Test.cxx @@ -68,7 +68,7 @@ class MultiStartOptimizerv4TestMetric : public itk::ObjectToObjectMetricBase void GetDerivative(DerivativeType & derivative) const override { - derivative.Fill(itk::NumericTraits::ZeroValue()); + derivative.Fill(ParametersValueType{}); } void diff --git a/Modules/Numerics/Statistics/include/itkCovarianceSampleFilter.hxx b/Modules/Numerics/Statistics/include/itkCovarianceSampleFilter.hxx index 1b584e8974d..bc97c35d6d0 100644 --- a/Modules/Numerics/Statistics/include/itkCovarianceSampleFilter.hxx +++ b/Modules/Numerics/Statistics/include/itkCovarianceSampleFilter.hxx @@ -120,7 +120,7 @@ CovarianceSampleFilter::GenerateData() MatrixType output = decoratedOutput->Get(); output.SetSize(measurementVectorSize, measurementVectorSize); - output.Fill(NumericTraits::ZeroValue()); + output.Fill(typename MatrixType::ValueType{}); auto * decoratedMeanOutput = itkDynamicCastInDebugMode(this->ProcessObject::GetOutput(1)); diff --git a/Modules/Numerics/Statistics/include/itkHistogram.hxx b/Modules/Numerics/Statistics/include/itkHistogram.hxx index ba1fed55882..145e12a8909 100644 --- a/Modules/Numerics/Statistics/include/itkHistogram.hxx +++ b/Modules/Numerics/Statistics/include/itkHistogram.hxx @@ -35,7 +35,7 @@ Histogram::Histogram() { for (unsigned int i = 0; i < this->GetMeasurementVectorSize() + 1; ++i) { - this->m_OffsetTable[i] = itk::NumericTraits::ZeroValue(); + this->m_OffsetTable[i] = InstanceIdentifier{}; } } @@ -45,7 +45,7 @@ Histogram::Size() const -> InstanceIdentifier { if (this->GetMeasurementVectorSize() == 0) { - return itk::NumericTraits::ZeroValue(); + return InstanceIdentifier{}; } InstanceIdentifier size = 1; for (unsigned int i = 0; i < this->GetMeasurementVectorSize(); ++i) diff --git a/Modules/Numerics/Statistics/include/itkHistogramToRunLengthFeaturesFilter.hxx b/Modules/Numerics/Statistics/include/itkHistogramToRunLengthFeaturesFilter.hxx index 02c63afe566..6aa42926bc3 100644 --- a/Modules/Numerics/Statistics/include/itkHistogramToRunLengthFeaturesFilter.hxx +++ b/Modules/Numerics/Statistics/include/itkHistogramToRunLengthFeaturesFilter.hxx @@ -93,7 +93,7 @@ HistogramToRunLengthFeaturesFilter::GenerateData() for (HistogramIterator hit = inputHistogram->Begin(); hit != inputHistogram->End(); ++hit) { MeasurementType frequency = hit.GetFrequency(); - if (Math::ExactlyEquals(frequency, NumericTraits::ZeroValue())) + if (Math::ExactlyEquals(frequency, MeasurementType{})) { continue; } diff --git a/Modules/Numerics/Statistics/include/itkHistogramToTextureFeaturesFilter.hxx b/Modules/Numerics/Statistics/include/itkHistogramToTextureFeaturesFilter.hxx index 6ac4de6f1ba..2d6bac74a49 100644 --- a/Modules/Numerics/Statistics/include/itkHistogramToTextureFeaturesFilter.hxx +++ b/Modules/Numerics/Statistics/include/itkHistogramToTextureFeaturesFilter.hxx @@ -122,7 +122,7 @@ HistogramToTextureFeaturesFilter::GenerateData() { RelativeFrequencyType frequency = *rFreqIterator; ++rFreqIterator; - if (Math::AlmostEquals(frequency, NumericTraits::ZeroValue())) + if (Math::AlmostEquals(frequency, RelativeFrequencyType{})) { continue; // no use doing these calculations if we're just multiplying by // zero. diff --git a/Modules/Numerics/Statistics/include/itkScalarImageToRunLengthMatrixFilter.hxx b/Modules/Numerics/Statistics/include/itkScalarImageToRunLengthMatrixFilter.hxx index f399745214b..066a1bb7206 100644 --- a/Modules/Numerics/Statistics/include/itkScalarImageToRunLengthMatrixFilter.hxx +++ b/Modules/Numerics/Statistics/include/itkScalarImageToRunLengthMatrixFilter.hxx @@ -34,7 +34,7 @@ ScalarImageToRunLengthMatrixFilter::Sc : m_NumberOfBinsPerAxis(Self::DefaultBinsPerAxis) , m_Min(NumericTraits::NonpositiveMin()) , m_Max(NumericTraits::max()) - , m_MinDistance(NumericTraits::ZeroValue()) + , m_MinDistance(RealType{}) , m_MaxDistance(NumericTraits::max()) , m_InsidePixelValue(NumericTraits::OneValue()) { @@ -190,7 +190,7 @@ ScalarImageToRunLengthMatrixFilter::Ge MeasurementType centerBinMax = this->GetOutput()->GetBinMaxFromValue(0, centerPixelIntensity); MeasurementType lastBinMax = this->GetOutput()->GetDimensionMaxs(0)[this->GetOutput()->GetSize(0) - 1]; - PixelType pixelIntensity(NumericTraits::ZeroValue()); + PixelType pixelIntensity(PixelType{}); IndexType index; index = centerIndex + offset; diff --git a/Modules/Numerics/Statistics/include/itkSpatialNeighborSubsampler.hxx b/Modules/Numerics/Statistics/include/itkSpatialNeighborSubsampler.hxx index 540226da5d7..2ada5cf7c2d 100644 --- a/Modules/Numerics/Statistics/include/itkSpatialNeighborSubsampler.hxx +++ b/Modules/Numerics/Statistics/include/itkSpatialNeighborSubsampler.hxx @@ -113,7 +113,7 @@ SpatialNeighborSubsampler::Search(const InstanceIdentifier & q { if (queryIndex[dim] < static_cast(m_Radius[dim])) { - searchIndex[dim] = std::max(NumericTraits::ZeroValue(), constraintIndex[dim]); + searchIndex[dim] = std::max(IndexValueType{}, constraintIndex[dim]); } else { diff --git a/Modules/Numerics/Statistics/include/itkStandardDeviationPerComponentSampleFilter.hxx b/Modules/Numerics/Statistics/include/itkStandardDeviationPerComponentSampleFilter.hxx index 081991f763e..5c5fa9f1a50 100644 --- a/Modules/Numerics/Statistics/include/itkStandardDeviationPerComponentSampleFilter.hxx +++ b/Modules/Numerics/Statistics/include/itkStandardDeviationPerComponentSampleFilter.hxx @@ -66,7 +66,7 @@ StandardDeviationPerComponentSampleFilter::MakeOutput(DataObjectPointer using ValueType = typename MeasurementVectorTraitsTypes::ValueType; MeasurementVectorType standardDeviation; NumericTraits::SetLength(standardDeviation, this->GetMeasurementVectorSize()); - standardDeviation.Fill(NumericTraits::ZeroValue()); + standardDeviation.Fill(ValueType{}); typename MeasurementVectorRealDecoratedType::Pointer decoratedStandardDeviation = MeasurementVectorRealDecoratedType::New(); decoratedStandardDeviation->Set(standardDeviation); @@ -78,7 +78,7 @@ StandardDeviationPerComponentSampleFilter::MakeOutput(DataObjectPointer using ValueType = typename MeasurementVectorTraitsTypes::ValueType; MeasurementVectorType mean; NumericTraits::SetLength(mean, this->GetMeasurementVectorSize()); - mean.Fill(NumericTraits::ZeroValue()); + mean.Fill(ValueType{}); typename MeasurementVectorRealDecoratedType::Pointer decoratedStandardDeviation = MeasurementVectorRealDecoratedType::New(); decoratedStandardDeviation->Set(mean); diff --git a/Modules/Numerics/Statistics/include/itkSubsample.hxx b/Modules/Numerics/Statistics/include/itkSubsample.hxx index e80bdf94f4d..7c208fdf623 100644 --- a/Modules/Numerics/Statistics/include/itkSubsample.hxx +++ b/Modules/Numerics/Statistics/include/itkSubsample.hxx @@ -29,7 +29,7 @@ template Subsample::Subsample() { m_Sample = nullptr; - m_TotalFrequency = NumericTraits::ZeroValue(); + m_TotalFrequency = AbsoluteFrequencyType{}; m_ActiveDimension = 0; } @@ -78,7 +78,7 @@ Subsample::InitializeWithAllInstances() auto idIter = m_IdHolder.begin(); typename TSample::ConstIterator iter = m_Sample->Begin(); typename TSample::ConstIterator last = m_Sample->End(); - m_TotalFrequency = NumericTraits::ZeroValue(); + m_TotalFrequency = AbsoluteFrequencyType{}; while (iter != last) { *idIter++ = iter.GetInstanceIdentifier(); @@ -114,7 +114,7 @@ void Subsample::Clear() { m_IdHolder.clear(); - m_TotalFrequency = NumericTraits::ZeroValue(); + m_TotalFrequency = AbsoluteFrequencyType{}; this->Modified(); } diff --git a/Modules/Numerics/Statistics/include/itkUniformRandomSpatialNeighborSubsampler.hxx b/Modules/Numerics/Statistics/include/itkUniformRandomSpatialNeighborSubsampler.hxx index b76f73b74a0..5a70b78fc50 100644 --- a/Modules/Numerics/Statistics/include/itkUniformRandomSpatialNeighborSubsampler.hxx +++ b/Modules/Numerics/Statistics/include/itkUniformRandomSpatialNeighborSubsampler.hxx @@ -89,7 +89,7 @@ UniformRandomSpatialNeighborSubsampler::Search(const InstanceI { if (queryIndex[dim] < static_cast(this->m_Radius[dim])) { - searchStartIndex[dim] = std::max(NumericTraits::ZeroValue(), constraintIndex[dim]); + searchStartIndex[dim] = std::max(IndexValueType{}, constraintIndex[dim]); } else { diff --git a/Modules/Numerics/Statistics/include/itkWeightedCentroidKdTreeGenerator.hxx b/Modules/Numerics/Statistics/include/itkWeightedCentroidKdTreeGenerator.hxx index 002a07fe8ac..516906acfc3 100644 --- a/Modules/Numerics/Statistics/include/itkWeightedCentroidKdTreeGenerator.hxx +++ b/Modules/Numerics/Statistics/include/itkWeightedCentroidKdTreeGenerator.hxx @@ -63,7 +63,7 @@ WeightedCentroidKdTreeGenerator::GenerateNonterminalNode(unsigned int typename KdTreeNodeType::CentroidType weightedCentroid; NumericTraits::SetLength(weightedCentroid, this->GetMeasurementVectorSize()); MeasurementVectorType tempVector; - weightedCentroid.Fill(NumericTraits::ZeroValue()); + weightedCentroid.Fill(MeasurementType{}); for (i = beginIndex; i < endIndex; ++i) { diff --git a/Modules/Numerics/Statistics/include/itkWeightedCovarianceSampleFilter.hxx b/Modules/Numerics/Statistics/include/itkWeightedCovarianceSampleFilter.hxx index 24530bc8e26..2230f0f2e1c 100644 --- a/Modules/Numerics/Statistics/include/itkWeightedCovarianceSampleFilter.hxx +++ b/Modules/Numerics/Statistics/include/itkWeightedCovarianceSampleFilter.hxx @@ -70,7 +70,7 @@ WeightedCovarianceSampleFilter::ComputeCovarianceMatrixWithWeightingFun MatrixType output = decoratedOutput->Get(); output.SetSize(measurementVectorSize, measurementVectorSize); - output.Fill(NumericTraits::ZeroValue()); + output.Fill(typename MatrixType::ValueType{}); auto * decoratedMeanOutput = itkDynamicCastInDebugMode(this->ProcessObject::GetOutput(1)); @@ -167,7 +167,7 @@ WeightedCovarianceSampleFilter::ComputeCovarianceMatrixWithWeights() MatrixType output = decoratedOutput->Get(); output.SetSize(measurementVectorSize, measurementVectorSize); - output.Fill(NumericTraits::ZeroValue()); + output.Fill(typename MatrixType::ValueType{}); auto * decoratedMeanOutput = itkDynamicCastInDebugMode(this->ProcessObject::GetOutput(1)); diff --git a/Modules/Numerics/Statistics/src/itkDenseFrequencyContainer2.cxx b/Modules/Numerics/Statistics/src/itkDenseFrequencyContainer2.cxx index 2c56db836cc..b7d65750f18 100644 --- a/Modules/Numerics/Statistics/src/itkDenseFrequencyContainer2.cxx +++ b/Modules/Numerics/Statistics/src/itkDenseFrequencyContainer2.cxx @@ -24,7 +24,7 @@ namespace Statistics DenseFrequencyContainer2::DenseFrequencyContainer2() { m_FrequencyContainer = FrequencyContainerType::New(); - m_TotalFrequency = NumericTraits::ZeroValue(); + m_TotalFrequency = TotalAbsoluteFrequencyType{}; } void @@ -37,8 +37,8 @@ DenseFrequencyContainer2::Initialize(SizeValueType length) void DenseFrequencyContainer2::SetToZero() { - m_FrequencyContainer->Fill(NumericTraits::ZeroValue()); - m_TotalFrequency = NumericTraits::ZeroValue(); + m_FrequencyContainer->Fill(AbsoluteFrequencyType{}); + m_TotalFrequency = TotalAbsoluteFrequencyType{}; } bool @@ -59,7 +59,7 @@ DenseFrequencyContainer2::GetFrequency(const InstanceIdentifier id) const { if (id >= m_FrequencyContainer->Size()) { - return NumericTraits::ZeroValue(); + return AbsoluteFrequencyType{}; } return (*m_FrequencyContainer)[id]; } diff --git a/Modules/Numerics/Statistics/src/itkSparseFrequencyContainer2.cxx b/Modules/Numerics/Statistics/src/itkSparseFrequencyContainer2.cxx index 2556f55b46c..30c57f1d506 100644 --- a/Modules/Numerics/Statistics/src/itkSparseFrequencyContainer2.cxx +++ b/Modules/Numerics/Statistics/src/itkSparseFrequencyContainer2.cxx @@ -23,7 +23,7 @@ namespace Statistics { SparseFrequencyContainer2::SparseFrequencyContainer2() { - m_TotalFrequency = NumericTraits::ZeroValue(); + m_TotalFrequency = TotalAbsoluteFrequencyType{}; } void SparseFrequencyContainer2::Initialize(SizeValueType) @@ -38,10 +38,10 @@ SparseFrequencyContainer2::SetToZero() auto end = m_FrequencyContainer.end(); while (iter != end) { - iter->second = NumericTraits::ZeroValue(); + iter->second = AbsoluteFrequencyType{}; ++iter; } - m_TotalFrequency = NumericTraits::ZeroValue(); + m_TotalFrequency = TotalAbsoluteFrequencyType{}; } bool diff --git a/Modules/Numerics/Statistics/test/itkDenseFrequencyContainer2Test.cxx b/Modules/Numerics/Statistics/test/itkDenseFrequencyContainer2Test.cxx index 229bcc8a8d5..260ea767740 100644 --- a/Modules/Numerics/Statistics/test/itkDenseFrequencyContainer2Test.cxx +++ b/Modules/Numerics/Statistics/test/itkDenseFrequencyContainer2Test.cxx @@ -73,7 +73,7 @@ itkDenseFrequencyContainer2Test(int, char *[]) return EXIT_FAILURE; } - if (container->GetFrequency(binOutOfBound) != itk::NumericTraits::ZeroValue()) + if (container->GetFrequency(binOutOfBound) != AbsoluteFrequencyType{}) { std::cerr << "GetFrequency() method should have returned zero frequency since the bin index is out of bound \n" << std::endl; diff --git a/Modules/Numerics/Statistics/test/itkSparseFrequencyContainer2Test.cxx b/Modules/Numerics/Statistics/test/itkSparseFrequencyContainer2Test.cxx index 7055f8d5f2b..fbd57016f96 100644 --- a/Modules/Numerics/Statistics/test/itkSparseFrequencyContainer2Test.cxx +++ b/Modules/Numerics/Statistics/test/itkSparseFrequencyContainer2Test.cxx @@ -67,7 +67,7 @@ itkSparseFrequencyContainer2Test(int, char *[]) container->SetToZero(); for (unsigned int bin = 0; bin < numberOfBins; ++bin) { - if (container->GetFrequency(bin) != itk::NumericTraits::ZeroValue()) + if (container->GetFrequency(bin) != AbsoluteFrequencyType{}) { std::cout << "Failed !" << std::endl; std::cout << "Stored Frequency in bin is not zero after SetToZero() method invocation" << std::endl; diff --git a/Modules/Registration/Common/include/itkBlockMatchingImageFilter.hxx b/Modules/Registration/Common/include/itkBlockMatchingImageFilter.hxx index 37145dc7abe..d4320bf1989 100644 --- a/Modules/Registration/Common/include/itkBlockMatchingImageFilter.hxx +++ b/Modules/Registration/Common/include/itkBlockMatchingImageFilter.hxx @@ -178,7 +178,7 @@ void BlockMatchingImageFilter:: BeforeThreadedGenerateData() { - this->m_PointsCount = itk::NumericTraits::ZeroValue(); + this->m_PointsCount = SizeValueType{}; FeaturePointsConstPointer featurePoints = this->GetFeaturePoints(); if (featurePoints) { diff --git a/Modules/Registration/Common/include/itkGradientDifferenceImageToImageMetric.hxx b/Modules/Registration/Common/include/itkGradientDifferenceImageToImageMetric.hxx index a8a3c52309f..b0aee655b80 100644 --- a/Modules/Registration/Common/include/itkGradientDifferenceImageToImageMetric.hxx +++ b/Modules/Registration/Common/include/itkGradientDifferenceImageToImageMetric.hxx @@ -300,7 +300,7 @@ GradientDifferenceImageToImageMetric::ComputeMeasure( for (iDimension = 0; iDimension < FixedImageDimension; ++iDimension) { - if (Math::AlmostEquals(m_Variance[iDimension], NumericTraits::ZeroValue())) + if (Math::AlmostEquals(m_Variance[iDimension], MovedGradientPixelType{})) { continue; } diff --git a/Modules/Registration/Common/include/itkHistogramImageToImageMetric.hxx b/Modules/Registration/Common/include/itkHistogramImageToImageMetric.hxx index e15bda97220..7b0a2f1af00 100644 --- a/Modules/Registration/Common/include/itkHistogramImageToImageMetric.hxx +++ b/Modules/Registration/Common/include/itkHistogramImageToImageMetric.hxx @@ -33,7 +33,7 @@ HistogramImageToImageMetric::HistogramImageToImageMet m_DerivativeStepLength = 0.1; m_DerivativeStepLengthScales.Fill(1); m_UpperBoundIncreaseFactor = 0.001; - m_PaddingValue = NumericTraits::ZeroValue(); + m_PaddingValue = FixedImagePixelType{}; m_Histogram = HistogramType::New(); m_Histogram->SetMeasurementVectorSize(2); m_LowerBoundSetByUser = false; @@ -194,7 +194,7 @@ HistogramImageToImageMetric::GetDerivative(const Tran // Calculate gradient. derivative = DerivativeType(ParametersDimension); - derivative.Fill(NumericTraits::ZeroValue()); + derivative.Fill(typename DerivativeType::ValueType{}); auto pHistogram = HistogramType::New(); pHistogram->SetMeasurementVectorSize(2); diff --git a/Modules/Registration/Common/include/itkKappaStatisticImageToImageMetric.hxx b/Modules/Registration/Common/include/itkKappaStatisticImageToImageMetric.hxx index 4c24cc337b2..07e9de79dfc 100644 --- a/Modules/Registration/Common/include/itkKappaStatisticImageToImageMetric.hxx +++ b/Modules/Registration/Common/include/itkKappaStatisticImageToImageMetric.hxx @@ -180,15 +180,15 @@ KappaStatisticImageToImageMetric::GetDerivative(const const unsigned int ParametersDimension = this->GetNumberOfParameters(); derivative = DerivativeType(ParametersDimension); - derivative.Fill(NumericTraits::ZeroValue()); + derivative.Fill(typename DerivativeType::ValueType{}); using ArrayType = Array; ArrayType sum1(ParametersDimension); - sum1.Fill(NumericTraits::ZeroValue()); + sum1.Fill(typename ArrayType::ValueType{}); ArrayType sum2(ParametersDimension); - sum2.Fill(NumericTraits::ZeroValue()); + sum2.Fill(typename ArrayType::ValueType{}); int fixedArea = 0; int movingArea = 0; diff --git a/Modules/Registration/Common/include/itkMatchCardinalityImageToImageMetric.h b/Modules/Registration/Common/include/itkMatchCardinalityImageToImageMetric.h index 7dce3f2b4bc..2c711c972bd 100644 --- a/Modules/Registration/Common/include/itkMatchCardinalityImageToImageMetric.h +++ b/Modules/Registration/Common/include/itkMatchCardinalityImageToImageMetric.h @@ -102,7 +102,7 @@ class ITK_TEMPLATE_EXPORT MatchCardinalityImageToImageMetric : public ImageToIma GetDerivative(const TransformParametersType &, DerivativeType & derivative) const override { itkWarningMacro("This metric does not provide metric derivatives."); - derivative.Fill(NumericTraits::ZeroValue()); + derivative.Fill(typename DerivativeType::ValueType{}); } /** Get the value of the metric at a particular parameter diff --git a/Modules/Registration/Common/include/itkMatchCardinalityImageToImageMetric.hxx b/Modules/Registration/Common/include/itkMatchCardinalityImageToImageMetric.hxx index 413478a130d..4da259fbca2 100644 --- a/Modules/Registration/Common/include/itkMatchCardinalityImageToImageMetric.hxx +++ b/Modules/Registration/Common/include/itkMatchCardinalityImageToImageMetric.hxx @@ -67,7 +67,7 @@ MatchCardinalityImageToImageMetric::GetNonconstValue( std::vector::iterator cIt; for (mIt = m_ThreadMatches.begin(), cIt = m_ThreadCounts.begin(); mIt != m_ThreadMatches.end(); ++mIt, ++cIt) { - *mIt = NumericTraits::ZeroValue(); + *mIt = MeasureType{}; *cIt = 0; } diff --git a/Modules/Registration/Common/include/itkMattesMutualInformationImageToImageMetric.hxx b/Modules/Registration/Common/include/itkMattesMutualInformationImageToImageMetric.hxx index 1108cb743d8..4e9e6381215 100644 --- a/Modules/Registration/Common/include/itkMattesMutualInformationImageToImageMetric.hxx +++ b/Modules/Registration/Common/include/itkMattesMutualInformationImageToImageMetric.hxx @@ -306,7 +306,7 @@ MattesMutualInformationImageToImageMetric::Initialize for (ThreadIdType workUnitID = 0; workUnitID < this->m_NumberOfWorkUnits; ++workUnitID) { this->m_MMIMetricPerThreadVariables[workUnitID].MetricDerivative.SetSize(this->GetNumberOfParameters()); - this->m_MMIMetricPerThreadVariables[workUnitID].MetricDerivative.Fill(NumericTraits::ZeroValue()); + this->m_MMIMetricPerThreadVariables[workUnitID].MetricDerivative.Fill(MeasureType{}); } } @@ -699,7 +699,7 @@ MattesMutualInformationImageToImageMetric::GetValueAn DerivativeType & derivative) const { // Set output values to zero - value = NumericTraits::ZeroValue(); + value = MeasureType{}; if (this->m_UseExplicitPDFDerivatives) { @@ -715,7 +715,7 @@ MattesMutualInformationImageToImageMetric::GetValueAn this->m_PRatioArray.Fill(0.0); for (ThreadIdType workUnitID = 0; workUnitID < this->m_NumberOfWorkUnits; ++workUnitID) { - this->m_MMIMetricPerThreadVariables[workUnitID].MetricDerivative.Fill(NumericTraits::ZeroValue()); + this->m_MMIMetricPerThreadVariables[workUnitID].MetricDerivative.Fill(MeasureType{}); } this->m_ImplicitDerivativesSecondPass = false; } diff --git a/Modules/Registration/Common/include/itkMeanReciprocalSquareDifferencePointSetToImageMetric.hxx b/Modules/Registration/Common/include/itkMeanReciprocalSquareDifferencePointSetToImageMetric.hxx index 07fda3cfc80..a693308fa81 100644 --- a/Modules/Registration/Common/include/itkMeanReciprocalSquareDifferencePointSetToImageMetric.hxx +++ b/Modules/Registration/Common/include/itkMeanReciprocalSquareDifferencePointSetToImageMetric.hxx @@ -113,7 +113,7 @@ MeanReciprocalSquareDifferencePointSetToImageMetricGetNumberOfParameters(); derivative = DerivativeType(ParametersDimension); - derivative.Fill(NumericTraits::ZeroValue()); + derivative.Fill(typename DerivativeType::ValueType{}); PointIterator pointItr = fixedPointSet->GetPoints()->Begin(); PointIterator pointEnd = fixedPointSet->GetPoints()->End(); @@ -211,7 +211,7 @@ MeanReciprocalSquareDifferencePointSetToImageMetricGetNumberOfParameters(); derivative = DerivativeType(ParametersDimension); - derivative.Fill(NumericTraits::ZeroValue()); + derivative.Fill(typename DerivativeType::ValueType{}); PointIterator pointItr = fixedPointSet->GetPoints()->Begin(); PointIterator pointEnd = fixedPointSet->GetPoints()->End(); diff --git a/Modules/Registration/Common/include/itkMeanSquaresImageToImageMetric.hxx b/Modules/Registration/Common/include/itkMeanSquaresImageToImageMetric.hxx index a3068cd1fd2..ed0e00717b3 100644 --- a/Modules/Registration/Common/include/itkMeanSquaresImageToImageMetric.hxx +++ b/Modules/Registration/Common/include/itkMeanSquaresImageToImageMetric.hxx @@ -102,7 +102,7 @@ MeanSquaresImageToImageMetric::GetValue(const Paramet for (unsigned int i = 0; i < this->m_NumberOfWorkUnits; ++i) { - m_PerThread[i].m_MSE = NumericTraits::ZeroValue(); + m_PerThread[i].m_MSE = MeasureType{}; } // Set up the parameters in the transform @@ -196,7 +196,7 @@ MeanSquaresImageToImageMetric::GetValueAndDerivative( // Reset the joint pdfs to zero for (unsigned int i = 0; i < this->m_NumberOfWorkUnits; ++i) { - m_PerThread[i].m_MSE = NumericTraits::ZeroValue(); + m_PerThread[i].m_MSE = MeasureType{}; } // Set output values to zero diff --git a/Modules/Registration/Common/include/itkMeanSquaresPointSetToImageMetric.hxx b/Modules/Registration/Common/include/itkMeanSquaresPointSetToImageMetric.hxx index f566e1affdb..9c23bee53ae 100644 --- a/Modules/Registration/Common/include/itkMeanSquaresPointSetToImageMetric.hxx +++ b/Modules/Registration/Common/include/itkMeanSquaresPointSetToImageMetric.hxx @@ -108,7 +108,7 @@ MeanSquaresPointSetToImageMetric::GetDerivative( const unsigned int ParametersDimension = this->GetNumberOfParameters(); derivative = DerivativeType(ParametersDimension); - derivative.Fill(NumericTraits::ZeroValue()); + derivative.Fill(typename DerivativeType::ValueType{}); PointIterator pointItr = fixedPointSet->GetPoints()->Begin(); PointIterator pointEnd = fixedPointSet->GetPoints()->End(); @@ -205,7 +205,7 @@ MeanSquaresPointSetToImageMetric::GetValueAndDeriv const unsigned int ParametersDimension = this->GetNumberOfParameters(); derivative = DerivativeType(ParametersDimension); - derivative.Fill(NumericTraits::ZeroValue()); + derivative.Fill(typename DerivativeType::ValueType{}); PointIterator pointItr = fixedPointSet->GetPoints()->Begin(); PointIterator pointEnd = fixedPointSet->GetPoints()->End(); diff --git a/Modules/Registration/Common/include/itkMutualInformationImageToImageMetric.hxx b/Modules/Registration/Common/include/itkMutualInformationImageToImageMetric.hxx index 29bbe60b29f..e7a79b8936b 100644 --- a/Modules/Registration/Common/include/itkMutualInformationImageToImageMetric.hxx +++ b/Modules/Registration/Common/include/itkMutualInformationImageToImageMetric.hxx @@ -266,7 +266,7 @@ MutualInformationImageToImageMetric::GetValueAndDeriv MeasureType & value, DerivativeType & derivative) const { - value = NumericTraits::ZeroValue(); + value = MeasureType{}; unsigned int numberOfParameters = this->m_Transform->GetNumberOfParameters(); DerivativeType temp(numberOfParameters); temp.Fill(0); diff --git a/Modules/Registration/Common/include/itkNormalizedCorrelationImageToImageMetric.hxx b/Modules/Registration/Common/include/itkNormalizedCorrelationImageToImageMetric.hxx index a9747e9fdb2..3a76f10d677 100644 --- a/Modules/Registration/Common/include/itkNormalizedCorrelationImageToImageMetric.hxx +++ b/Modules/Registration/Common/include/itkNormalizedCorrelationImageToImageMetric.hxx @@ -115,7 +115,7 @@ NormalizedCorrelationImageToImageMetric::GetValue( } else { - measure = NumericTraits::ZeroValue(); + measure = MeasureType{}; } return measure; @@ -161,13 +161,13 @@ NormalizedCorrelationImageToImageMetric::GetDerivativ const unsigned int ParametersDimension = this->GetNumberOfParameters(); derivative = DerivativeType(ParametersDimension); - derivative.Fill(NumericTraits::ZeroValue()); + derivative.Fill(typename DerivativeType::ValueType{}); DerivativeType derivativeF(ParametersDimension); - derivativeF.Fill(NumericTraits::ZeroValue()); + derivativeF.Fill(typename DerivativeType::ValueType{}); DerivativeType derivativeM(ParametersDimension); - derivativeM.Fill(NumericTraits::ZeroValue()); + derivativeM.Fill(typename DerivativeType::ValueType{}); ti.GoToBegin(); // First compute the sums @@ -298,7 +298,7 @@ NormalizedCorrelationImageToImageMetric::GetDerivativ { for (unsigned int i = 0; i < ParametersDimension; ++i) { - derivative[i] = NumericTraits::ZeroValue(); + derivative[i] = MeasureType{}; } } } @@ -344,16 +344,16 @@ NormalizedCorrelationImageToImageMetric::GetValueAndD const unsigned int ParametersDimension = this->GetNumberOfParameters(); derivative = DerivativeType(ParametersDimension); - derivative.Fill(NumericTraits::ZeroValue()); + derivative.Fill(typename DerivativeType::ValueType{}); DerivativeType derivativeF(ParametersDimension); - derivativeF.Fill(NumericTraits::ZeroValue()); + derivativeF.Fill(typename DerivativeType::ValueType{}); DerivativeType derivativeM(ParametersDimension); - derivativeM.Fill(NumericTraits::ZeroValue()); + derivativeM.Fill(typename DerivativeType::ValueType{}); DerivativeType derivativeM1(ParametersDimension); - derivativeM1.Fill(NumericTraits::ZeroValue()); + derivativeM1.Fill(typename DerivativeType::ValueType{}); ti.GoToBegin(); // First compute the sums @@ -483,9 +483,9 @@ NormalizedCorrelationImageToImageMetric::GetValueAndD { for (unsigned int i = 0; i < ParametersDimension; ++i) { - derivative[i] = NumericTraits::ZeroValue(); + derivative[i] = MeasureType{}; } - value = NumericTraits::ZeroValue(); + value = MeasureType{}; } } diff --git a/Modules/Registration/Common/include/itkNormalizedCorrelationPointSetToImageMetric.hxx b/Modules/Registration/Common/include/itkNormalizedCorrelationPointSetToImageMetric.hxx index ac8566779ce..f935d47f29d 100644 --- a/Modules/Registration/Common/include/itkNormalizedCorrelationPointSetToImageMetric.hxx +++ b/Modules/Registration/Common/include/itkNormalizedCorrelationPointSetToImageMetric.hxx @@ -101,7 +101,7 @@ NormalizedCorrelationPointSetToImageMetric::GetVal } else { - measure = NumericTraits::ZeroValue(); + measure = MeasureType{}; } return measure; @@ -141,16 +141,16 @@ NormalizedCorrelationPointSetToImageMetric::GetDer const unsigned int ParametersDimension = this->GetNumberOfParameters(); derivative = DerivativeType(ParametersDimension); - derivative.Fill(NumericTraits::ZeroValue()); + derivative.Fill(typename DerivativeType::ValueType{}); DerivativeType derivativeF(ParametersDimension); - derivativeF.Fill(NumericTraits::ZeroValue()); + derivativeF.Fill(typename DerivativeType::ValueType{}); DerivativeType derivativeM(ParametersDimension); - derivativeM.Fill(NumericTraits::ZeroValue()); + derivativeM.Fill(typename DerivativeType::ValueType{}); DerivativeType derivativeO(ParametersDimension); - derivativeO.Fill(NumericTraits::ZeroValue()); + derivativeO.Fill(typename DerivativeType::ValueType{}); PointIterator pointItr = fixedPointSet->GetPoints()->Begin(); PointIterator pointEnd = fixedPointSet->GetPoints()->End(); @@ -244,7 +244,7 @@ NormalizedCorrelationPointSetToImageMetric::GetDer { for (unsigned int i = 0; i < ParametersDimension; ++i) { - derivative[i] = NumericTraits::ZeroValue(); + derivative[i] = MeasureType{}; } } } @@ -284,16 +284,16 @@ NormalizedCorrelationPointSetToImageMetric::GetVal const unsigned int ParametersDimension = this->GetNumberOfParameters(); derivative = DerivativeType(ParametersDimension); - derivative.Fill(NumericTraits::ZeroValue()); + derivative.Fill(typename DerivativeType::ValueType{}); DerivativeType derivativeF(ParametersDimension); - derivativeF.Fill(NumericTraits::ZeroValue()); + derivativeF.Fill(typename DerivativeType::ValueType{}); DerivativeType derivativeM(ParametersDimension); - derivativeM.Fill(NumericTraits::ZeroValue()); + derivativeM.Fill(typename DerivativeType::ValueType{}); DerivativeType derivativeO(ParametersDimension); - derivativeO.Fill(NumericTraits::ZeroValue()); + derivativeO.Fill(typename DerivativeType::ValueType{}); PointIterator pointItr = fixedPointSet->GetPoints()->Begin(); PointIterator pointEnd = fixedPointSet->GetPoints()->End(); @@ -388,9 +388,9 @@ NormalizedCorrelationPointSetToImageMetric::GetVal { for (unsigned int i = 0; i < ParametersDimension; ++i) { - derivative[i] = NumericTraits::ZeroValue(); + derivative[i] = MeasureType{}; } - value = NumericTraits::ZeroValue(); + value = MeasureType{}; } } diff --git a/Modules/Registration/Common/test/itkBSplineTransformParametersAdaptorTest.cxx b/Modules/Registration/Common/test/itkBSplineTransformParametersAdaptorTest.cxx index 1651db50fd4..cc05a9dd1ed 100644 --- a/Modules/Registration/Common/test/itkBSplineTransformParametersAdaptorTest.cxx +++ b/Modules/Registration/Common/test/itkBSplineTransformParametersAdaptorTest.cxx @@ -62,7 +62,7 @@ itkBSplineTransformParametersAdaptorTest(int, char *[]) using ParametersType = TransformType::ParametersType; unsigned long numberOfParameters = transform->GetNumberOfParameters(); ParametersType parameters(numberOfParameters); - parameters.Fill(itk::NumericTraits::ZeroValue()); + parameters.Fill(ParametersType::ValueType{}); /** * Set the parameters in the transform diff --git a/Modules/Registration/FEM/include/itkFEMFiniteDifferenceFunctionLoad.hxx b/Modules/Registration/FEM/include/itkFEMFiniteDifferenceFunctionLoad.hxx index f7ee9557824..d84a128993c 100644 --- a/Modules/Registration/FEM/include/itkFEMFiniteDifferenceFunctionLoad.hxx +++ b/Modules/Registration/FEM/include/itkFEMFiniteDifferenceFunctionLoad.hxx @@ -28,7 +28,7 @@ template FiniteDifferenceFunctionLoad::FiniteDifferenceFunctionLoad() : m_MovingImage(nullptr) , m_FixedImage(nullptr) - , m_Gamma(NumericTraits::ZeroValue()) + , m_Gamma(Float{}) { m_MovingSize.Fill(0); m_FixedSize.Fill(0); diff --git a/Modules/Registration/Metricsv4/include/itkANTSNeighborhoodCorrelationImageToImageMetricv4GetValueAndDerivativeThreader.hxx b/Modules/Registration/Metricsv4/include/itkANTSNeighborhoodCorrelationImageToImageMetricv4GetValueAndDerivativeThreader.hxx index 0dc153223b8..d1d2ec2ae80 100644 --- a/Modules/Registration/Metricsv4/include/itkANTSNeighborhoodCorrelationImageToImageMetricv4GetValueAndDerivativeThreader.hxx +++ b/Modules/Registration/Metricsv4/include/itkANTSNeighborhoodCorrelationImageToImageMetricv4GetValueAndDerivativeThreader.hxx @@ -326,9 +326,9 @@ ANTSNeighborhoodCorrelationImageToImageMetricv4GetValueAndDerivativeThreader< OffsetValueType numberOfFillZero = this->m_ANTSAssociate->GetVirtualRegion().GetIndex(0) - (scanRegion.GetIndex(0) - scanParameters.radius[0]); - if (numberOfFillZero < NumericTraits::ZeroValue()) + if (numberOfFillZero < OffsetValueType{}) { - numberOfFillZero = NumericTraits::ZeroValue(); + numberOfFillZero = OffsetValueType{}; } scanParameters.numberOfFillZero = numberOfFillZero; @@ -337,11 +337,11 @@ ANTSNeighborhoodCorrelationImageToImageMetricv4GetValueAndDerivativeThreader< scanParameters.windowLength = scanIt.Size(); scanParameters.scanRegionBeginIndexDim0 = scanIt.GetBeginIndex()[0]; - scanMem.fixedA = NumericTraits::ZeroValue(); - scanMem.movingA = NumericTraits::ZeroValue(); - scanMem.sFixedMoving = NumericTraits::ZeroValue(); - scanMem.sFixedFixed = NumericTraits::ZeroValue(); - scanMem.sMovingMoving = NumericTraits::ZeroValue(); + scanMem.fixedA = QueueRealType{}; + scanMem.movingA = QueueRealType{}; + scanMem.sFixedMoving = QueueRealType{}; + scanMem.sFixedFixed = QueueRealType{}; + scanMem.sMovingMoving = QueueRealType{}; scanMem.fixedImageGradient.Fill(0.0); scanMem.movingImageGradient.Fill(0.0); @@ -538,7 +538,7 @@ ANTSNeighborhoodCorrelationImageToImageMetricv4GetValueAndDerivativeThreader< if (!(sFixedFixed > NumericTraits::epsilon() && sMovingMoving > NumericTraits::epsilon())) { - deriv.Fill(NumericTraits::ZeroValue()); + deriv.Fill(DerivativeValueType{}); return; } @@ -563,7 +563,7 @@ ANTSNeighborhoodCorrelationImageToImageMetricv4GetValueAndDerivativeThreader< for (NumberOfParametersType par = 0; par < numberOfLocalParameters; ++par) { - deriv[par] = NumericTraits::ZeroValue(); + deriv[par] = DerivativeValueType{}; for (ImageDimensionType dim = 0; dim < TImageToImageMetric::MovingImageDimension; ++dim) { deriv[par] += derivWRTImage[dim] * jacobian(dim, par); diff --git a/Modules/Registration/Metricsv4/include/itkCorrelationImageToImageMetricv4.hxx b/Modules/Registration/Metricsv4/include/itkCorrelationImageToImageMetricv4.hxx index 0182850a780..b974d2b70ba 100644 --- a/Modules/Registration/Metricsv4/include/itkCorrelationImageToImageMetricv4.hxx +++ b/Modules/Registration/Metricsv4/include/itkCorrelationImageToImageMetricv4.hxx @@ -78,8 +78,8 @@ CorrelationImageToImageMetricv4m_AverageFix = NumericTraits::ZeroValue(); - this->m_AverageMov = NumericTraits::ZeroValue(); + this->m_AverageFix = MeasureType{}; + this->m_AverageMov = MeasureType{}; // compute the average intensity of the sampled pixels // Invoke the pipeline in the helper threader diff --git a/Modules/Registration/Metricsv4/include/itkCorrelationImageToImageMetricv4GetValueAndDerivativeThreader.hxx b/Modules/Registration/Metricsv4/include/itkCorrelationImageToImageMetricv4GetValueAndDerivativeThreader.hxx index 48e0fa622c2..f574a7a360d 100644 --- a/Modules/Registration/Metricsv4/include/itkCorrelationImageToImageMetricv4GetValueAndDerivativeThreader.hxx +++ b/Modules/Registration/Metricsv4/include/itkCorrelationImageToImageMetricv4GetValueAndDerivativeThreader.hxx @@ -66,21 +66,14 @@ CorrelationImageToImageMetricv4GetValueAndDerivativeThreader::ZeroValue(); - m_CorrelationMetricValueDerivativePerThreadVariables[i].f2 = - NumericTraits::ZeroValue(); - m_CorrelationMetricValueDerivativePerThreadVariables[i].m2 = - NumericTraits::ZeroValue(); - m_CorrelationMetricValueDerivativePerThreadVariables[i].f = - NumericTraits::ZeroValue(); - m_CorrelationMetricValueDerivativePerThreadVariables[i].m = - NumericTraits::ZeroValue(); - - this->m_CorrelationMetricValueDerivativePerThreadVariables[i].mdm.Fill( - NumericTraits::ZeroValue()); - this->m_CorrelationMetricValueDerivativePerThreadVariables[i].fdm.Fill( - NumericTraits::ZeroValue()); + m_CorrelationMetricValueDerivativePerThreadVariables[i].fm = InternalComputationValueType{}; + m_CorrelationMetricValueDerivativePerThreadVariables[i].f2 = InternalComputationValueType{}; + m_CorrelationMetricValueDerivativePerThreadVariables[i].m2 = InternalComputationValueType{}; + m_CorrelationMetricValueDerivativePerThreadVariables[i].f = InternalComputationValueType{}; + m_CorrelationMetricValueDerivativePerThreadVariables[i].m = InternalComputationValueType{}; + + this->m_CorrelationMetricValueDerivativePerThreadVariables[i].mdm.Fill(DerivativeValueType{}); + this->m_CorrelationMetricValueDerivativePerThreadVariables[i].fdm.Fill(DerivativeValueType{}); } } @@ -97,7 +90,7 @@ CorrelationImageToImageMetricv4GetValueAndDerivativeThreaderm_CorrelationAssociate->m_NumberOfValidPoints = NumericTraits::ZeroValue(); + this->m_CorrelationAssociate->m_NumberOfValidPoints = SizeValueType{}; for (ThreadIdType i = 0; i < numWorkUnitsUsed; ++i) { this->m_CorrelationAssociate->m_NumberOfValidPoints += @@ -116,7 +109,7 @@ CorrelationImageToImageMetricv4GetValueAndDerivativeThreaderm_CorrelationAssociate->m_NumberOfValidPoints); /* Accumulate the metric value from threads and store */ - this->m_CorrelationAssociate->m_Value = NumericTraits::ZeroValue(); + this->m_CorrelationAssociate->m_Value = InternalComputationValueType{}; InternalComputationValueType fm{}; InternalComputationValueType f2{}; InternalComputationValueType m2{}; @@ -143,8 +136,8 @@ CorrelationImageToImageMetricv4GetValueAndDerivativeThreader::ZeroValue()); - mdm.Fill(NumericTraits::ZeroValue()); + fdm.Fill(DerivativeValueType{}); + mdm.Fill(DerivativeValueType{}); const auto fc = static_cast(2.0); diff --git a/Modules/Registration/Metricsv4/include/itkCorrelationImageToImageMetricv4HelperThreader.hxx b/Modules/Registration/Metricsv4/include/itkCorrelationImageToImageMetricv4HelperThreader.hxx index 7aedd591feb..c0be5965cc6 100644 --- a/Modules/Registration/Metricsv4/include/itkCorrelationImageToImageMetricv4HelperThreader.hxx +++ b/Modules/Registration/Metricsv4/include/itkCorrelationImageToImageMetricv4HelperThreader.hxx @@ -49,8 +49,8 @@ CorrelationImageToImageMetricv4HelperThreaderm_CorrelationMetricPerThreadVariables[i].FixSum = NumericTraits::ZeroValue(); - this->m_CorrelationMetricPerThreadVariables[i].MovSum = NumericTraits::ZeroValue(); + this->m_CorrelationMetricPerThreadVariables[i].FixSum = InternalComputationValueType{}; + this->m_CorrelationMetricPerThreadVariables[i].MovSum = InternalComputationValueType{}; } } @@ -62,7 +62,7 @@ CorrelationImageToImageMetricv4HelperThreaderm_CorrelationAssociate->m_NumberOfValidPoints = NumericTraits::ZeroValue(); + this->m_CorrelationAssociate->m_NumberOfValidPoints = SizeValueType{}; const ThreadIdType numWorkUnitsUsed = this->GetNumberOfWorkUnitsUsed(); diff --git a/Modules/Registration/Metricsv4/include/itkDemonsImageToImageMetricv4.hxx b/Modules/Registration/Metricsv4/include/itkDemonsImageToImageMetricv4.hxx index 175135d4aaf..71168766bfe 100644 --- a/Modules/Registration/Metricsv4/include/itkDemonsImageToImageMetricv4.hxx +++ b/Modules/Registration/Metricsv4/include/itkDemonsImageToImageMetricv4.hxx @@ -82,7 +82,7 @@ DemonsImageToImageMetricv4m_Normalizer = NumericTraits::ZeroValue(); + this->m_Normalizer = TInternalComputationValueType{}; for (ImageDimensionType k = 0; k < dimension; ++k) { this->m_Normalizer += imageSpacing[k] * imageSpacing[k]; diff --git a/Modules/Registration/Metricsv4/include/itkDemonsImageToImageMetricv4GetValueAndDerivativeThreader.hxx b/Modules/Registration/Metricsv4/include/itkDemonsImageToImageMetricv4GetValueAndDerivativeThreader.hxx index 45b82b429f3..dc567871776 100644 --- a/Modules/Registration/Metricsv4/include/itkDemonsImageToImageMetricv4GetValueAndDerivativeThreader.hxx +++ b/Modules/Registration/Metricsv4/include/itkDemonsImageToImageMetricv4GetValueAndDerivativeThreader.hxx @@ -98,7 +98,7 @@ DemonsImageToImageMetricv4GetValueAndDerivativeThreaderm_DemonsAssociate->GetIntensityDifferenceThreshold() || denominator < this->m_DemonsAssociate->GetDenominatorThreshold()) { - localDerivativeReturn.Fill(NumericTraits::ZeroValue()); + localDerivativeReturn.Fill(DerivativeValueType{}); return true; } diff --git a/Modules/Registration/Metricsv4/include/itkImageToImageMetricv4.hxx b/Modules/Registration/Metricsv4/include/itkImageToImageMetricv4.hxx index b060e7c2a08..cc70cbaa0d2 100644 --- a/Modules/Registration/Metricsv4/include/itkImageToImageMetricv4.hxx +++ b/Modules/Registration/Metricsv4/include/itkImageToImageMetricv4.hxx @@ -292,7 +292,7 @@ ImageToImageMetricv4m_DerivativeResult->SetSize(globalDerivativeSize); } /* Clear derivative final result. */ - this->m_DerivativeResult->Fill(NumericTraits::ZeroValue()); + this->m_DerivativeResult->Fill(DerivativeValueType{}); } } @@ -308,7 +308,7 @@ ImageToImageMetricv4::ZeroValue(); + mappedFixedPixelValue = FixedImagePixelType{}; // map the point into fixed space this->LocalTransformPoint(virtualPoint, mappedFixedPoint); @@ -349,7 +349,7 @@ ImageToImageMetricv4::ZeroValue(); + mappedMovingPixelValue = MovingImagePixelType{}; // map the point into moving space diff --git a/Modules/Registration/Metricsv4/include/itkImageToImageMetricv4GetValueAndDerivativeThreaderBase.hxx b/Modules/Registration/Metricsv4/include/itkImageToImageMetricv4GetValueAndDerivativeThreaderBase.hxx index 97970af8eee..f844994df54 100644 --- a/Modules/Registration/Metricsv4/include/itkImageToImageMetricv4GetValueAndDerivativeThreaderBase.hxx +++ b/Modules/Registration/Metricsv4/include/itkImageToImageMetricv4GetValueAndDerivativeThreaderBase.hxx @@ -91,10 +91,8 @@ ImageToImageMetricv4GetValueAndDerivativeThreaderBasem_GetValueAndDerivativePerThreadVariables[workUnit].NumberOfValidPoints = - NumericTraits::ZeroValue(); - this->m_GetValueAndDerivativePerThreadVariables[workUnit].Measure = - NumericTraits::ZeroValue(); + this->m_GetValueAndDerivativePerThreadVariables[workUnit].NumberOfValidPoints = SizeValueType{}; + this->m_GetValueAndDerivativePerThreadVariables[workUnit].Measure = InternalComputationValueType{}; if (this->m_Associate->GetComputeDerivative()) { if (this->m_Associate->m_MovingTransform->GetTransformCategory() != @@ -120,7 +118,7 @@ ImageToImageMetricv4GetValueAndDerivativeThreaderBaseGetNumberOfWorkUnitsUsed(); /* Store the number of valid points the enclosing class \c * m_NumberOfValidPoints by collecting the valid points per thread. */ - this->m_Associate->m_NumberOfValidPoints = NumericTraits::ZeroValue(); + this->m_Associate->m_NumberOfValidPoints = SizeValueType{}; for (ThreadIdType i = 0; i < numWorkUnitsUsed; ++i) { this->m_Associate->m_NumberOfValidPoints += this->m_GetValueAndDerivativePerThreadVariables[i].NumberOfValidPoints; @@ -153,7 +151,7 @@ ImageToImageMetricv4GetValueAndDerivativeThreaderBasem_Associate->VerifyNumberOfValidPoints(this->m_Associate->m_Value, *(this->m_Associate->m_DerivativeResult))) { - this->m_Associate->m_Value = NumericTraits::ZeroValue(); + this->m_Associate->m_Value = MeasureType{}; /* Accumulate the metric value from threads and store the average. */ for (ThreadIdType threadId = 0; threadId < numWorkUnitsUsed; ++threadId) { diff --git a/Modules/Registration/Metricsv4/include/itkJensenHavrdaCharvatTsallisPointSetToPointSetMetricv4.hxx b/Modules/Registration/Metricsv4/include/itkJensenHavrdaCharvatTsallisPointSetToPointSetMetricv4.hxx index a0977c0c160..85ff6dbd3cb 100644 --- a/Modules/Registration/Metricsv4/include/itkJensenHavrdaCharvatTsallisPointSetToPointSetMetricv4.hxx +++ b/Modules/Registration/Metricsv4/include/itkJensenHavrdaCharvatTsallisPointSetToPointSetMetricv4.hxx @@ -96,9 +96,9 @@ JensenHavrdaCharvatTsallisPointSetToPointSetMetricv4::ZeroValue()); + derivativeReturn.Fill(DerivativeValueType{}); } - value = NumericTraits::ZeroValue(); + value = MeasureType{}; /** * first term only @@ -110,7 +110,7 @@ JensenHavrdaCharvatTsallisPointSetToPointSetMetricv4m_TotalNumberOfPoints; - if (Math::AlmostEquals(probabilityStar, NumericTraits::ZeroValue())) + if (Math::AlmostEquals(probabilityStar, RealType{})) { return; } @@ -141,7 +141,7 @@ JensenHavrdaCharvatTsallisPointSetToPointSetMetricv4m_MovingDensityFunction->GetGaussian(neighbors[n])->Evaluate(samplePoint); - if (Math::AlmostEquals(gaussian, NumericTraits::ZeroValue())) + if (Math::AlmostEquals(gaussian, RealType{})) { continue; } diff --git a/Modules/Registration/Metricsv4/include/itkJointHistogramMutualInformationComputeJointPDFThreaderBase.hxx b/Modules/Registration/Metricsv4/include/itkJointHistogramMutualInformationComputeJointPDFThreaderBase.hxx index 8b5b200a16b..4793b69d6fd 100644 --- a/Modules/Registration/Metricsv4/include/itkJointHistogramMutualInformationComputeJointPDFThreaderBase.hxx +++ b/Modules/Registration/Metricsv4/include/itkJointHistogramMutualInformationComputeJointPDFThreaderBase.hxx @@ -49,8 +49,8 @@ JointHistogramMutualInformationComputeJointPDFThreaderBasem_JointHistogramMIPerThreadVariables[i].JointHistogram->SetRegions( this->m_Associate->m_JointPDF->GetLargestPossibleRegion()); this->m_JointHistogramMIPerThreadVariables[i].JointHistogram->Allocate(); - this->m_JointHistogramMIPerThreadVariables[i].JointHistogram->FillBuffer(NumericTraits::ZeroValue()); - this->m_JointHistogramMIPerThreadVariables[i].JointHistogramCount = NumericTraits::ZeroValue(); + this->m_JointHistogramMIPerThreadVariables[i].JointHistogram->FillBuffer(SizeValueType{}); + this->m_JointHistogramMIPerThreadVariables[i].JointHistogramCount = SizeValueType{}; } } @@ -113,7 +113,7 @@ JointHistogramMutualInformationComputeJointPDFThreaderBaseGetNumberOfWorkUnitsUsed(); using JointHistogramPixelType = typename JointHistogramType::PixelType; - this->m_Associate->m_JointHistogramTotalCount = NumericTraits::ZeroValue(); + this->m_Associate->m_JointHistogramTotalCount = SizeValueType{}; for (ThreadIdType i = 0; i < numberOfWorkUnitsUsed; ++i) { this->m_Associate->m_JointHistogramTotalCount += this->m_JointHistogramMIPerThreadVariables[i].JointHistogramCount; @@ -121,7 +121,7 @@ JointHistogramMutualInformationComputeJointPDFThreaderBasem_Associate->m_JointHistogramTotalCount == 0) { - this->m_Associate->m_JointPDF->FillBuffer(NumericTraits::ZeroValue()); + this->m_Associate->m_JointPDF->FillBuffer(SizeValueType{}); return; } @@ -141,7 +141,7 @@ JointHistogramMutualInformationComputeJointPDFThreaderBase::ZeroValue(); + jointHistogramPixel = JointHistogramPixelType{}; for (ThreadIdType i = 0; i < numberOfWorkUnitsUsed; ++i) { jointHistogramPixel += jointHistogramPerThreadIts[i].Get(); diff --git a/Modules/Registration/Metricsv4/include/itkJointHistogramMutualInformationGetValueAndDerivativeThreader.hxx b/Modules/Registration/Metricsv4/include/itkJointHistogramMutualInformationGetValueAndDerivativeThreader.hxx index 8d9bd002873..f476fc1b35b 100644 --- a/Modules/Registration/Metricsv4/include/itkJointHistogramMutualInformationGetValueAndDerivativeThreader.hxx +++ b/Modules/Registration/Metricsv4/include/itkJointHistogramMutualInformationGetValueAndDerivativeThreader.hxx @@ -152,7 +152,7 @@ JointHistogramMutualInformationGetValueAndDerivativeThreader< } // end if-block to check non-zero bin contribution else { - scalingfactor = NumericTraits::ZeroValue(); + scalingfactor = InternalComputationValueType{}; } /* Use a pre-allocated jacobian object for efficiency */ @@ -211,7 +211,7 @@ JointHistogramMutualInformationGetValueAndDerivativeThreader< rightpoint[0] = 1.0; } InternalComputationValueType delta = rightpoint[0] - leftpoint[0]; - if (delta > NumericTraits::ZeroValue()) + if (delta > InternalComputationValueType{}) { InternalComputationValueType deriv = this->m_ThreaderFixedImageMarginalPDFInterpolator[threadId]->Evaluate(rightpoint) - @@ -220,7 +220,7 @@ JointHistogramMutualInformationGetValueAndDerivativeThreader< } else { - return NumericTraits::ZeroValue(); + return InternalComputationValueType{}; } } @@ -258,7 +258,7 @@ JointHistogramMutualInformationGetValueAndDerivativeThreader< rightpoint[0] = 1.0; } InternalComputationValueType delta = rightpoint[0] - leftpoint[0]; - if (delta > NumericTraits::ZeroValue()) + if (delta > InternalComputationValueType{}) { InternalComputationValueType deriv = this->m_JointHistogramMIPerThreadVariables[threadId].MovingImageMarginalPDFInterpolator->Evaluate(rightpoint) - @@ -267,7 +267,7 @@ JointHistogramMutualInformationGetValueAndDerivativeThreader< } else { - return NumericTraits::ZeroValue(); + return InternalComputationValueType{}; } } @@ -312,7 +312,7 @@ JointHistogramMutualInformationGetValueAndDerivativeThreader< InternalComputationValueType delta = rightpoint[ind] - leftpoint[ind]; InternalComputationValueType deriv{}; - if (delta > NumericTraits::ZeroValue()) + if (delta > InternalComputationValueType{}) { deriv = this->m_JointHistogramMIPerThreadVariables[threadId].JointPDFInterpolator->Evaluate(rightpoint) - this->m_JointHistogramMIPerThreadVariables[threadId].JointPDFInterpolator->Evaluate(leftpoint); diff --git a/Modules/Registration/Metricsv4/include/itkJointHistogramMutualInformationImageToImageMetricv4.hxx b/Modules/Registration/Metricsv4/include/itkJointHistogramMutualInformationImageToImageMetricv4.hxx index d8ae4b911f8..107909a6d58 100644 --- a/Modules/Registration/Metricsv4/include/itkJointHistogramMutualInformationImageToImageMetricv4.hxx +++ b/Modules/Registration/Metricsv4/include/itkJointHistogramMutualInformationImageToImageMetricv4.hxx @@ -40,14 +40,14 @@ JointHistogramMutualInformationImageToImageMetricv4< { // Initialize histogram properties this->m_NumberOfHistogramBins = 20; - this->m_FixedImageTrueMin = NumericTraits::ZeroValue(); - this->m_FixedImageTrueMax = NumericTraits::ZeroValue(); - this->m_MovingImageTrueMin = NumericTraits::ZeroValue(); - this->m_MovingImageTrueMax = NumericTraits::ZeroValue(); - this->m_FixedImageBinSize = NumericTraits::ZeroValue(); - this->m_MovingImageBinSize = NumericTraits::ZeroValue(); + this->m_FixedImageTrueMin = TInternalComputationValueType{}; + this->m_FixedImageTrueMax = TInternalComputationValueType{}; + this->m_MovingImageTrueMin = TInternalComputationValueType{}; + this->m_MovingImageTrueMax = TInternalComputationValueType{}; + this->m_FixedImageBinSize = TInternalComputationValueType{}; + this->m_MovingImageBinSize = TInternalComputationValueType{}; this->m_Padding = 2; - this->m_JointPDFSum = NumericTraits::ZeroValue(); + this->m_JointPDFSum = TInternalComputationValueType{}; this->m_Log2 = std::log(2.0); this->m_VarianceForJointPDFSmoothing = 1.5; @@ -245,7 +245,7 @@ JointHistogramMutualInformationImageToImageMetricv4m_VarianceForJointPDFSmoothing > NumericTraits::ZeroValue()) + if (this->m_VarianceForJointPDFSmoothing > JointPDFValueType{}) { using DgType = DiscreteGaussianImageFilter; auto dg = DgType::New(); diff --git a/Modules/Registration/Metricsv4/include/itkMattesMutualInformationImageToImageMetricv4GetValueAndDerivativeThreader.hxx b/Modules/Registration/Metricsv4/include/itkMattesMutualInformationImageToImageMetricv4GetValueAndDerivativeThreader.hxx index e667eb5835b..bbdee84a731 100644 --- a/Modules/Registration/Metricsv4/include/itkMattesMutualInformationImageToImageMetricv4GetValueAndDerivativeThreader.hxx +++ b/Modules/Registration/Metricsv4/include/itkMattesMutualInformationImageToImageMetricv4GetValueAndDerivativeThreader.hxx @@ -155,7 +155,7 @@ MattesMutualInformationImageToImageMetricv4GetValueAndDerivativeThreader< this->m_MattesAssociate->GetNumberOfParameters()); // Initialize to zero because we accumulate, and so skipped points will // behave properly - this->m_MattesAssociate->m_LocalDerivativeByParzenBin[n].Fill(NumericTraits::ZeroValue()); + this->m_MattesAssociate->m_LocalDerivativeByParzenBin[n].Fill(DerivativeValueType{}); } } if (this->m_MattesAssociate->GetComputeDerivative() && !this->m_MattesAssociate->HasLocalSupport()) @@ -422,7 +422,7 @@ MattesMutualInformationImageToImageMetricv4GetValueAndDerivativeThreader< /* Store the number of valid points in the enclosing class * m_NumberOfValidPoints by collecting the valid points per thread. * We do this here because we're skipping Superclass::AfterThreadedExecution*/ - this->m_MattesAssociate->m_NumberOfValidPoints = NumericTraits::ZeroValue(); + this->m_MattesAssociate->m_NumberOfValidPoints = SizeValueType{}; for (ThreadIdType workUnitID = 0; workUnitID < localNumberOfWorkUnitsUsed; ++workUnitID) { this->m_MattesAssociate->m_NumberOfValidPoints += diff --git a/Modules/Registration/Metricsv4/include/itkMeanSquaresImageToImageMetricv4GetValueAndDerivativeThreader.hxx b/Modules/Registration/Metricsv4/include/itkMeanSquaresImageToImageMetricv4GetValueAndDerivativeThreader.hxx index 1380746569f..f2f8bc57861 100644 --- a/Modules/Registration/Metricsv4/include/itkMeanSquaresImageToImageMetricv4GetValueAndDerivativeThreader.hxx +++ b/Modules/Registration/Metricsv4/include/itkMeanSquaresImageToImageMetricv4GetValueAndDerivativeThreader.hxx @@ -43,7 +43,7 @@ MeanSquaresImageToImageMetricv4GetValueAndDerivativeThreader< /** Only the voxelwise contribution given the point pairs. */ FixedImagePixelType diff = fixedImageValue - movingImageValue; const unsigned int nComponents = NumericTraits::GetLength(diff); - metricValueReturn = NumericTraits::ZeroValue(); + metricValueReturn = MeasureType{}; for (unsigned int nc = 0; nc < nComponents; ++nc) { @@ -68,7 +68,7 @@ MeanSquaresImageToImageMetricv4GetValueAndDerivativeThreader< for (unsigned int par = 0; par < this->GetCachedNumberOfLocalParameters(); ++par) { - localDerivativeReturn[par] = NumericTraits::ZeroValue(); + localDerivativeReturn[par] = DerivativeValueType{}; for (unsigned int nc = 0; nc < nComponents; ++nc) { MeasureType diffValue = DefaultConvertPixelTraits::GetNthComponent(nc, diff); diff --git a/Modules/Registration/Metricsv4/include/itkObjectToObjectMultiMetricv4.hxx b/Modules/Registration/Metricsv4/include/itkObjectToObjectMultiMetricv4.hxx index e5c7bae5261..69f58d211a0 100644 --- a/Modules/Registration/Metricsv4/include/itkObjectToObjectMultiMetricv4.hxx +++ b/Modules/Registration/Metricsv4/include/itkObjectToObjectMultiMetricv4.hxx @@ -289,7 +289,7 @@ ObjectToObjectMultiMetricv4GetNumberOfParameters()); } - derivativeResult.Fill(NumericTraits::ZeroValue()); + derivativeResult.Fill(DerivativeValueType{}); DerivativeType metricDerivative; MeasureType metricValue{}; diff --git a/Modules/Registration/Metricsv4/include/itkPointSetToPointSetMetricWithIndexv4.hxx b/Modules/Registration/Metricsv4/include/itkPointSetToPointSetMetricWithIndexv4.hxx index 23da8b62d0c..ae59ae8642a 100644 --- a/Modules/Registration/Metricsv4/include/itkPointSetToPointSetMetricWithIndexv4.hxx +++ b/Modules/Registration/Metricsv4/include/itkPointSetToPointSetMetricWithIndexv4.hxx @@ -259,7 +259,7 @@ PointSetToPointSetMetricWithIndexv4m_FixedTransformedPointSet->GetNumberOfPoints()); } - derivative.Fill(NumericTraits::ZeroValue()); + derivative.Fill(DerivativeValueType{}); /* * Split pointset in nWorkUnits ranges and sum individually @@ -288,7 +288,7 @@ PointSetToPointSetMetricWithIndexv4::ZeroValue()); + threadLocalTransformDerivative.Fill(DerivativeValueType{}); CompensatedDerivative threadDerivativeSum(numberOfLocalParameters); @@ -330,7 +330,7 @@ PointSetToPointSetMetricWithIndexv4::ZeroValue()); + threadLocalTransformDerivative.Fill(DerivativeValueType{}); if (this->m_CalculateValueAndDerivativeInTangentSpace) { diff --git a/Modules/Registration/Metricsv4/test/itkDemonsImageToImageMetricv4RegistrationTest.cxx b/Modules/Registration/Metricsv4/test/itkDemonsImageToImageMetricv4RegistrationTest.cxx index 4edb0723aad..bde88f16f90 100644 --- a/Modules/Registration/Metricsv4/test/itkDemonsImageToImageMetricv4RegistrationTest.cxx +++ b/Modules/Registration/Metricsv4/test/itkDemonsImageToImageMetricv4RegistrationTest.cxx @@ -141,7 +141,7 @@ itkDemonsImageToImageMetricv4RegistrationTest(int argc, char * argv[]) using FixedRescaleFilterType = itk::RescaleIntensityImageFilter; auto fixedRescaleFilter = FixedRescaleFilterType::New(); fixedRescaleFilter->SetInput(fixedImage); - fixedRescaleFilter->SetOutputMinimum(itk::NumericTraits::ZeroValue()); + fixedRescaleFilter->SetOutputMinimum(PixelType{}); fixedRescaleFilter->SetOutputMaximum(itk::NumericTraits::OneValue()); fixedRescaleFilter->Update(); fixedImage = fixedRescaleFilter->GetOutput(); @@ -149,7 +149,7 @@ itkDemonsImageToImageMetricv4RegistrationTest(int argc, char * argv[]) using MovingRescaleFilterType = itk::RescaleIntensityImageFilter; auto movingRescaleFilter = MovingRescaleFilterType::New(); movingRescaleFilter->SetInput(movingImage); - movingRescaleFilter->SetOutputMinimum(itk::NumericTraits::ZeroValue()); + movingRescaleFilter->SetOutputMinimum(PixelType{}); movingRescaleFilter->SetOutputMaximum(itk::NumericTraits::OneValue()); movingRescaleFilter->Update(); movingImage = movingRescaleFilter->GetOutput(); diff --git a/Modules/Registration/Metricsv4/test/itkEuclideanDistancePointSetMetricTest2.cxx b/Modules/Registration/Metricsv4/test/itkEuclideanDistancePointSetMetricTest2.cxx index d2f16d1f54f..599ea118802 100644 --- a/Modules/Registration/Metricsv4/test/itkEuclideanDistancePointSetMetricTest2.cxx +++ b/Modules/Registration/Metricsv4/test/itkEuclideanDistancePointSetMetricTest2.cxx @@ -219,8 +219,7 @@ itkEuclideanDistancePointSetMetricTest2Run() bool derivative2IsZero = true; for (itk::SizeValueType n = 0; n < metric->GetNumberOfParameters(); ++n) { - if (itk::Math::NotExactlyEquals(derivative2[n], - itk::NumericTraits::ZeroValue())) + if (itk::Math::NotExactlyEquals(derivative2[n], typename PointSetMetricType::DerivativeValueType{})) { derivative2IsZero = false; } diff --git a/Modules/Registration/Metricsv4/test/itkImageToImageMetricv4RegistrationTest.cxx b/Modules/Registration/Metricsv4/test/itkImageToImageMetricv4RegistrationTest.cxx index 86b9a6d532a..dcfa7ec4c55 100644 --- a/Modules/Registration/Metricsv4/test/itkImageToImageMetricv4RegistrationTest.cxx +++ b/Modules/Registration/Metricsv4/test/itkImageToImageMetricv4RegistrationTest.cxx @@ -68,7 +68,7 @@ ImageToImageMetricv4RegistrationTestRun(typename TMetric::Pointer metric, spacing.Fill(itk::NumericTraits::OneValue()); typename TImage::PointType origin; - origin.Fill(itk::NumericTraits::ZeroValue()); + origin.Fill(CoordinateRepresentationType{}); typename TImage::DirectionType direction; direction.Fill(itk::NumericTraits::OneValue()); @@ -91,7 +91,7 @@ ImageToImageMetricv4RegistrationTestRun(typename TMetric::Pointer metric, { if (it.GetIndex()[n] < boundary || (static_cast(size[n]) - it.GetIndex()[n]) <= boundary) { - it.Set(itk::NumericTraits::ZeroValue()); + it.Set(PixelType{}); break; } } diff --git a/Modules/Registration/Metricsv4/test/itkMeanSquaresImageToImageMetricv4VectorRegistrationTest.cxx b/Modules/Registration/Metricsv4/test/itkMeanSquaresImageToImageMetricv4VectorRegistrationTest.cxx index d59ed79631e..fb62f99bbb7 100644 --- a/Modules/Registration/Metricsv4/test/itkMeanSquaresImageToImageMetricv4VectorRegistrationTest.cxx +++ b/Modules/Registration/Metricsv4/test/itkMeanSquaresImageToImageMetricv4VectorRegistrationTest.cxx @@ -277,7 +277,7 @@ itkMeanSquaresImageToImageMetricv4VectorRegistrationTest(int argc, char * argv[] resample->SetOutputOrigin(fixedImage->GetOrigin()); resample->SetOutputSpacing(fixedImage->GetSpacing()); resample->SetOutputDirection(fixedImage->GetDirection()); - resample->SetDefaultPixelValue(itk::NumericTraits::ZeroValue()); + resample->SetDefaultPixelValue(FixedImageType::PixelType{}); resample->Update(); // write out the displacement field diff --git a/Modules/Registration/Metricsv4/test/itkObjectToObjectMultiMetricv4RegistrationTest.cxx b/Modules/Registration/Metricsv4/test/itkObjectToObjectMultiMetricv4RegistrationTest.cxx index 9a4d0e260fb..7e3292d1771 100644 --- a/Modules/Registration/Metricsv4/test/itkObjectToObjectMultiMetricv4RegistrationTest.cxx +++ b/Modules/Registration/Metricsv4/test/itkObjectToObjectMultiMetricv4RegistrationTest.cxx @@ -96,7 +96,7 @@ ObjectToObjectMultiMetricv4RegistrationTestCreateImages(typename TImage::Pointer spacing.Fill(itk::NumericTraits::OneValue()); typename TImage::PointType origin; - origin.Fill(itk::NumericTraits::ZeroValue()); + origin.Fill(CoordinateRepresentationType{}); typename TImage::DirectionType direction; direction.Fill(itk::NumericTraits::OneValue()); @@ -119,7 +119,7 @@ ObjectToObjectMultiMetricv4RegistrationTestCreateImages(typename TImage::Pointer { if (it.GetIndex()[n] < boundary || (static_cast(size[n]) - it.GetIndex()[n]) <= boundary) { - it.Set(itk::NumericTraits::ZeroValue()); + it.Set(PixelType{}); break; } } diff --git a/Modules/Registration/Metricsv4/test/itkObjectToObjectMultiMetricv4Test.cxx b/Modules/Registration/Metricsv4/test/itkObjectToObjectMultiMetricv4Test.cxx index b52eec0da75..87fea549336 100644 --- a/Modules/Registration/Metricsv4/test/itkObjectToObjectMultiMetricv4Test.cxx +++ b/Modules/Registration/Metricsv4/test/itkObjectToObjectMultiMetricv4Test.cxx @@ -128,7 +128,7 @@ itkObjectToObjectMultiMetricv4TestEvaluate(ObjectToObjectMultiMetricv4TestMultiM MeasureType weightedMetricValue{}; MultiMetricType::DerivativeType metricDerivative; MultiMetricType::DerivativeType DerivResultOfGetValueAndDerivativeTruth(multiVariateMetric->GetNumberOfParameters()); - DerivResultOfGetValueAndDerivativeTruth.Fill(itk::NumericTraits::ZeroValue()); + DerivResultOfGetValueAndDerivativeTruth.Fill(MultiMetricType::DerivativeValueType{}); MultiMetricType::DerivativeValueType totalMagnitude{}; for (itk::SizeValueType i = 0; i < multiVariateMetric->GetNumberOfMetrics(); ++i) diff --git a/Modules/Registration/RegistrationMethodsv4/include/itkSyNImageRegistrationMethod.hxx b/Modules/Registration/RegistrationMethodsv4/include/itkSyNImageRegistrationMethod.hxx index 3d0d8c039c3..18fd5ffd994 100644 --- a/Modules/Registration/RegistrationMethodsv4/include/itkSyNImageRegistrationMethod.hxx +++ b/Modules/Registration/RegistrationMethodsv4/include/itkSyNImageRegistrationMethod.hxx @@ -605,7 +605,7 @@ typename SyNImageRegistrationMethodGetLargestPossibleRegion().GetNumberOfPixels() * ImageDimension; MetricDerivativeType metricDerivative(metricDerivativeSize); - metricDerivative.Fill(NumericTraits::ZeroValue()); + metricDerivative.Fill(typename MetricDerivativeType::ValueType{}); this->m_Metric->GetValueAndDerivative(value, metricDerivative); // Ensure that the size of the optimizer weights is the same as the @@ -680,7 +680,7 @@ typename SyNImageRegistrationMethodm_LearningRate; - if (maxNorm > NumericTraits::ZeroValue()) + if (maxNorm > RealType{}) { scale /= maxNorm; } diff --git a/Modules/Registration/RegistrationMethodsv4/include/itkTimeVaryingBSplineVelocityFieldImageRegistrationMethod.hxx b/Modules/Registration/RegistrationMethodsv4/include/itkTimeVaryingBSplineVelocityFieldImageRegistrationMethod.hxx index 460185a1e97..75339e9a717 100644 --- a/Modules/Registration/RegistrationMethodsv4/include/itkTimeVaryingBSplineVelocityFieldImageRegistrationMethod.hxx +++ b/Modules/Registration/RegistrationMethodsv4/include/itkTimeVaryingBSplineVelocityFieldImageRegistrationMethod.hxx @@ -351,7 +351,7 @@ TimeVaryingBSplineVelocityFieldImageRegistrationMethod< TPointSet>::GetMetricDerivativePointSetForAllTimePoints(VelocityFieldPointSetType * velocityFieldPointSet, WeightsContainerType * velocityFieldWeights) { - this->m_CurrentMetricValue = NumericTraits::ZeroValue(); + this->m_CurrentMetricValue = MeasureType{}; SizeValueType numberOfIntegrationSteps = this->m_NumberOfTimePointSamples + 2; @@ -727,7 +727,7 @@ TimeVaryingBSplineVelocityFieldImageRegistrationMethod< RealType value; - metricDerivative.Fill(NumericTraits::ZeroValue()); + metricDerivative.Fill(typename MetricDerivativeType::ValueType{}); this->m_Metric->GetValueAndDerivative(value, metricDerivative); this->m_CurrentMetricValue += value; diff --git a/Modules/Registration/RegistrationMethodsv4/include/itkTimeVaryingVelocityFieldImageRegistrationMethodv4.hxx b/Modules/Registration/RegistrationMethodsv4/include/itkTimeVaryingVelocityFieldImageRegistrationMethodv4.hxx index bc58d57387b..da58ef27bf3 100644 --- a/Modules/Registration/RegistrationMethodsv4/include/itkTimeVaryingVelocityFieldImageRegistrationMethodv4.hxx +++ b/Modules/Registration/RegistrationMethodsv4/include/itkTimeVaryingVelocityFieldImageRegistrationMethodv4.hxx @@ -145,7 +145,7 @@ TimeVaryingVelocityFieldImageRegistrationMethodv4m_CurrentMetricValue = NumericTraits::ZeroValue(); + this->m_CurrentMetricValue = MeasureType{}; // Time index zero brings the moving image closest to the fixed image for (IndexValueType timePoint = 0; timePoint < numberOfTimePoints; ++timePoint) @@ -264,7 +264,7 @@ TimeVaryingVelocityFieldImageRegistrationMethodv4m_Metric->Initialize(); - metricDerivative.Fill(NumericTraits::ZeroValue()); + metricDerivative.Fill(typename MetricDerivativeType::ValueType{}); this->m_Metric->GetValueAndDerivative(value, metricDerivative); // Ensure that the size of the optimizer weights is the same as the diff --git a/Modules/Segmentation/ConnectedComponents/include/itkConnectedComponentFunctorImageFilter.hxx b/Modules/Segmentation/ConnectedComponents/include/itkConnectedComponentFunctorImageFilter.hxx index 5542f7c964c..6927b0122ab 100644 --- a/Modules/Segmentation/ConnectedComponents/include/itkConnectedComponentFunctorImageFilter.hxx +++ b/Modules/Segmentation/ConnectedComponents/include/itkConnectedComponentFunctorImageFilter.hxx @@ -47,7 +47,7 @@ ConnectedComponentFunctorImageFilter BC; - BC.SetConstant(NumericTraits::ZeroValue()); + BC.SetConstant(OutputPixelType{}); // Neighborhood iterators. Let's use a shaped neighborhood so we can // restrict the access to face connected neighbors. These iterators @@ -117,10 +117,10 @@ ConnectedComponentFunctorImageFilter::ZeroValue()) + if (mit.Get() == MaskPixelType{}) { // mark pixel as unlabeled - oit.Set(NumericTraits::ZeroValue()); + oit.Set(OutputPixelType{}); } ++mit; @@ -144,7 +144,7 @@ ConnectedComponentFunctorImageFilter::ZeroValue()) + if (label != OutputPixelType{}) { // loop over the "previous" neighbors to find labels. this loop // may establish one or more new equivalence classes @@ -158,7 +158,7 @@ ConnectedComponentFunctorImageFilter::ZeroValue()) + if (neighborLabel != OutputPixelType{}) { // see if current pixel is connected to its neighbor neighborValue = isIt.Get(); @@ -225,7 +225,7 @@ ConnectedComponentFunctorImageFilter::ZeroValue()) + if (label != OutputPixelType{}) { oit.Set(eqTable->Lookup(label)); } diff --git a/Modules/Segmentation/ConnectedComponents/include/itkHardConnectedComponentImageFilter.hxx b/Modules/Segmentation/ConnectedComponents/include/itkHardConnectedComponentImageFilter.hxx index ea980d97ac1..a925554321c 100644 --- a/Modules/Segmentation/ConnectedComponents/include/itkHardConnectedComponentImageFilter.hxx +++ b/Modules/Segmentation/ConnectedComponents/include/itkHardConnectedComponentImageFilter.hxx @@ -60,14 +60,13 @@ HardConnectedComponentImageFilter::GenerateData() ot.GoToBegin(); for (; !it.IsAtEnd(); ++it, ++ot) { - if (Math::NotExactlyEquals(it.Get(), - NumericTraits::PixelType>::ZeroValue())) + if (Math::NotExactlyEquals(it.Get(), typename ImageRegionConstIterator::PixelType{})) { ot.Set(NumericTraits::max()); } else { - ot.Set(NumericTraits::ZeroValue()); + ot.Set(typename TOutputImage::PixelType{}); } } equivalenceTable[0] = 0; diff --git a/Modules/Segmentation/ConnectedComponents/include/itkRelabelComponentImageFilter.hxx b/Modules/Segmentation/ConnectedComponents/include/itkRelabelComponentImageFilter.hxx index c7888856d92..42c7521724f 100644 --- a/Modules/Segmentation/ConnectedComponents/include/itkRelabelComponentImageFilter.hxx +++ b/Modules/Segmentation/ConnectedComponents/include/itkRelabelComponentImageFilter.hxx @@ -76,7 +76,7 @@ RelabelComponentImageFilter::ParallelComputeLabels(co const auto inputValue = it.Get(); // if the input pixel is not the background - if (inputValue != NumericTraits::ZeroValue()) + if (inputValue != LabelType{}) { // label is not currently in the map mapIt = localSizeMap.insert(mapIt, { inputValue, initialSize }); @@ -182,7 +182,7 @@ RelabelComponentImageFilter::GenerateData() { // map small objects to the background ++NumberOfObjectsRemoved; - relabelMap.insert({ sizeVectorPair.first, NumericTraits::ZeroValue() }); + relabelMap.insert({ sizeVectorPair.first, OutputPixelType{} }); } else { @@ -217,7 +217,7 @@ RelabelComponentImageFilter::GenerateData() // After the objects stats are computed add in the background label so the relabelMap can be directly applied. - relabelMap.insert({ NumericTraits::ZeroValue(), NumericTraits::ZeroValue() }); + relabelMap.insert({ LabelType{}, OutputPixelType{} }); // Second pass: walk just the output requested region and relabel // the necessary pixels. diff --git a/Modules/Segmentation/ConnectedComponents/include/itkScalarConnectedComponentImageFilter.h b/Modules/Segmentation/ConnectedComponents/include/itkScalarConnectedComponentImageFilter.h index 19839a4c1e7..5c39899a3b5 100644 --- a/Modules/Segmentation/ConnectedComponents/include/itkScalarConnectedComponentImageFilter.h +++ b/Modules/Segmentation/ConnectedComponents/include/itkScalarConnectedComponentImageFilter.h @@ -54,7 +54,7 @@ template class SimilarPixelsFunctor { public: - SimilarPixelsFunctor() { m_Threshold = NumericTraits::ZeroValue(); } + SimilarPixelsFunctor() { m_Threshold = TInput{}; } ~SimilarPixelsFunctor() = default; diff --git a/Modules/Segmentation/ConnectedComponents/include/itkThresholdMaximumConnectedComponentsImageFilter.hxx b/Modules/Segmentation/ConnectedComponents/include/itkThresholdMaximumConnectedComponentsImageFilter.hxx index 400d07abe73..fae1e14d935 100644 --- a/Modules/Segmentation/ConnectedComponents/include/itkThresholdMaximumConnectedComponentsImageFilter.hxx +++ b/Modules/Segmentation/ConnectedComponents/include/itkThresholdMaximumConnectedComponentsImageFilter.hxx @@ -54,7 +54,7 @@ ThresholdMaximumConnectedComponentsImageFilter::ZeroValue(); + m_OutsideValue = OutputPixelType{}; // Default. Use ITK set macro "SetInsideValue" to change m_InsideValue = NumericTraits::max(); diff --git a/Modules/Segmentation/ConnectedComponents/test/itkConnectedComponentImageFilterTest.cxx b/Modules/Segmentation/ConnectedComponents/test/itkConnectedComponentImageFilterTest.cxx index c473e443041..e7de10e5ca8 100644 --- a/Modules/Segmentation/ConnectedComponents/test/itkConnectedComponentImageFilterTest.cxx +++ b/Modules/Segmentation/ConnectedComponents/test/itkConnectedComponentImageFilterTest.cxx @@ -76,7 +76,7 @@ itkConnectedComponentImageFilterTest(int argc, char * argv[]) threshold->SetInput(reader->GetOutput()); threshold->SetInsideValue(itk::NumericTraits::OneValue()); - threshold->SetOutsideValue(itk::NumericTraits::ZeroValue()); + threshold->SetOutsideValue(InternalPixelType{}); threshold->SetLowerThreshold(threshold_low); threshold->SetUpperThreshold(threshold_hi); threshold->Update(); diff --git a/Modules/Segmentation/ConnectedComponents/test/itkConnectedComponentImageFilterTestRGB.cxx b/Modules/Segmentation/ConnectedComponents/test/itkConnectedComponentImageFilterTestRGB.cxx index f643fc5eb1b..eb9fce1611b 100644 --- a/Modules/Segmentation/ConnectedComponents/test/itkConnectedComponentImageFilterTestRGB.cxx +++ b/Modules/Segmentation/ConnectedComponents/test/itkConnectedComponentImageFilterTestRGB.cxx @@ -72,7 +72,7 @@ itkConnectedComponentImageFilterTestRGB(int argc, char * argv[]) threshold->SetInput(reader->GetOutput()); threshold->SetInsideValue(itk::NumericTraits::OneValue()); - threshold->SetOutsideValue(itk::NumericTraits::ZeroValue()); + threshold->SetOutsideValue(RGBPixelType{}); threshold->SetLowerThreshold(threshold_low); threshold->SetUpperThreshold(threshold_hi); threshold->Update(); diff --git a/Modules/Segmentation/ConnectedComponents/test/itkMaskConnectedComponentImageFilterTest.cxx b/Modules/Segmentation/ConnectedComponents/test/itkMaskConnectedComponentImageFilterTest.cxx index ee5e802cfd1..0ebde1a4b2b 100644 --- a/Modules/Segmentation/ConnectedComponents/test/itkMaskConnectedComponentImageFilterTest.cxx +++ b/Modules/Segmentation/ConnectedComponents/test/itkMaskConnectedComponentImageFilterTest.cxx @@ -74,7 +74,7 @@ itkMaskConnectedComponentImageFilterTest(int argc, char * argv[]) threshold->SetInput(reader->GetOutput()); threshold->SetInsideValue(itk::NumericTraits::OneValue()); - threshold->SetOutsideValue(itk::NumericTraits::ZeroValue()); + threshold->SetOutsideValue(InternalPixelType{}); threshold->SetLowerThreshold(threshold_low); threshold->SetUpperThreshold(threshold_hi); threshold->Update(); @@ -85,7 +85,7 @@ itkMaskConnectedComponentImageFilterTest(int argc, char * argv[]) mask->SetRegions(threshold->GetOutput()->GetLargestPossibleRegion()); mask->CopyInformation(threshold->GetOutput()); mask->Allocate(); - mask->FillBuffer(itk::NumericTraits::ZeroValue()); + mask->FillBuffer(MaskPixelType{}); MaskImageType::RegionType maskRegion = mask->GetLargestPossibleRegion(); MaskImageType::SizeType maskSize = maskRegion.GetSize(); diff --git a/Modules/Segmentation/ConnectedComponents/test/itkRelabelComponentImageFilterTest.cxx b/Modules/Segmentation/ConnectedComponents/test/itkRelabelComponentImageFilterTest.cxx index 222710ec4de..d505d7d6d93 100644 --- a/Modules/Segmentation/ConnectedComponents/test/itkRelabelComponentImageFilterTest.cxx +++ b/Modules/Segmentation/ConnectedComponents/test/itkRelabelComponentImageFilterTest.cxx @@ -101,7 +101,7 @@ itkRelabelComponentImageFilterTest(int argc, char * argv[]) threshold->SetInput(change->GetOutput()); threshold->SetInsideValue(itk::NumericTraits::OneValue()); - threshold->SetOutsideValue(itk::NumericTraits::ZeroValue()); + threshold->SetOutsideValue(InternalPixelType{}); threshold->SetLowerThreshold(threshold_low); threshold->SetUpperThreshold(threshold_hi); threshold->Update(); @@ -132,7 +132,7 @@ itkRelabelComponentImageFilterTest(int argc, char * argv[]) finalThreshold->SetLowerThreshold(1); // object #1 finalThreshold->SetUpperThreshold(1); // object #1 finalThreshold->SetInsideValue(255); - finalThreshold->SetOutsideValue(itk::NumericTraits::ZeroValue()); + finalThreshold->SetOutsideValue(WritePixelType{}); try { diff --git a/Modules/Segmentation/ConnectedComponents/test/itkScalarConnectedComponentImageFilterTest.cxx b/Modules/Segmentation/ConnectedComponents/test/itkScalarConnectedComponentImageFilterTest.cxx index 96f30c323eb..debf7143c13 100644 --- a/Modules/Segmentation/ConnectedComponents/test/itkScalarConnectedComponentImageFilterTest.cxx +++ b/Modules/Segmentation/ConnectedComponents/test/itkScalarConnectedComponentImageFilterTest.cxx @@ -71,7 +71,7 @@ itkScalarConnectedComponentImageFilterTest(int argc, char * argv[]) mask->SetRegions(reader->GetOutput()->GetLargestPossibleRegion()); mask->CopyInformation(reader->GetOutput()); mask->Allocate(); - mask->FillBuffer(itk::NumericTraits::ZeroValue()); + mask->FillBuffer(MaskPixelType{}); MaskImageType::RegionType maskRegion = mask->GetLargestPossibleRegion(); MaskImageType::SizeType maskSize = maskRegion.GetSize(); diff --git a/Modules/Segmentation/DeformableMesh/include/itkDeformableSimplexMesh3DGradientConstraintForceFilter.hxx b/Modules/Segmentation/DeformableMesh/include/itkDeformableSimplexMesh3DGradientConstraintForceFilter.hxx index 49dc701be0b..49ab5e20627 100644 --- a/Modules/Segmentation/DeformableMesh/include/itkDeformableSimplexMesh3DGradientConstraintForceFilter.hxx +++ b/Modules/Segmentation/DeformableMesh/include/itkDeformableSimplexMesh3DGradientConstraintForceFilter.hxx @@ -248,9 +248,7 @@ DeformableSimplexMesh3DGradientConstraintForceFilter::C vpos[1] = ic[1]; vpos[2] = ic[2]; - if (Math::AlmostEquals( - data->normal[0], - itk::NumericTraits::ValueType>::ZeroValue())) + if (Math::AlmostEquals(data->normal[0], itk::NumericTraits::ValueType{})) { dp[0] = 1e-6; } @@ -259,9 +257,7 @@ DeformableSimplexMesh3DGradientConstraintForceFilter::C dp[0] = data->normal[0]; } - if (Math::AlmostEquals( - data->normal[1], - itk::NumericTraits::ValueType>::ZeroValue())) + if (Math::AlmostEquals(data->normal[1], itk::NumericTraits::ValueType{})) { dp[1] = 1e-6; } @@ -270,9 +266,7 @@ DeformableSimplexMesh3DGradientConstraintForceFilter::C dp[1] = data->normal[1]; } - if (Math::AlmostEquals( - data->normal[2], - itk::NumericTraits::ValueType>::ZeroValue())) + if (Math::AlmostEquals(data->normal[2], itk::NumericTraits::ValueType{})) { dp[2] = 1e-6; } diff --git a/Modules/Segmentation/LabelVoting/include/itkBinaryMedianImageFilter.hxx b/Modules/Segmentation/LabelVoting/include/itkBinaryMedianImageFilter.hxx index aedde546ab3..c85bc28c13e 100644 --- a/Modules/Segmentation/LabelVoting/include/itkBinaryMedianImageFilter.hxx +++ b/Modules/Segmentation/LabelVoting/include/itkBinaryMedianImageFilter.hxx @@ -36,7 +36,7 @@ BinaryMedianImageFilter::BinaryMedianImageFilter() { m_Radius.Fill(1); m_ForegroundValue = NumericTraits::max(); - m_BackgroundValue = NumericTraits::ZeroValue(); + m_BackgroundValue = InputPixelType{}; this->ThreaderUpdateProgressOff(); } diff --git a/Modules/Segmentation/LabelVoting/include/itkMultiLabelSTAPLEImageFilter.h b/Modules/Segmentation/LabelVoting/include/itkMultiLabelSTAPLEImageFilter.h index 4f517165998..7d7d116046c 100644 --- a/Modules/Segmentation/LabelVoting/include/itkMultiLabelSTAPLEImageFilter.h +++ b/Modules/Segmentation/LabelVoting/include/itkMultiLabelSTAPLEImageFilter.h @@ -276,7 +276,7 @@ class ITK_TEMPLATE_EXPORT MultiLabelSTAPLEImageFilter : public ImageToImageFilte protected: MultiLabelSTAPLEImageFilter() - : m_LabelForUndecidedPixels(NumericTraits::ZeroValue()) + : m_LabelForUndecidedPixels(OutputPixelType{}) , m_TerminationUpdateThreshold(1e-5) {} ~MultiLabelSTAPLEImageFilter() override = default; diff --git a/Modules/Segmentation/LabelVoting/include/itkVotingBinaryHoleFillingImageFilter.hxx b/Modules/Segmentation/LabelVoting/include/itkVotingBinaryHoleFillingImageFilter.hxx index 9add1d0738c..247f38abd5e 100644 --- a/Modules/Segmentation/LabelVoting/include/itkVotingBinaryHoleFillingImageFilter.hxx +++ b/Modules/Segmentation/LabelVoting/include/itkVotingBinaryHoleFillingImageFilter.hxx @@ -152,7 +152,7 @@ template void VotingBinaryHoleFillingImageFilter::AfterThreadedGenerateData() { - this->m_NumberOfPixelsChanged = NumericTraits::ZeroValue(); + this->m_NumberOfPixelsChanged = SizeValueType{}; unsigned int numberOfWorkUnits = this->GetNumberOfWorkUnits(); this->m_Count.SetSize(numberOfWorkUnits); diff --git a/Modules/Segmentation/LabelVoting/include/itkVotingBinaryImageFilter.hxx b/Modules/Segmentation/LabelVoting/include/itkVotingBinaryImageFilter.hxx index 392f9b29333..d1cec15c02d 100644 --- a/Modules/Segmentation/LabelVoting/include/itkVotingBinaryImageFilter.hxx +++ b/Modules/Segmentation/LabelVoting/include/itkVotingBinaryImageFilter.hxx @@ -34,7 +34,7 @@ VotingBinaryImageFilter::VotingBinaryImageFilter() { m_Radius.Fill(1); m_ForegroundValue = NumericTraits::max(); - m_BackgroundValue = NumericTraits::ZeroValue(); + m_BackgroundValue = InputPixelType{}; m_BirthThreshold = 1; m_SurvivalThreshold = 1; this->ThreaderUpdateProgressOff(); diff --git a/Modules/Segmentation/LabelVoting/include/itkVotingBinaryIterativeHoleFillingImageFilter.hxx b/Modules/Segmentation/LabelVoting/include/itkVotingBinaryIterativeHoleFillingImageFilter.hxx index 3f0fa88baac..3305f9fda99 100644 --- a/Modules/Segmentation/LabelVoting/include/itkVotingBinaryIterativeHoleFillingImageFilter.hxx +++ b/Modules/Segmentation/LabelVoting/include/itkVotingBinaryIterativeHoleFillingImageFilter.hxx @@ -35,7 +35,7 @@ VotingBinaryIterativeHoleFillingImageFilter::VotingBinaryIterativeH { m_Radius.Fill(1); m_ForegroundValue = NumericTraits::max(); - m_BackgroundValue = NumericTraits::ZeroValue(); + m_BackgroundValue = InputPixelType{}; m_MaximumNumberOfIterations = 10; m_CurrentNumberOfIterations = 0; m_MajorityThreshold = 1; diff --git a/Modules/Segmentation/LevelSets/include/itkCannySegmentationLevelSetFunction.h b/Modules/Segmentation/LevelSets/include/itkCannySegmentationLevelSetFunction.h index 036629fefc9..ac9e5fbabd9 100644 --- a/Modules/Segmentation/LevelSets/include/itkCannySegmentationLevelSetFunction.h +++ b/Modules/Segmentation/LevelSets/include/itkCannySegmentationLevelSetFunction.h @@ -120,7 +120,7 @@ class ITK_TEMPLATE_EXPORT CannySegmentationLevelSetFunction CannySegmentationLevelSetFunction() { m_Variance = 0.0; - m_Threshold = NumericTraits::ZeroValue(); + m_Threshold = ScalarValueType{}; m_Caster = CastImageFilter::New(); m_Canny = CannyEdgeDetectionImageFilter::New(); m_Distance = DanielssonDistanceMapImageFilter::New(); diff --git a/Modules/Segmentation/LevelSets/include/itkCollidingFrontsImageFilter.hxx b/Modules/Segmentation/LevelSets/include/itkCollidingFrontsImageFilter.hxx index 56430ffd339..f267d4328a6 100644 --- a/Modules/Segmentation/LevelSets/include/itkCollidingFrontsImageFilter.hxx +++ b/Modules/Segmentation/LevelSets/include/itkCollidingFrontsImageFilter.hxx @@ -107,7 +107,7 @@ CollidingFrontsImageFilter::GenerateData() OutputImageRegionType region = outputImage->GetRequestedRegion(); outputImage->SetBufferedRegion(region); outputImage->Allocate(); - outputImage->FillBuffer(NumericTraits::ZeroValue()); + outputImage->FillBuffer(OutputPixelType{}); using FunctionType = BinaryThresholdImageFunction; using IteratorType = FloodFilledImageFunctionConditionalConstIterator; diff --git a/Modules/Segmentation/LevelSets/include/itkImplicitManifoldNormalVectorFilter.hxx b/Modules/Segmentation/LevelSets/include/itkImplicitManifoldNormalVectorFilter.hxx index 81cf7bf6942..71b4af596f1 100644 --- a/Modules/Segmentation/LevelSets/include/itkImplicitManifoldNormalVectorFilter.hxx +++ b/Modules/Segmentation/LevelSets/include/itkImplicitManifoldNormalVectorFilter.hxx @@ -29,12 +29,12 @@ ImplicitManifoldNormalVectorFilter::ImplicitMan m_NormalFunction = nullptr; // set defaults for parameters - m_IsoLevelLow = NumericTraits::ZeroValue(); - m_IsoLevelHigh = NumericTraits::ZeroValue(); + m_IsoLevelLow = NodeValueType{}; + m_IsoLevelHigh = NodeValueType{}; m_MaxIteration = 25; m_MinVectorNorm = static_cast(1.0e-6); m_UnsharpMaskingFlag = false; - m_UnsharpMaskingWeight = NumericTraits::ZeroValue(); + m_UnsharpMaskingWeight = NodeValueType{}; // compute constants used in computations unsigned int j; @@ -134,7 +134,7 @@ ImplicitManifoldNormalVectorFilter::InitializeN // Normal vector computation -- use positive quadrant of neighborhood for (j = 0; j < ImageDimension; ++j) // derivative axis { - normalvector[j] = NumericTraits::ZeroValue(); + normalvector[j] = NodeValueType{}; for (counter = 0; counter < m_NumVertex; ++counter) { position = center; @@ -163,7 +163,7 @@ ImplicitManifoldNormalVectorFilter::InitializeN { for (j = 0; j < ImageDimension; ++j) // derivative axis { - derivative = NumericTraits::ZeroValue(); + derivative = NodeValueType{}; if (i != j) { for (counter = 0; counter < m_NumVertex; ++counter) diff --git a/Modules/Segmentation/LevelSets/include/itkLaplacianSegmentationLevelSetFunction.h b/Modules/Segmentation/LevelSets/include/itkLaplacianSegmentationLevelSetFunction.h index 8cfd7d2f47a..4120e79e86c 100644 --- a/Modules/Segmentation/LevelSets/include/itkLaplacianSegmentationLevelSetFunction.h +++ b/Modules/Segmentation/LevelSets/include/itkLaplacianSegmentationLevelSetFunction.h @@ -67,7 +67,7 @@ class ITK_TEMPLATE_EXPORT LaplacianSegmentationLevelSetFunction { Superclass::Initialize(r); - this->SetAdvectionWeight(NumericTraits::ZeroValue()); + this->SetAdvectionWeight(ScalarValueType{}); this->SetPropagationWeight(-1.0 * NumericTraits::OneValue()); this->SetCurvatureWeight(NumericTraits::OneValue()); } @@ -81,7 +81,7 @@ class ITK_TEMPLATE_EXPORT LaplacianSegmentationLevelSetFunction void SetAdvectionWeight(const ScalarValueType value) override { - if (Math::ExactlyEquals(value, NumericTraits::ZeroValue())) + if (Math::ExactlyEquals(value, ScalarValueType{})) { Superclass::SetAdvectionWeight(value); } diff --git a/Modules/Segmentation/LevelSets/include/itkLevelSetFunction.h b/Modules/Segmentation/LevelSets/include/itkLevelSetFunction.h index 87bb7eb33c0..199e8601e21 100644 --- a/Modules/Segmentation/LevelSets/include/itkLevelSetFunction.h +++ b/Modules/Segmentation/LevelSets/include/itkLevelSetFunction.h @@ -133,7 +133,7 @@ class ITK_TEMPLATE_EXPORT LevelSetFunction : public FiniteDifferenceFunction::ZeroValue(); + return ScalarValueType{}; } /** Curvature speed. Can be used to spatially modify the effects of @@ -239,9 +239,9 @@ class ITK_TEMPLATE_EXPORT LevelSetFunction : public FiniteDifferenceFunctionm_MaxAdvectionChange = NumericTraits::ZeroValue(); - ans->m_MaxPropagationChange = NumericTraits::ZeroValue(); - ans->m_MaxCurvatureChange = NumericTraits::ZeroValue(); + ans->m_MaxAdvectionChange = ScalarValueType{}; + ans->m_MaxPropagationChange = ScalarValueType{}; + ans->m_MaxCurvatureChange = ScalarValueType{}; return ans; } @@ -334,10 +334,10 @@ class ITK_TEMPLATE_EXPORT LevelSetFunction : public FiniteDifferenceFunction(1.0e-5)) - , m_AdvectionWeight(NumericTraits::ZeroValue()) - , m_PropagationWeight(NumericTraits::ZeroValue()) - , m_CurvatureWeight(NumericTraits::ZeroValue()) - , m_LaplacianSmoothingWeight(NumericTraits::ZeroValue()) + , m_AdvectionWeight(ScalarValueType{}) + , m_PropagationWeight(ScalarValueType{}) + , m_CurvatureWeight(ScalarValueType{}) + , m_LaplacianSmoothingWeight(ScalarValueType{}) {} ~LevelSetFunction() override = default; diff --git a/Modules/Segmentation/LevelSets/include/itkLevelSetFunction.hxx b/Modules/Segmentation/LevelSets/include/itkLevelSetFunction.hxx index fa5e83ececa..62655709150 100644 --- a/Modules/Segmentation/LevelSets/include/itkLevelSetFunction.hxx +++ b/Modules/Segmentation/LevelSets/include/itkLevelSetFunction.hxx @@ -180,7 +180,7 @@ LevelSetFunction::InitializeZeroVectorConstant() -> VectorType for (unsigned int i = 0; i < ImageDimension; ++i) { - ans[i] = NumericTraits::ZeroValue(); + ans[i] = ScalarValueType{}; } return ans; @@ -252,9 +252,9 @@ LevelSetFunction::ComputeGlobalTimeStep(void * GlobalData) const -> dt /= maxScaleCoefficient; // reset the values - d->m_MaxAdvectionChange = NumericTraits::ZeroValue(); - d->m_MaxPropagationChange = NumericTraits::ZeroValue(); - d->m_MaxCurvatureChange = NumericTraits::ZeroValue(); + d->m_MaxAdvectionChange = ScalarValueType{}; + d->m_MaxPropagationChange = ScalarValueType{}; + d->m_MaxCurvatureChange = ScalarValueType{}; return dt; } diff --git a/Modules/Segmentation/LevelSets/include/itkLevelSetFunctionWithRefitTerm.h b/Modules/Segmentation/LevelSets/include/itkLevelSetFunctionWithRefitTerm.h index 2fe1dcfbd96..1b5f04daa61 100644 --- a/Modules/Segmentation/LevelSets/include/itkLevelSetFunctionWithRefitTerm.h +++ b/Modules/Segmentation/LevelSets/include/itkLevelSetFunctionWithRefitTerm.h @@ -155,7 +155,7 @@ class ITK_TEMPLATE_EXPORT LevelSetFunctionWithRefitTerm : public LevelSetFunctio virtual ScalarValueType OtherPropagationSpeed(const NeighborhoodType &, const FloatOffsetType &, GlobalDataStruct * = 0) const { - return NumericTraits::ZeroValue(); + return ScalarValueType{}; } private: diff --git a/Modules/Segmentation/LevelSets/include/itkLevelSetFunctionWithRefitTerm.hxx b/Modules/Segmentation/LevelSets/include/itkLevelSetFunctionWithRefitTerm.hxx index 5ec9d56a630..81c56411527 100644 --- a/Modules/Segmentation/LevelSets/include/itkLevelSetFunctionWithRefitTerm.hxx +++ b/Modules/Segmentation/LevelSets/include/itkLevelSetFunctionWithRefitTerm.hxx @@ -38,7 +38,7 @@ LevelSetFunctionWithRefitTerm::LevelSetFunctionWit this->SetPropagationWeight(NumericTraits::OneValue()); m_RefitWeight = NumericTraits::OneValue(); - m_OtherPropagationWeight = NumericTraits::ZeroValue(); + m_OtherPropagationWeight = ScalarValueType{}; m_MinVectorNorm = static_cast(1.0e-6); } @@ -89,7 +89,7 @@ LevelSetFunctionWithRefitTerm::ComputeCurvature( stride[j] = neighborhood.GetStride(j); indicator[j] = one << j; } - curvature = NumericTraits::ZeroValue(); + curvature = ScalarValueType{}; for (counterN = 0; counterN < m_NumVertex; ++counterN) { @@ -105,7 +105,7 @@ LevelSetFunctionWithRefitTerm::ComputeCurvature( // compute the normal vector for (j = 0; j < TImageType::ImageDimension; ++j) // derivative axis { - normalvector[j] = NumericTraits::ZeroValue(); + normalvector[j] = ScalarValueType{}; for (counterP = 0; counterP < m_NumVertex; ++counterP) { positionP = positionN; diff --git a/Modules/Segmentation/LevelSets/include/itkNormalVectorDiffusionFunction.hxx b/Modules/Segmentation/LevelSets/include/itkNormalVectorDiffusionFunction.hxx index 38661d0c89c..5319473d0a6 100644 --- a/Modules/Segmentation/LevelSets/include/itkNormalVectorDiffusionFunction.hxx +++ b/Modules/Segmentation/LevelSets/include/itkNormalVectorDiffusionFunction.hxx @@ -36,8 +36,8 @@ NormalVectorDiffusionFunction::NormalVectorDiffusionFunction() this->SetRadius(r); this->SetTimeStep(static_cast(0.5 / ImageDimension)); m_NormalProcessType = 0; - m_ConductanceParameter = NumericTraits::ZeroValue(); - m_FluxStopConstant = NumericTraits::ZeroValue(); + m_ConductanceParameter = NodeValueType{}; + m_FluxStopConstant = NodeValueType{}; } template @@ -84,7 +84,7 @@ NormalVectorDiffusionFunction::PrecomputeSparseUpdate(Neighbor { for (j = 0; j < ImageDimension; ++j) { - CenterNode->m_Flux[i][j] = NumericTraits::ZeroValue(); + CenterNode->m_Flux[i][j] = NodeValueType{}; } } else @@ -147,7 +147,7 @@ NormalVectorDiffusionFunction::PrecomputeSparseUpdate(Neighbor // now compute the intrinsic derivative for (j = 0; j < ImageDimension; ++j) // component axis { - DotProduct = NumericTraits::ZeroValue(); + DotProduct = NodeValueType{}; for (k = 0; k < ImageDimension; ++k) // derivative axis { DotProduct += (gradient[k][j] * CenterNode->m_ManifoldNormal[i][k]); @@ -185,7 +185,7 @@ NormalVectorDiffusionFunction::ComputeSparseUpdate(Neighborhoo const NeighborhoodScalesType neighborhoodScales = this->ComputeNeighborhoodScales(); - change = NumericTraits::ZeroValue(); + change = NormalVectorType{}; for (i = 0; i < ImageDimension; ++i) // flux offset axis { NextNode = it.GetNext(i); diff --git a/Modules/Segmentation/LevelSets/include/itkParallelSparseFieldLevelSetImageFilter.h b/Modules/Segmentation/LevelSets/include/itkParallelSparseFieldLevelSetImageFilter.h index 3cfa63a850e..7dcdbf3cd99 100644 --- a/Modules/Segmentation/LevelSets/include/itkParallelSparseFieldLevelSetImageFilter.h +++ b/Modules/Segmentation/LevelSets/include/itkParallelSparseFieldLevelSetImageFilter.h @@ -573,7 +573,7 @@ class ITK_TEMPLATE_EXPORT ParallelSparseFieldLevelSetImageFilter TimeStepType CalculateChange() override { - return NumericTraits::ZeroValue(); + return TimeStepType{}; } /** This method does the actual work of calculating change over a region diff --git a/Modules/Segmentation/LevelSets/include/itkParallelSparseFieldLevelSetImageFilter.hxx b/Modules/Segmentation/LevelSets/include/itkParallelSparseFieldLevelSetImageFilter.hxx index 8557a57870b..942aad3592b 100644 --- a/Modules/Segmentation/LevelSets/include/itkParallelSparseFieldLevelSetImageFilter.hxx +++ b/Modules/Segmentation/LevelSets/include/itkParallelSparseFieldLevelSetImageFilter.hxx @@ -100,7 +100,7 @@ typename ParallelSparseFieldLevelSetImageFilter::Valu template typename ParallelSparseFieldLevelSetImageFilter::ValueType ParallelSparseFieldLevelSetImageFilter::m_ValueZero = - NumericTraits::ValueType>::ZeroValue(); + typename ParallelSparseFieldLevelSetImageFilter::ValueType{}; template typename ParallelSparseFieldLevelSetImageFilter::StatusType @@ -1067,7 +1067,7 @@ template void ParallelSparseFieldLevelSetImageFilter::Iterate() { - m_TimeStep = NumericTraits::ZeroValue(); + m_TimeStep = TimeStepType{}; MultiThreaderBase * mt = this->GetMultiThreader(); mt->SetNumberOfWorkUnits(m_NumOfWorkUnits); @@ -1300,7 +1300,7 @@ ParallelSparseFieldLevelSetImageFilter::ThreadedCalcu // neighborhood. This is used by some level set functions in sampling a // speed, advection, or curvature term. if (this->m_InterpolateSurfaceLocation && - Math::NotExactlyEquals((centerValue = outputIt.GetCenterPixel()), NumericTraits::ZeroValue())) + Math::NotExactlyEquals((centerValue = outputIt.GetCenterPixel()), ValueType{})) { // Surface is at the zero crossing, so distance to surface is: // phi(x) / norm(grad(phi)), where phi(x) is the center of the diff --git a/Modules/Segmentation/LevelSets/include/itkSegmentationLevelSetImageFilter.hxx b/Modules/Segmentation/LevelSets/include/itkSegmentationLevelSetImageFilter.hxx index 9e9536e5f05..07d2217f17b 100644 --- a/Modules/Segmentation/LevelSets/include/itkSegmentationLevelSetImageFilter.hxx +++ b/Modules/Segmentation/LevelSets/include/itkSegmentationLevelSetImageFilter.hxx @@ -36,7 +36,7 @@ SegmentationLevelSetImageFilter::S this->SetNumberOfLayers(TInputImage::ImageDimension); m_SegmentationFunction = nullptr; m_AutoGenerateSpeedAdvection = true; - this->SetIsoSurfaceValue(NumericTraits::ZeroValue()); + this->SetIsoSurfaceValue(ValueType{}); // Provide some reasonable defaults which will at least prevent infinite // looping. diff --git a/Modules/Segmentation/LevelSets/include/itkShapeDetectionLevelSetFunction.h b/Modules/Segmentation/LevelSets/include/itkShapeDetectionLevelSetFunction.h index 5e949099289..2b97b6d0516 100644 --- a/Modules/Segmentation/LevelSets/include/itkShapeDetectionLevelSetFunction.h +++ b/Modules/Segmentation/LevelSets/include/itkShapeDetectionLevelSetFunction.h @@ -117,7 +117,7 @@ class ITK_TEMPLATE_EXPORT ShapeDetectionLevelSetFunction { Superclass::Initialize(r); - this->SetAdvectionWeight(NumericTraits::ZeroValue()); + this->SetAdvectionWeight(ScalarValueType{}); this->SetPropagationWeight(NumericTraits::OneValue()); this->SetCurvatureWeight(NumericTraits::OneValue()); } @@ -125,7 +125,7 @@ class ITK_TEMPLATE_EXPORT ShapeDetectionLevelSetFunction protected: ShapeDetectionLevelSetFunction() { - this->SetAdvectionWeight(NumericTraits::ZeroValue()); + this->SetAdvectionWeight(ScalarValueType{}); this->SetPropagationWeight(NumericTraits::OneValue()); this->SetCurvatureWeight(NumericTraits::OneValue()); } diff --git a/Modules/Segmentation/LevelSets/include/itkShapePriorSegmentationLevelSetFunction.h b/Modules/Segmentation/LevelSets/include/itkShapePriorSegmentationLevelSetFunction.h index 522cd625d1d..3d0ab07ce2c 100644 --- a/Modules/Segmentation/LevelSets/include/itkShapePriorSegmentationLevelSetFunction.h +++ b/Modules/Segmentation/LevelSets/include/itkShapePriorSegmentationLevelSetFunction.h @@ -139,10 +139,10 @@ class ITK_TEMPLATE_EXPORT ShapePriorSegmentationLevelSetFunction { auto * ans = new ShapePriorGlobalDataStruct(); - ans->m_MaxAdvectionChange = NumericTraits::ZeroValue(); - ans->m_MaxPropagationChange = NumericTraits::ZeroValue(); - ans->m_MaxCurvatureChange = NumericTraits::ZeroValue(); - ans->m_MaxShapePriorChange = NumericTraits::ZeroValue(); + ans->m_MaxAdvectionChange = ScalarValueType{}; + ans->m_MaxPropagationChange = ScalarValueType{}; + ans->m_MaxCurvatureChange = ScalarValueType{}; + ans->m_MaxShapePriorChange = ScalarValueType{}; return ans; } diff --git a/Modules/Segmentation/LevelSets/include/itkShapePriorSegmentationLevelSetFunction.hxx b/Modules/Segmentation/LevelSets/include/itkShapePriorSegmentationLevelSetFunction.hxx index fa621a6a894..ef92ea08ded 100644 --- a/Modules/Segmentation/LevelSets/include/itkShapePriorSegmentationLevelSetFunction.hxx +++ b/Modules/Segmentation/LevelSets/include/itkShapePriorSegmentationLevelSetFunction.hxx @@ -27,7 +27,7 @@ template ShapePriorSegmentationLevelSetFunction::ShapePriorSegmentationLevelSetFunction() { m_ShapeFunction = nullptr; - m_ShapePriorWeight = NumericTraits::ZeroValue(); + m_ShapePriorWeight = ScalarValueType{}; } template @@ -54,7 +54,7 @@ ShapePriorSegmentationLevelSetFunction::ComputeUp PixelType value = this->Superclass::ComputeUpdate(neighborhood, gd, offset); // Add the shape prior term - if (m_ShapeFunction && Math::NotExactlyEquals(m_ShapePriorWeight, NumericTraits::ZeroValue())) + if (m_ShapeFunction && Math::NotExactlyEquals(m_ShapePriorWeight, ScalarValueType{})) { IndexType idx = neighborhood.GetIndex(); ContinuousIndex cdx; diff --git a/Modules/Segmentation/LevelSets/include/itkSparseFieldFourthOrderLevelSetImageFilter.hxx b/Modules/Segmentation/LevelSets/include/itkSparseFieldFourthOrderLevelSetImageFilter.hxx index 80a7ea47ab8..f925edba887 100644 --- a/Modules/Segmentation/LevelSets/include/itkSparseFieldFourthOrderLevelSetImageFilter.hxx +++ b/Modules/Segmentation/LevelSets/include/itkSparseFieldFourthOrderLevelSetImageFilter.hxx @@ -43,12 +43,12 @@ SparseFieldFourthOrderLevelSetImageFilter::SparseFiel this->SetIsoSurfaceValue(0); m_MaxRefitIteration = 100; m_MaxNormalIteration = 25; - m_RMSChangeNormalProcessTrigger = NumericTraits::ZeroValue(); + m_RMSChangeNormalProcessTrigger = ValueType{}; m_CurvatureBandWidth = static_cast(ImageDimension) + 0.5; m_NormalProcessType = 0; - m_NormalProcessConductance = NumericTraits::ZeroValue(); + m_NormalProcessConductance = ValueType{}; m_NormalProcessUnsharpFlag = false; - m_NormalProcessUnsharpWeight = NumericTraits::ZeroValue(); + m_NormalProcessUnsharpWeight = ValueType{}; } template @@ -100,7 +100,7 @@ SparseFieldFourthOrderLevelSetImageFilter::ComputeCur indicator[j] = one << j; } - curvature = NumericTraits::ZeroValue(); + curvature = ValueType{}; for (counter = 0; counter < m_NumVertex; ++counter) { @@ -135,7 +135,7 @@ SparseFieldFourthOrderLevelSetImageFilter::ComputeCur if (flag == true) { - curvature = NumericTraits::ZeroValue(); + curvature = ValueType{}; } curvature *= m_DimConst; return curvature; diff --git a/Modules/Segmentation/LevelSets/include/itkSparseFieldLevelSetImageFilter.hxx b/Modules/Segmentation/LevelSets/include/itkSparseFieldLevelSetImageFilter.hxx index 279d3268c02..5b5e681e49b 100644 --- a/Modules/Segmentation/LevelSets/include/itkSparseFieldLevelSetImageFilter.hxx +++ b/Modules/Segmentation/LevelSets/include/itkSparseFieldLevelSetImageFilter.hxx @@ -986,7 +986,7 @@ SparseFieldLevelSetImageFilter::PropagateLayerValues( unsigned int i; ValueType value, value_temp, delta; - value = NumericTraits::ZeroValue(); // warnings + value = ValueType{}; // warnings bool found_neighbor_flag; typename LayerType::Iterator toIt; LayerNodeType * node; diff --git a/Modules/Segmentation/LevelSets/include/itkThresholdSegmentationLevelSetFunction.h b/Modules/Segmentation/LevelSets/include/itkThresholdSegmentationLevelSetFunction.h index 99b63babc9c..d633eddf3d7 100644 --- a/Modules/Segmentation/LevelSets/include/itkThresholdSegmentationLevelSetFunction.h +++ b/Modules/Segmentation/LevelSets/include/itkThresholdSegmentationLevelSetFunction.h @@ -112,7 +112,7 @@ class ITK_TEMPLATE_EXPORT ThresholdSegmentationLevelSetFunction { Superclass::Initialize(r); - this->SetAdvectionWeight(NumericTraits::ZeroValue()); + this->SetAdvectionWeight(ScalarValueType{}); this->SetPropagationWeight(-1.0 * NumericTraits::OneValue()); this->SetCurvatureWeight(NumericTraits::OneValue()); } diff --git a/Modules/Segmentation/LevelSets/include/itkVectorThresholdSegmentationLevelSetFunction.h b/Modules/Segmentation/LevelSets/include/itkVectorThresholdSegmentationLevelSetFunction.h index ed4d3ce5726..2539b23c043 100644 --- a/Modules/Segmentation/LevelSets/include/itkVectorThresholdSegmentationLevelSetFunction.h +++ b/Modules/Segmentation/LevelSets/include/itkVectorThresholdSegmentationLevelSetFunction.h @@ -136,7 +136,7 @@ class ITK_TEMPLATE_EXPORT VectorThresholdSegmentationLevelSetFunction { Superclass::Initialize(r); - this->SetAdvectionWeight(NumericTraits::ZeroValue()); + this->SetAdvectionWeight(ScalarValueType{}); this->SetPropagationWeight(-1.0 * NumericTraits::OneValue()); this->SetCurvatureWeight(NumericTraits::OneValue()); } @@ -147,8 +147,8 @@ class ITK_TEMPLATE_EXPORT VectorThresholdSegmentationLevelSetFunction MeanVectorType mean(NumberOfComponents); CovarianceMatrixType covariance(NumberOfComponents, NumberOfComponents); - mean.Fill(NumericTraits::ZeroValue()); - covariance.Fill(NumericTraits::ZeroValue()); + mean.Fill(typename FeatureScalarType::ValueType{}); + covariance.Fill(typename FeatureScalarType::ValueType{}); m_Mahalanobis = MahalanobisFunctionType::New(); m_Mahalanobis->SetMean(mean); diff --git a/Modules/Segmentation/LevelSetsv4/include/itkBinaryImageToLevelSetImageAdaptor.hxx b/Modules/Segmentation/LevelSetsv4/include/itkBinaryImageToLevelSetImageAdaptor.hxx index 65f8936c2fe..45ca00761e5 100644 --- a/Modules/Segmentation/LevelSetsv4/include/itkBinaryImageToLevelSetImageAdaptor.hxx +++ b/Modules/Segmentation/LevelSetsv4/include/itkBinaryImageToLevelSetImageAdaptor.hxx @@ -97,7 +97,7 @@ BinaryImageToLevelSetImageAdaptor::ZeroValue()) + if (inputIt.Get() != InputImagePixelType{}) { innerPart->AddIndex(inputIt.GetIndex()); internalIt.Set(LevelSetType::MinusThreeLayer()); @@ -374,7 +374,7 @@ BinaryImageToLevelSetImageAdaptor::ZeroValue()) + if (iIt.Get() != InputImagePixelType{}) { innerPart->AddIndex(iIt.GetIndex()); labelIt.Set(LevelSetType::MinusThreeLayer()); @@ -517,7 +517,7 @@ BinaryImageToLevelSetImageAdaptor::ZeroValue()) + if (inputIt.Get() != InputImagePixelType{}) { innerPart->AddIndex(inputIt.GetIndex()); internalIt.Set(LevelSetType::MinusOneLayer()); @@ -576,7 +576,7 @@ BinaryImageToLevelSetImageAdaptor::ZeroValue())); + layer.insert(LayerPairType(idx, LevelSetOutputType{})); this->m_InternalImage->SetPixel(idx, LevelSetType::ZeroLayer()); } @@ -632,7 +632,7 @@ BinaryImageToLevelSetImageAdaptor::ZeroValue()) + if (tempValue != LayerIdType{}) { if (tempValue == LevelSetType::MinusOneLayer()) { diff --git a/Modules/Segmentation/LevelSetsv4/include/itkDiscreteLevelSetImage.hxx b/Modules/Segmentation/LevelSetsv4/include/itkDiscreteLevelSetImage.hxx index f66df2c6b85..81e655f068b 100644 --- a/Modules/Segmentation/LevelSetsv4/include/itkDiscreteLevelSetImage.hxx +++ b/Modules/Segmentation/LevelSetsv4/include/itkDiscreteLevelSetImage.hxx @@ -544,7 +544,7 @@ DiscreteLevelSetImage::EvaluateMeanCurvature(const InputTyp } data.MeanCurvature.m_Computed = true; - data.MeanCurvature.m_Value = NumericTraits::ZeroValue(); + data.MeanCurvature.m_Value = OutputRealType{}; for (unsigned int i = 0; i < Dimension; ++i) { diff --git a/Modules/Segmentation/LevelSetsv4/include/itkLevelSetBase.h b/Modules/Segmentation/LevelSetsv4/include/itkLevelSetBase.h index 9cf54183ab2..ac025e0d191 100644 --- a/Modules/Segmentation/LevelSetsv4/include/itkLevelSetBase.h +++ b/Modules/Segmentation/LevelSetsv4/include/itkLevelSetBase.h @@ -139,14 +139,14 @@ class ITK_TEMPLATE_EXPORT LevelSetBase : public DataObject , ForwardGradient("ForwardGradient") , BackwardGradient("BackwardGradient") { - Value.m_Value = NumericTraits::ZeroValue(); - Gradient.m_Value.Fill(NumericTraits::ZeroValue()); - Hessian.m_Value.Fill(NumericTraits::ZeroValue()); - Laplacian.m_Value = NumericTraits::ZeroValue(); - GradientNorm.m_Value = NumericTraits::ZeroValue(); - MeanCurvature.m_Value = NumericTraits::ZeroValue(); - ForwardGradient.m_Value.Fill(NumericTraits::ZeroValue()); - BackwardGradient.m_Value.Fill(NumericTraits::ZeroValue()); + Value.m_Value = OutputType{}; + Gradient.m_Value.Fill(OutputRealType{}); + Hessian.m_Value.Fill(OutputRealType{}); + Laplacian.m_Value = OutputRealType{}; + GradientNorm.m_Value = OutputRealType{}; + MeanCurvature.m_Value = OutputRealType{}; + ForwardGradient.m_Value.Fill(OutputRealType{}); + BackwardGradient.m_Value.Fill(OutputRealType{}); } LevelSetDataType(const LevelSetDataType & iData) diff --git a/Modules/Segmentation/LevelSetsv4/include/itkLevelSetBase.hxx b/Modules/Segmentation/LevelSetsv4/include/itkLevelSetBase.hxx index 5d6e8167eec..d5357dfc17d 100644 --- a/Modules/Segmentation/LevelSetsv4/include/itkLevelSetBase.hxx +++ b/Modules/Segmentation/LevelSetsv4/include/itkLevelSetBase.hxx @@ -36,7 +36,7 @@ template ::IsInside(const InputType & iP) const { - return (this->Evaluate(iP) <= NumericTraits::ZeroValue()); + return (this->Evaluate(iP) <= OutputType{}); } // ---------------------------------------------------------------------------- @@ -134,7 +134,7 @@ LevelSetBase::EvaluateMeanCurvature(const } ioData.MeanCurvature.m_Computed = true; - ioData.MeanCurvature.m_Value = NumericTraits::ZeroValue(); + ioData.MeanCurvature.m_Value = OutputRealType{}; for (unsigned int i = 0; i < Dimension; ++i) { @@ -186,7 +186,7 @@ void LevelSetBase::SetRequestedRegionToLargestPossibleRegion() { m_RequestedNumberOfRegions = NumericTraits::OneValue(); - m_RequestedRegion = NumericTraits::ZeroValue(); + m_RequestedRegion = RegionType{}; } // ---------------------------------------------------------------------------- diff --git a/Modules/Segmentation/LevelSetsv4/include/itkLevelSetContainer.h b/Modules/Segmentation/LevelSetsv4/include/itkLevelSetContainer.h index 43f0a80fa6e..a18b0a50928 100644 --- a/Modules/Segmentation/LevelSetsv4/include/itkLevelSetContainer.h +++ b/Modules/Segmentation/LevelSetsv4/include/itkLevelSetContainer.h @@ -162,7 +162,7 @@ class LevelSetContainer> image->SetRequestedRegion(otherImage->GetRequestedRegion()); image->SetLargestPossibleRegion(otherImage->GetLargestPossibleRegion()); image->Allocate(); - image->FillBuffer(NumericTraits::ZeroValue()); + image->FillBuffer(OutputPixelType{}); temp_ls->SetImage(image); newContainer[it->first] = temp_ls; diff --git a/Modules/Segmentation/LevelSetsv4/include/itkLevelSetDomainMapImageFilter.hxx b/Modules/Segmentation/LevelSetsv4/include/itkLevelSetDomainMapImageFilter.hxx index e25448c2926..d182404c452 100644 --- a/Modules/Segmentation/LevelSetsv4/include/itkLevelSetDomainMapImageFilter.hxx +++ b/Modules/Segmentation/LevelSetsv4/include/itkLevelSetDomainMapImageFilter.hxx @@ -65,7 +65,7 @@ LevelSetDomainMapImageFilter::ComputeConsistentRegion const OutputImagePixelType segmentPixel = oIt.Get(); const InputImagePixelType nextPixel = iIt.Get(); - if ((nextPixel != firstCornerPixelValue) || (segmentPixel != NumericTraits::ZeroValue())) + if ((nextPixel != firstCornerPixelValue) || (segmentPixel != OutputImagePixelType{})) { const InputImageIndexType & stopIdx = iIt.GetIndex(); InputImageSizeType sizeOfRegion; @@ -102,7 +102,7 @@ LevelSetDomainMapImageFilter::GenerateData() this->m_OutputImage = this->GetOutput(); this->m_OutputImage->SetBufferedRegion(region); this->m_OutputImage->Allocate(); - this->m_OutputImage->FillBuffer(NumericTraits::ZeroValue()); + this->m_OutputImage->FillBuffer(OutputImagePixelType{}); InputImageIndexType end; @@ -128,7 +128,7 @@ LevelSetDomainMapImageFilter::GenerateData() // outputPixel is null when it has not been processed yet, // or there is nothing to be processed - if ((!inputPixel.empty()) && (outputPixel == NumericTraits::ZeroValue())) + if ((!inputPixel.empty()) && (outputPixel == OutputImagePixelType{})) { InputImageRegionType subRegion; InputImageSizeType sizeOfRegion; @@ -144,7 +144,7 @@ LevelSetDomainMapImageFilter::GenerateData() // Check if the input list pixels are different, or // the output image already has been assigned to another region - if ((nextPixel != inputPixel) || (currentOutputPixel != NumericTraits::ZeroValue())) + if ((nextPixel != inputPixel) || (currentOutputPixel != OutputImagePixelType{})) { sameOverlappingLevelSetIds = false; } diff --git a/Modules/Segmentation/LevelSetsv4/include/itkLevelSetEquationAdvectionTerm.hxx b/Modules/Segmentation/LevelSetsv4/include/itkLevelSetEquationAdvectionTerm.hxx index a886a1a3db3..ee52ffb7f15 100644 --- a/Modules/Segmentation/LevelSetsv4/include/itkLevelSetEquationAdvectionTerm.hxx +++ b/Modules/Segmentation/LevelSetsv4/include/itkLevelSetEquationAdvectionTerm.hxx @@ -36,7 +36,7 @@ LevelSetEquationAdvectionTerm::LevelSetEquationAdvec this->m_TermName = "Advection term"; this->m_RequiredData.insert("BackwardGradient"); this->m_RequiredData.insert("ForwardGradient"); - this->m_DerivativeSigma = NumericTraits::ZeroValue(); + this->m_DerivativeSigma = LevelSetOutputRealType{}; this->m_AutoGenerateAdvectionImage = true; } @@ -73,7 +73,7 @@ LevelSetEquationAdvectionTerm::GenerateAdvectionImag AdvectionImagePointer gradientImage; - if (Math::NotAlmostEquals(m_DerivativeSigma, NumericTraits::ZeroValue())) + if (Math::NotAlmostEquals(m_DerivativeSigma, LevelSetOutputRealType{})) { using DerivativeFilterType = GradientRecursiveGaussianImageFilter; @@ -159,7 +159,7 @@ LevelSetEquationAdvectionTerm::Value(const LevelSetI { LevelSetOutputRealType component = advectionField[dim]; - if (component > NumericTraits::ZeroValue()) + if (component > LevelSetOutputRealType{}) { oValue += component * backwardGradient[dim]; } @@ -185,7 +185,7 @@ LevelSetEquationAdvectionTerm::Value(const LevelSetI { LevelSetOutputRealType component = advectionField[dim]; - if (component > NumericTraits::ZeroValue()) + if (component > LevelSetOutputRealType{}) { oValue += component * iData.BackwardGradient.m_Value[dim]; } diff --git a/Modules/Segmentation/LevelSetsv4/include/itkLevelSetEquationBinaryMaskTerm.hxx b/Modules/Segmentation/LevelSetsv4/include/itkLevelSetEquationBinaryMaskTerm.hxx index 2378008680f..5a1d0671933 100644 --- a/Modules/Segmentation/LevelSetsv4/include/itkLevelSetEquationBinaryMaskTerm.hxx +++ b/Modules/Segmentation/LevelSetsv4/include/itkLevelSetEquationBinaryMaskTerm.hxx @@ -66,7 +66,7 @@ LevelSetEquationBinaryMaskTerm::Value(const LevelSet LevelSetOutputRealType value; if (pixel > 0) { - value = NumericTraits::ZeroValue(); + value = LevelSetOutputRealType{}; } else { @@ -85,7 +85,7 @@ LevelSetEquationBinaryMaskTerm::Value(const LevelSet LevelSetOutputRealType value; if (pixel > 0) { - value = NumericTraits::ZeroValue(); + value = LevelSetOutputRealType{}; } else { diff --git a/Modules/Segmentation/LevelSetsv4/include/itkLevelSetEquationChanAndVeseInternalTerm.hxx b/Modules/Segmentation/LevelSetsv4/include/itkLevelSetEquationChanAndVeseInternalTerm.hxx index 8c711e42d1d..73ddfa90124 100644 --- a/Modules/Segmentation/LevelSetsv4/include/itkLevelSetEquationChanAndVeseInternalTerm.hxx +++ b/Modules/Segmentation/LevelSetsv4/include/itkLevelSetEquationChanAndVeseInternalTerm.hxx @@ -25,9 +25,9 @@ namespace itk template LevelSetEquationChanAndVeseInternalTerm::LevelSetEquationChanAndVeseInternalTerm() - : m_Mean(NumericTraits::ZeroValue()) - , m_TotalValue(NumericTraits::ZeroValue()) - , m_TotalH(NumericTraits::ZeroValue()) + : m_Mean(InputPixelRealType{}) + , m_TotalValue(InputPixelRealType{}) + , m_TotalH(LevelSetOutputRealType{}) { this->m_TermName = "Internal Chan And Vese term"; this->m_RequiredData.insert("Value"); @@ -47,7 +47,7 @@ LevelSetEquationChanAndVeseInternalTerm::Update() } else { - this->m_Mean = NumericTraits::ZeroValue(); + this->m_Mean = InputPixelRealType{}; } } @@ -55,8 +55,8 @@ template void LevelSetEquationChanAndVeseInternalTerm::InitializeParameters() { - this->m_TotalValue = NumericTraits::ZeroValue(); - this->m_TotalH = NumericTraits::ZeroValue(); + this->m_TotalValue = InputPixelRealType{}; + this->m_TotalH = LevelSetOutputRealType{}; this->SetUp(); } @@ -136,7 +136,7 @@ LevelSetEquationChanAndVeseInternalTerm::Value(const { itkWarningMacro("m_Heaviside is nullptr"); } - return NumericTraits::ZeroValue(); + return LevelSetOutputPixelType{}; } template @@ -166,7 +166,7 @@ LevelSetEquationChanAndVeseInternalTerm::Value(const { itkWarningMacro("m_Heaviside is nullptr"); } - return NumericTraits::ZeroValue(); + return LevelSetOutputPixelType{}; } template diff --git a/Modules/Segmentation/LevelSetsv4/include/itkLevelSetEquationTermBase.hxx b/Modules/Segmentation/LevelSetsv4/include/itkLevelSetEquationTermBase.hxx index efce5a0e939..9cef4ea0e32 100644 --- a/Modules/Segmentation/LevelSetsv4/include/itkLevelSetEquationTermBase.hxx +++ b/Modules/Segmentation/LevelSetsv4/include/itkLevelSetEquationTermBase.hxx @@ -31,7 +31,7 @@ LevelSetEquationTermBase::LevelSetEquationTermB this->m_CurrentLevelSetId = LevelSetIdentifierType(); this->m_Coefficient = NumericTraits::OneValue(); - this->m_CFLContribution = NumericTraits::ZeroValue(); + this->m_CFLContribution = LevelSetOutputRealType{}; this->m_TermName = ""; } @@ -72,7 +72,7 @@ LevelSetEquationTermBase::Evaluate(const LevelS } else { - return NumericTraits::ZeroValue(); + return LevelSetOutputRealType{}; } } // ---------------------------------------------------------------------------- @@ -90,7 +90,7 @@ LevelSetEquationTermBase::Evaluate(const LevelS } else { - return NumericTraits::ZeroValue(); + return LevelSetOutputRealType{}; } } // ---------------------------------------------------------------------------- @@ -100,7 +100,7 @@ template void LevelSetEquationTermBase::SetUp() { - this->m_CFLContribution = NumericTraits::ZeroValue(); + this->m_CFLContribution = LevelSetOutputRealType{}; if (this->m_CurrentLevelSetPointer.IsNull()) { diff --git a/Modules/Segmentation/LevelSetsv4/include/itkLevelSetEquationTermContainer.hxx b/Modules/Segmentation/LevelSetsv4/include/itkLevelSetEquationTermContainer.hxx index a9d8c85dfd0..926d8a33061 100644 --- a/Modules/Segmentation/LevelSetsv4/include/itkLevelSetEquationTermContainer.hxx +++ b/Modules/Segmentation/LevelSetsv4/include/itkLevelSetEquationTermContainer.hxx @@ -96,7 +96,7 @@ LevelSetEquationTermContainer::AddTerm(const Te } m_Container[iId] = iTerm; - m_TermContribution[iId] = NumericTraits::ZeroValue(); + m_TermContribution[iId] = LevelSetOutputPixelType{}; m_NameContainer[iTerm->GetTermName()] = iTerm; RequiredDataType termRequiredData = iTerm->GetRequiredData(); @@ -155,7 +155,7 @@ LevelSetEquationTermContainer::PushTerm(TermTyp ++id; m_Container[id] = iTerm; - m_TermContribution[id] = NumericTraits::ZeroValue(); + m_TermContribution[id] = LevelSetOutputPixelType{}; m_NameContainer[iTerm->GetTermName()] = iTerm; RequiredDataType termRequiredData = iTerm->GetRequiredData(); @@ -336,7 +336,7 @@ LevelSetEquationTermContainer::Update() while (term_it != term_end) { (term_it->second)->Update(); - (cfl_it->second) = NumericTraits::ZeroValue(); + (cfl_it->second) = LevelSetOutputPixelType{}; ++term_it; ++cfl_it; } @@ -358,7 +358,7 @@ LevelSetEquationTermContainer::ComputeCFLContri { LevelSetOutputRealType cfl = (term_it->second)->GetCFLContribution(); - if (Math::AlmostEquals(cfl, NumericTraits::ZeroValue())) + if (Math::AlmostEquals(cfl, LevelSetOutputRealType{})) { cfl = (cfl_it->second); } diff --git a/Modules/Segmentation/LevelSetsv4/include/itkLevelSetEvolution.hxx b/Modules/Segmentation/LevelSetsv4/include/itkLevelSetEvolution.hxx index 883e99f5d13..e5a580cf48f 100644 --- a/Modules/Segmentation/LevelSetsv4/include/itkLevelSetEvolution.hxx +++ b/Modules/Segmentation/LevelSetsv4/include/itkLevelSetEvolution.hxx @@ -114,7 +114,7 @@ LevelSetEvolution>::ComputeTimeSt // if the time step is not globally set if (!this->m_UserGloballyDefinedTimeStep) { - if ((this->m_Alpha > NumericTraits::ZeroValue()) && + if ((this->m_Alpha > LevelSetOutputRealType{}) && (this->m_Alpha < NumericTraits::OneValue())) { LevelSetOutputRealType contribution = this->m_EquationContainer->ComputeCFLContribution(); @@ -182,9 +182,9 @@ LevelSetEvolution>::ReinitializeT ThresholdFilterPointer thresh = ThresholdFilterType::New(); thresh->SetLowerThreshold(NumericTraits::NonpositiveMin()); - thresh->SetUpperThreshold(NumericTraits::ZeroValue()); + thresh->SetUpperThreshold(LevelSetOutputType{}); thresh->SetInsideValue(NumericTraits::OneValue()); - thresh->SetOutsideValue(NumericTraits::ZeroValue()); + thresh->SetOutsideValue(LevelSetOutputType{}); thresh->SetInput(image); thresh->Update(); @@ -291,7 +291,7 @@ LevelSetEvolutionm_UserGloballyDefinedTimeStep) { - if ((this->m_Alpha > NumericTraits::ZeroValue()) && + if ((this->m_Alpha > LevelSetOutputRealType{}) && (this->m_Alpha < NumericTraits::OneValue())) { LevelSetOutputRealType contribution = this->m_EquationContainer->ComputeCFLContribution(); diff --git a/Modules/Segmentation/LevelSetsv4/include/itkLevelSetEvolutionBase.hxx b/Modules/Segmentation/LevelSetsv4/include/itkLevelSetEvolutionBase.hxx index 8565d1580bc..2b4720238db 100644 --- a/Modules/Segmentation/LevelSetsv4/include/itkLevelSetEvolutionBase.hxx +++ b/Modules/Segmentation/LevelSetsv4/include/itkLevelSetEvolutionBase.hxx @@ -210,7 +210,7 @@ LevelSetEvolutionBase::Evolve() while (!this->m_StoppingCriterion->IsSatisfied()) { - this->m_RMSChangeAccumulator = NumericTraits::ZeroValue(); + this->m_RMSChangeAccumulator = LevelSetOutputRealType{}; // one iteration over all container // update each level set based on the different equations provided diff --git a/Modules/Segmentation/LevelSetsv4/include/itkLevelSetEvolutionStoppingCriterion.hxx b/Modules/Segmentation/LevelSetsv4/include/itkLevelSetEvolutionStoppingCriterion.hxx index 6f5ac49341f..3a5c32df48e 100644 --- a/Modules/Segmentation/LevelSetsv4/include/itkLevelSetEvolutionStoppingCriterion.hxx +++ b/Modules/Segmentation/LevelSetsv4/include/itkLevelSetEvolutionStoppingCriterion.hxx @@ -25,9 +25,9 @@ namespace itk template LevelSetEvolutionStoppingCriterion::LevelSetEvolutionStoppingCriterion() { - this->m_RMSChangeAccumulator = NumericTraits::ZeroValue(); - this->m_NumberOfIterations = NumericTraits::ZeroValue(); - this->m_CurrentIteration = NumericTraits::ZeroValue(); + this->m_RMSChangeAccumulator = OutputRealType{}; + this->m_NumberOfIterations = IterationIdType{}; + this->m_CurrentIteration = IterationIdType{}; } } // namespace itk #endif diff --git a/Modules/Segmentation/LevelSetsv4/include/itkLevelSetImage.hxx b/Modules/Segmentation/LevelSetsv4/include/itkLevelSetImage.hxx index cd91fa3f41d..dfe180050ac 100644 --- a/Modules/Segmentation/LevelSetsv4/include/itkLevelSetImage.hxx +++ b/Modules/Segmentation/LevelSetsv4/include/itkLevelSetImage.hxx @@ -27,7 +27,7 @@ template LevelSetImage::LevelSetImage() { this->m_NeighborhoodScales.Fill(NumericTraits::OneValue()); - this->m_DomainOffset.Fill(NumericTraits::ZeroValue()); + this->m_DomainOffset.Fill(OffsetValueType{}); } } // namespace itk #endif // itkLevelSetImage_hxx diff --git a/Modules/Segmentation/LevelSetsv4/include/itkUpdateMalcolmSparseLevelSet.hxx b/Modules/Segmentation/LevelSetsv4/include/itkUpdateMalcolmSparseLevelSet.hxx index 3a4ca59e6e5..c6222d0e660 100644 --- a/Modules/Segmentation/LevelSetsv4/include/itkUpdateMalcolmSparseLevelSet.hxx +++ b/Modules/Segmentation/LevelSetsv4/include/itkUpdateMalcolmSparseLevelSet.hxx @@ -28,8 +28,8 @@ namespace itk template UpdateMalcolmSparseLevelSet::UpdateMalcolmSparseLevelSet() - : m_CurrentLevelSetId(NumericTraits::ZeroValue()) - , m_RMSChangeAccumulator(NumericTraits::ZeroValue()) + : m_CurrentLevelSetId(IdentifierType{}) + , m_RMSChangeAccumulator(LevelSetOutputRealType{}) { this->m_Offset.Fill(0); @@ -143,11 +143,11 @@ UpdateMalcolmSparseLevelSet::FillUpdateContainer LevelSetOutputType value{}; - if (update > NumericTraits::ZeroValue()) + if (update > LevelSetOutputRealType{}) { value = NumericTraits::OneValue(); } - if (update < NumericTraits::ZeroValue()) + if (update < LevelSetOutputRealType{}) { value = -NumericTraits::OneValue(); } @@ -196,11 +196,11 @@ UpdateMalcolmSparseLevelSet::EvolveWithUnPhasedP const LevelSetOutputType update = upIt->second; - if (update != NumericTraits::ZeroValue()) + if (update != LevelSetOutputType{}) { oldValue = LevelSetType::ZeroLayer(); - if (update > NumericTraits::ZeroValue()) + if (update > LevelSetOutputType{}) { newValue = LevelSetType::PlusOneLayer(); } @@ -289,7 +289,7 @@ UpdateMalcolmSparseLevelSet::EvolveWithPhasedPro LevelSetInputType currentIdx = nodeIt->first; LevelSetInputType inputIndex = currentIdx + this->m_Offset; - if (Math::NotAlmostEquals(update, NumericTraits::ZeroValue())) + if (Math::NotAlmostEquals(update, LevelSetOutputRealType{})) { // only allow positiveUpdate forces if (iContraction) diff --git a/Modules/Segmentation/LevelSetsv4/include/itkUpdateShiSparseLevelSet.hxx b/Modules/Segmentation/LevelSetsv4/include/itkUpdateShiSparseLevelSet.hxx index 257ec0ad09e..3e774117912 100644 --- a/Modules/Segmentation/LevelSetsv4/include/itkUpdateShiSparseLevelSet.hxx +++ b/Modules/Segmentation/LevelSetsv4/include/itkUpdateShiSparseLevelSet.hxx @@ -26,8 +26,8 @@ namespace itk template UpdateShiSparseLevelSet::UpdateShiSparseLevelSet() - : m_CurrentLevelSetId(NumericTraits::ZeroValue()) - , m_RMSChangeAccumulator(NumericTraits::ZeroValue()) + : m_CurrentLevelSetId(IdentifierType{}) + , m_RMSChangeAccumulator(LevelSetOutputRealType{}) { this->m_Offset.Fill(0); this->m_OutputLevelSet = LevelSetType::New(); @@ -95,7 +95,7 @@ UpdateShiSparseLevelSet::Update() for (typename NeighborhoodIteratorType::Iterator i = neighIt.Begin(); !i.IsAtEnd(); ++i) { LevelSetOutputType tempValue = i.Get(); - if (tempValue > NumericTraits::ZeroValue()) + if (tempValue > LevelSetOutputType{}) { toBeDeleted = false; break; @@ -140,7 +140,7 @@ UpdateShiSparseLevelSet::Update() for (typename NeighborhoodIteratorType::Iterator i = neighIt.Begin(); !i.IsAtEnd(); ++i) { LevelSetOutputType tempValue = i.Get(); - if (tempValue < NumericTraits::ZeroValue()) + if (tempValue < LevelSetOutputType{}) { toBeDeleted = false; break; @@ -212,7 +212,7 @@ UpdateShiSparseLevelSet::UpdateLayerPlusOne() // update the level set LevelSetOutputRealType update = termContainer->Evaluate(inputIndex); - if (update < NumericTraits::ZeroValue()) + if (update < LevelSetOutputRealType{}) { if (Con(currentIndex, currentValue, update)) { @@ -310,7 +310,7 @@ UpdateShiSparseLevelSet::UpdateLayerMinusOne() // update for the current level set LevelSetOutputRealType update = termContainer->Evaluate(inputIndex); - if (update > NumericTraits::ZeroValue()) + if (update > LevelSetOutputRealType{}) { if (Con(currentIndex, currentValue, update)) { @@ -404,7 +404,7 @@ UpdateShiSparseLevelSet::Con(const LevelSetInput LevelSetOutputRealType neighborUpdate = termContainer->Evaluate(tempIdx + this->m_Offset); - if (neighborUpdate * currentUpdate > NumericTraits::ZeroValue()) + if (neighborUpdate * currentUpdate > LevelSetOutputType{}) { return true; } diff --git a/Modules/Segmentation/LevelSetsv4/include/itkUpdateWhitakerSparseLevelSet.hxx b/Modules/Segmentation/LevelSetsv4/include/itkUpdateWhitakerSparseLevelSet.hxx index b546b7fc6a6..35ca859d8d2 100644 --- a/Modules/Segmentation/LevelSetsv4/include/itkUpdateWhitakerSparseLevelSet.hxx +++ b/Modules/Segmentation/LevelSetsv4/include/itkUpdateWhitakerSparseLevelSet.hxx @@ -26,8 +26,8 @@ namespace itk template UpdateWhitakerSparseLevelSet::UpdateWhitakerSparseLevelSet() : m_TimeStep(NumericTraits::OneValue()) - , m_RMSChangeAccumulator(NumericTraits::ZeroValue()) - , m_CurrentLevelSetId(NumericTraits::ZeroValue()) + , m_RMSChangeAccumulator(LevelSetOutputType{}) + , m_CurrentLevelSetId(IdentifierType{}) , m_MinStatus(LevelSetType::MinusThreeLayer()) , m_MaxStatus(LevelSetType::PlusThreeLayer()) { diff --git a/Modules/Segmentation/LevelSetsv4/test/itkLevelSetDomainPartitionImageTest.cxx b/Modules/Segmentation/LevelSetsv4/test/itkLevelSetDomainPartitionImageTest.cxx index 4522d0ba0b9..2e302818382 100644 --- a/Modules/Segmentation/LevelSetsv4/test/itkLevelSetDomainPartitionImageTest.cxx +++ b/Modules/Segmentation/LevelSetsv4/test/itkLevelSetDomainPartitionImageTest.cxx @@ -61,7 +61,7 @@ itkLevelSetDomainPartitionImageTest(int, char *[]) binary->SetSpacing(spacing); binary->SetOrigin(origin); binary->Allocate(); - binary->FillBuffer(itk::NumericTraits::ZeroValue()); + binary->FillBuffer(InputPixelType{}); IdentifierType numberOfLevelSetFunctions = 2; diff --git a/Modules/Segmentation/LevelSetsv4/test/itkLevelSetDomainPartitionImageWithKdTreeTest.cxx b/Modules/Segmentation/LevelSetsv4/test/itkLevelSetDomainPartitionImageWithKdTreeTest.cxx index 022c2e8ddcb..7fa2ae6c2ec 100644 --- a/Modules/Segmentation/LevelSetsv4/test/itkLevelSetDomainPartitionImageWithKdTreeTest.cxx +++ b/Modules/Segmentation/LevelSetsv4/test/itkLevelSetDomainPartitionImageWithKdTreeTest.cxx @@ -66,7 +66,7 @@ itkLevelSetDomainPartitionImageWithKdTreeTest(int, char *[]) binary->SetSpacing(spacing); binary->SetOrigin(origin); binary->Allocate(); - binary->FillBuffer(itk::NumericTraits::ZeroValue()); + binary->FillBuffer(InputPixelType{}); IdentifierType numberOfLevelSetFunctions = 10; diff --git a/Modules/Segmentation/LevelSetsv4/test/itkLevelSetEquationBinaryMaskTermTest.cxx b/Modules/Segmentation/LevelSetsv4/test/itkLevelSetEquationBinaryMaskTermTest.cxx index 5c2cfe70d53..b2b6db7be05 100644 --- a/Modules/Segmentation/LevelSetsv4/test/itkLevelSetEquationBinaryMaskTermTest.cxx +++ b/Modules/Segmentation/LevelSetsv4/test/itkLevelSetEquationBinaryMaskTermTest.cxx @@ -78,7 +78,7 @@ itkLevelSetEquationBinaryMaskTermTest(int, char *[]) binary->SetSpacing(spacing); binary->SetOrigin(origin); binary->Allocate(); - binary->FillBuffer(itk::NumericTraits::ZeroValue()); + binary->FillBuffer(InputPixelType{}); index.Fill(10); size.Fill(30); @@ -171,8 +171,7 @@ itkLevelSetEquationBinaryMaskTermTest(int, char *[]) index[1] = 20; std::cout << maskTerm0->Evaluate(index) << std::endl; - if (itk::Math::NotAlmostEquals(maskTerm0->Evaluate(index), - itk::NumericTraits::ZeroValue())) + if (itk::Math::NotAlmostEquals(maskTerm0->Evaluate(index), BinaryMaskTermType::LevelSetOutputRealType{})) { return EXIT_FAILURE; } diff --git a/Modules/Segmentation/LevelSetsv4/test/itkLevelSetEquationChanAndVeseExternalTermTest.cxx b/Modules/Segmentation/LevelSetsv4/test/itkLevelSetEquationChanAndVeseExternalTermTest.cxx index ef7f9b512ed..89eb70b07ce 100644 --- a/Modules/Segmentation/LevelSetsv4/test/itkLevelSetEquationChanAndVeseExternalTermTest.cxx +++ b/Modules/Segmentation/LevelSetsv4/test/itkLevelSetEquationChanAndVeseExternalTermTest.cxx @@ -87,7 +87,7 @@ itkLevelSetEquationChanAndVeseExternalTermTest(int argc, char * argv[]) binary->SetSpacing(spacing); binary->SetOrigin(origin); binary->Allocate(); - binary->FillBuffer(itk::NumericTraits::ZeroValue()); + binary->FillBuffer(InputPixelType{}); index.Fill(10); size.Fill(30); diff --git a/Modules/Segmentation/LevelSetsv4/test/itkLevelSetEquationChanAndVeseInternalTermTest.cxx b/Modules/Segmentation/LevelSetsv4/test/itkLevelSetEquationChanAndVeseInternalTermTest.cxx index 82ced119f79..cb5e33e7d69 100644 --- a/Modules/Segmentation/LevelSetsv4/test/itkLevelSetEquationChanAndVeseInternalTermTest.cxx +++ b/Modules/Segmentation/LevelSetsv4/test/itkLevelSetEquationChanAndVeseInternalTermTest.cxx @@ -90,7 +90,7 @@ itkLevelSetEquationChanAndVeseInternalTermTest(int argc, char * argv[]) binary->SetSpacing(spacing); binary->SetOrigin(origin); binary->Allocate(); - binary->FillBuffer(itk::NumericTraits::ZeroValue()); + binary->FillBuffer(InputPixelType{}); index.Fill(10); size.Fill(30); diff --git a/Modules/Segmentation/LevelSetsv4/test/itkLevelSetEquationCurvatureTermTest.cxx b/Modules/Segmentation/LevelSetsv4/test/itkLevelSetEquationCurvatureTermTest.cxx index ef6817ed652..30dd89239c5 100644 --- a/Modules/Segmentation/LevelSetsv4/test/itkLevelSetEquationCurvatureTermTest.cxx +++ b/Modules/Segmentation/LevelSetsv4/test/itkLevelSetEquationCurvatureTermTest.cxx @@ -85,7 +85,7 @@ itkLevelSetEquationCurvatureTermTest(int argc, char * argv[]) binary->SetSpacing(spacing); binary->SetOrigin(origin); binary->Allocate(); - binary->FillBuffer(itk::NumericTraits::ZeroValue()); + binary->FillBuffer(InputPixelType{}); index.Fill(10); size.Fill(30); diff --git a/Modules/Segmentation/LevelSetsv4/test/itkLevelSetEquationLaplacianTermTest.cxx b/Modules/Segmentation/LevelSetsv4/test/itkLevelSetEquationLaplacianTermTest.cxx index 3ed00e7f912..93fc16acb78 100644 --- a/Modules/Segmentation/LevelSetsv4/test/itkLevelSetEquationLaplacianTermTest.cxx +++ b/Modules/Segmentation/LevelSetsv4/test/itkLevelSetEquationLaplacianTermTest.cxx @@ -84,7 +84,7 @@ itkLevelSetEquationLaplacianTermTest(int argc, char * argv[]) binary->SetSpacing(spacing); binary->SetOrigin(origin); binary->Allocate(); - binary->FillBuffer(itk::NumericTraits::ZeroValue()); + binary->FillBuffer(InputPixelType{}); index.Fill(10); size.Fill(30); diff --git a/Modules/Segmentation/LevelSetsv4/test/itkLevelSetEquationOverlapPenaltyTermTest.cxx b/Modules/Segmentation/LevelSetsv4/test/itkLevelSetEquationOverlapPenaltyTermTest.cxx index d022f0041ff..3d293c383a8 100644 --- a/Modules/Segmentation/LevelSetsv4/test/itkLevelSetEquationOverlapPenaltyTermTest.cxx +++ b/Modules/Segmentation/LevelSetsv4/test/itkLevelSetEquationOverlapPenaltyTermTest.cxx @@ -78,7 +78,7 @@ itkLevelSetEquationOverlapPenaltyTermTest(int, char *[]) binary->SetSpacing(spacing); binary->SetOrigin(origin); binary->Allocate(); - binary->FillBuffer(itk::NumericTraits::ZeroValue()); + binary->FillBuffer(InputPixelType{}); index.Fill(10); size.Fill(30); @@ -198,8 +198,7 @@ itkLevelSetEquationOverlapPenaltyTermTest(int, char *[]) index[1] = 5; std::cout << penaltyTerm0->Evaluate(index) << std::endl; - if (itk::Math::NotAlmostEquals(penaltyTerm0->Evaluate(index), - itk::NumericTraits::ZeroValue())) + if (itk::Math::NotAlmostEquals(penaltyTerm0->Evaluate(index), OverlapPenaltyTermType::LevelSetOutputRealType{})) { return EXIT_FAILURE; } diff --git a/Modules/Segmentation/LevelSetsv4/test/itkLevelSetEquationPropagationTermTest.cxx b/Modules/Segmentation/LevelSetsv4/test/itkLevelSetEquationPropagationTermTest.cxx index 5c00cc1ddf4..34a363b41db 100644 --- a/Modules/Segmentation/LevelSetsv4/test/itkLevelSetEquationPropagationTermTest.cxx +++ b/Modules/Segmentation/LevelSetsv4/test/itkLevelSetEquationPropagationTermTest.cxx @@ -84,7 +84,7 @@ itkLevelSetEquationPropagationTermTest(int argc, char * argv[]) binary->SetSpacing(spacing); binary->SetOrigin(origin); binary->Allocate(); - binary->FillBuffer(itk::NumericTraits::ZeroValue()); + binary->FillBuffer(InputPixelType{}); index.Fill(10); size.Fill(30); diff --git a/Modules/Segmentation/LevelSetsv4/test/itkLevelSetEquationTermContainerTest.cxx b/Modules/Segmentation/LevelSetsv4/test/itkLevelSetEquationTermContainerTest.cxx index c4e1244b7a6..b661bd8de5f 100644 --- a/Modules/Segmentation/LevelSetsv4/test/itkLevelSetEquationTermContainerTest.cxx +++ b/Modules/Segmentation/LevelSetsv4/test/itkLevelSetEquationTermContainerTest.cxx @@ -92,7 +92,7 @@ itkLevelSetEquationTermContainerTest(int argc, char * argv[]) binary->SetSpacing(spacing); binary->SetOrigin(origin); binary->Allocate(); - binary->FillBuffer(itk::NumericTraits::ZeroValue()); + binary->FillBuffer(InputPixelType{}); index.Fill(10); size.Fill(30); diff --git a/Modules/Segmentation/LevelSetsv4/test/itkMultiLevelSetDenseImageSubset2DTest.cxx b/Modules/Segmentation/LevelSetsv4/test/itkMultiLevelSetDenseImageSubset2DTest.cxx index c54bf60734d..e55ea980303 100644 --- a/Modules/Segmentation/LevelSetsv4/test/itkMultiLevelSetDenseImageSubset2DTest.cxx +++ b/Modules/Segmentation/LevelSetsv4/test/itkMultiLevelSetDenseImageSubset2DTest.cxx @@ -91,7 +91,7 @@ itkMultiLevelSetDenseImageSubset2DTest(int, char *[]) input->SetSpacing(spacing); input->SetOrigin(origin); input->Allocate(); - input->FillBuffer(itk::NumericTraits::ZeroValue()); + input->FillBuffer(InputPixelType{}); index.Fill(910); size.Fill(80); @@ -119,7 +119,7 @@ itkMultiLevelSetDenseImageSubset2DTest(int, char *[]) binary->SetSpacing(spacing); binary->SetOrigin(origin); binary->Allocate(); - binary->FillBuffer(itk::NumericTraits::ZeroValue()); + binary->FillBuffer(InputPixelType{}); index.Fill(30); size.Fill(40); diff --git a/Modules/Segmentation/LevelSetsv4/test/itkMultiLevelSetMalcolmImageSubset2DTest.cxx b/Modules/Segmentation/LevelSetsv4/test/itkMultiLevelSetMalcolmImageSubset2DTest.cxx index 9d3643a74d6..66ca02c7d4c 100644 --- a/Modules/Segmentation/LevelSetsv4/test/itkMultiLevelSetMalcolmImageSubset2DTest.cxx +++ b/Modules/Segmentation/LevelSetsv4/test/itkMultiLevelSetMalcolmImageSubset2DTest.cxx @@ -92,7 +92,7 @@ itkMultiLevelSetMalcolmImageSubset2DTest(int, char *[]) input->SetSpacing(spacing); input->SetOrigin(origin); input->Allocate(); - input->FillBuffer(itk::NumericTraits::ZeroValue()); + input->FillBuffer(InputPixelType{}); index.Fill(910); size.Fill(80); @@ -120,7 +120,7 @@ itkMultiLevelSetMalcolmImageSubset2DTest(int, char *[]) binary->SetSpacing(spacing); binary->SetOrigin(origin); binary->Allocate(); - binary->FillBuffer(itk::NumericTraits::ZeroValue()); + binary->FillBuffer(InputPixelType{}); index.Fill(30); size.Fill(40); diff --git a/Modules/Segmentation/LevelSetsv4/test/itkMultiLevelSetShiImageSubset2DTest.cxx b/Modules/Segmentation/LevelSetsv4/test/itkMultiLevelSetShiImageSubset2DTest.cxx index 91927001c6f..9fa6cfa5181 100644 --- a/Modules/Segmentation/LevelSetsv4/test/itkMultiLevelSetShiImageSubset2DTest.cxx +++ b/Modules/Segmentation/LevelSetsv4/test/itkMultiLevelSetShiImageSubset2DTest.cxx @@ -92,7 +92,7 @@ itkMultiLevelSetShiImageSubset2DTest(int, char *[]) input->SetSpacing(spacing); input->SetOrigin(origin); input->Allocate(); - input->FillBuffer(itk::NumericTraits::ZeroValue()); + input->FillBuffer(InputPixelType{}); index.Fill(910); size.Fill(80); @@ -120,7 +120,7 @@ itkMultiLevelSetShiImageSubset2DTest(int, char *[]) binary->SetSpacing(spacing); binary->SetOrigin(origin); binary->Allocate(); - binary->FillBuffer(itk::NumericTraits::ZeroValue()); + binary->FillBuffer(InputPixelType{}); index.Fill(30); size.Fill(40); diff --git a/Modules/Segmentation/LevelSetsv4/test/itkMultiLevelSetWhitakerImageSubset2DTest.cxx b/Modules/Segmentation/LevelSetsv4/test/itkMultiLevelSetWhitakerImageSubset2DTest.cxx index 095d21b1ffa..d5704b9c2f7 100644 --- a/Modules/Segmentation/LevelSetsv4/test/itkMultiLevelSetWhitakerImageSubset2DTest.cxx +++ b/Modules/Segmentation/LevelSetsv4/test/itkMultiLevelSetWhitakerImageSubset2DTest.cxx @@ -92,7 +92,7 @@ itkMultiLevelSetWhitakerImageSubset2DTest(int, char *[]) input->SetSpacing(spacing); input->SetOrigin(origin); input->Allocate(); - input->FillBuffer(itk::NumericTraits::ZeroValue()); + input->FillBuffer(InputPixelType{}); index.Fill(910); size.Fill(80); @@ -120,7 +120,7 @@ itkMultiLevelSetWhitakerImageSubset2DTest(int, char *[]) binary->SetSpacing(spacing); binary->SetOrigin(origin); binary->Allocate(); - binary->FillBuffer(itk::NumericTraits::ZeroValue()); + binary->FillBuffer(InputPixelType{}); index.Fill(30); size.Fill(40); diff --git a/Modules/Segmentation/LevelSetsv4/test/itkSingleLevelSetMalcolmImage2DTest.cxx b/Modules/Segmentation/LevelSetsv4/test/itkSingleLevelSetMalcolmImage2DTest.cxx index ec6b27b3c61..db1a9393c71 100644 --- a/Modules/Segmentation/LevelSetsv4/test/itkSingleLevelSetMalcolmImage2DTest.cxx +++ b/Modules/Segmentation/LevelSetsv4/test/itkSingleLevelSetMalcolmImage2DTest.cxx @@ -79,7 +79,7 @@ itkSingleLevelSetMalcolmImage2DTest(int argc, char * argv[]) binary->SetRegions(input->GetLargestPossibleRegion()); binary->CopyInformation(input); binary->Allocate(); - binary->FillBuffer(itk::NumericTraits::ZeroValue()); + binary->FillBuffer(InputPixelType{}); InputImageType::RegionType region; InputImageType::IndexType index; diff --git a/Modules/Segmentation/LevelSetsv4/test/itkSingleLevelSetShiImage2DTest.cxx b/Modules/Segmentation/LevelSetsv4/test/itkSingleLevelSetShiImage2DTest.cxx index c8ae8770abe..ae0283b1a53 100644 --- a/Modules/Segmentation/LevelSetsv4/test/itkSingleLevelSetShiImage2DTest.cxx +++ b/Modules/Segmentation/LevelSetsv4/test/itkSingleLevelSetShiImage2DTest.cxx @@ -79,7 +79,7 @@ itkSingleLevelSetShiImage2DTest(int argc, char * argv[]) binary->SetRegions(input->GetLargestPossibleRegion()); binary->CopyInformation(input); binary->Allocate(); - binary->FillBuffer(itk::NumericTraits::ZeroValue()); + binary->FillBuffer(InputPixelType{}); InputImageType::RegionType region; InputImageType::IndexType index; diff --git a/Modules/Segmentation/LevelSetsv4/test/itkSingleLevelSetWhitakerImage2DTest.cxx b/Modules/Segmentation/LevelSetsv4/test/itkSingleLevelSetWhitakerImage2DTest.cxx index 19576fda78f..0de2f4f0aa1 100644 --- a/Modules/Segmentation/LevelSetsv4/test/itkSingleLevelSetWhitakerImage2DTest.cxx +++ b/Modules/Segmentation/LevelSetsv4/test/itkSingleLevelSetWhitakerImage2DTest.cxx @@ -81,7 +81,7 @@ itkSingleLevelSetWhitakerImage2DTest(int argc, char * argv[]) binary->SetRegions(input->GetLargestPossibleRegion()); binary->CopyInformation(input); binary->Allocate(); - binary->FillBuffer(itk::NumericTraits::ZeroValue()); + binary->FillBuffer(InputPixelType{}); InputImageType::RegionType region; InputImageType::IndexType index; diff --git a/Modules/Segmentation/LevelSetsv4/test/itkSingleLevelSetWhitakerImage2DWithCurvatureTest.cxx b/Modules/Segmentation/LevelSetsv4/test/itkSingleLevelSetWhitakerImage2DWithCurvatureTest.cxx index b629ecc5c24..81fd4239905 100644 --- a/Modules/Segmentation/LevelSetsv4/test/itkSingleLevelSetWhitakerImage2DWithCurvatureTest.cxx +++ b/Modules/Segmentation/LevelSetsv4/test/itkSingleLevelSetWhitakerImage2DWithCurvatureTest.cxx @@ -81,7 +81,7 @@ itkSingleLevelSetWhitakerImage2DWithCurvatureTest(int argc, char * argv[]) binary->SetRegions(input->GetLargestPossibleRegion()); binary->CopyInformation(input); binary->Allocate(); - binary->FillBuffer(itk::NumericTraits::ZeroValue()); + binary->FillBuffer(InputPixelType{}); InputImageType::RegionType region; InputImageType::IndexType index; diff --git a/Modules/Segmentation/LevelSetsv4/test/itkSingleLevelSetWhitakerImage2DWithLaplacianTest.cxx b/Modules/Segmentation/LevelSetsv4/test/itkSingleLevelSetWhitakerImage2DWithLaplacianTest.cxx index bb1a77e8b4a..b9bf62d4e5f 100644 --- a/Modules/Segmentation/LevelSetsv4/test/itkSingleLevelSetWhitakerImage2DWithLaplacianTest.cxx +++ b/Modules/Segmentation/LevelSetsv4/test/itkSingleLevelSetWhitakerImage2DWithLaplacianTest.cxx @@ -83,7 +83,7 @@ itkSingleLevelSetWhitakerImage2DWithLaplacianTest(int argc, char * argv[]) binary->SetRegions(input->GetLargestPossibleRegion()); binary->CopyInformation(input); binary->Allocate(); - binary->FillBuffer(itk::NumericTraits::ZeroValue()); + binary->FillBuffer(InputPixelType{}); InputImageType::RegionType region; InputImageType::IndexType index; diff --git a/Modules/Segmentation/LevelSetsv4/test/itkSingleLevelSetWhitakerImage2DWithPropagationTest.cxx b/Modules/Segmentation/LevelSetsv4/test/itkSingleLevelSetWhitakerImage2DWithPropagationTest.cxx index 90293220330..422bfde4868 100644 --- a/Modules/Segmentation/LevelSetsv4/test/itkSingleLevelSetWhitakerImage2DWithPropagationTest.cxx +++ b/Modules/Segmentation/LevelSetsv4/test/itkSingleLevelSetWhitakerImage2DWithPropagationTest.cxx @@ -81,7 +81,7 @@ itkSingleLevelSetWhitakerImage2DWithPropagationTest(int argc, char * argv[]) binary->SetRegions(input->GetLargestPossibleRegion()); binary->CopyInformation(input); binary->Allocate(); - binary->FillBuffer(itk::NumericTraits::ZeroValue()); + binary->FillBuffer(InputPixelType{}); InputImageType::RegionType region; InputImageType::IndexType index; diff --git a/Modules/Segmentation/LevelSetsv4/test/itkTwoLevelSetMalcolmImage2DTest.cxx b/Modules/Segmentation/LevelSetsv4/test/itkTwoLevelSetMalcolmImage2DTest.cxx index 34ff9290d62..6f13f40701b 100644 --- a/Modules/Segmentation/LevelSetsv4/test/itkTwoLevelSetMalcolmImage2DTest.cxx +++ b/Modules/Segmentation/LevelSetsv4/test/itkTwoLevelSetMalcolmImage2DTest.cxx @@ -84,7 +84,7 @@ itkTwoLevelSetMalcolmImage2DTest(int argc, char * argv[]) binary->SetRegions(input->GetLargestPossibleRegion()); binary->CopyInformation(input); binary->Allocate(); - binary->FillBuffer(itk::NumericTraits::ZeroValue()); + binary->FillBuffer(InputPixelType{}); InputImageType::RegionType region; InputImageType::IndexType index; diff --git a/Modules/Segmentation/LevelSetsv4/test/itkTwoLevelSetShiImage2DTest.cxx b/Modules/Segmentation/LevelSetsv4/test/itkTwoLevelSetShiImage2DTest.cxx index 1239e8c1889..9deb0069101 100644 --- a/Modules/Segmentation/LevelSetsv4/test/itkTwoLevelSetShiImage2DTest.cxx +++ b/Modules/Segmentation/LevelSetsv4/test/itkTwoLevelSetShiImage2DTest.cxx @@ -84,7 +84,7 @@ itkTwoLevelSetShiImage2DTest(int argc, char * argv[]) binary->SetRegions(input->GetLargestPossibleRegion()); binary->CopyInformation(input); binary->Allocate(); - binary->FillBuffer(itk::NumericTraits::ZeroValue()); + binary->FillBuffer(InputPixelType{}); InputImageType::RegionType region; InputImageType::IndexType index; diff --git a/Modules/Segmentation/LevelSetsv4/test/itkTwoLevelSetWhitakerImage2DTest.cxx b/Modules/Segmentation/LevelSetsv4/test/itkTwoLevelSetWhitakerImage2DTest.cxx index cf5b83b570e..3b21a88c15b 100644 --- a/Modules/Segmentation/LevelSetsv4/test/itkTwoLevelSetWhitakerImage2DTest.cxx +++ b/Modules/Segmentation/LevelSetsv4/test/itkTwoLevelSetWhitakerImage2DTest.cxx @@ -86,7 +86,7 @@ itkTwoLevelSetWhitakerImage2DTest(int argc, char * argv[]) binary->SetRegions(input->GetLargestPossibleRegion()); binary->CopyInformation(input); binary->Allocate(); - binary->FillBuffer(itk::NumericTraits::ZeroValue()); + binary->FillBuffer(InputPixelType{}); InputImageType::RegionType region; InputImageType::IndexType index; diff --git a/Modules/Segmentation/MarkovRandomFieldsClassifiers/include/itkRGBGibbsPriorFilter.hxx b/Modules/Segmentation/MarkovRandomFieldsClassifiers/include/itkRGBGibbsPriorFilter.hxx index 0ee5c83f64f..21cc8737497 100644 --- a/Modules/Segmentation/MarkovRandomFieldsClassifiers/include/itkRGBGibbsPriorFilter.hxx +++ b/Modules/Segmentation/MarkovRandomFieldsClassifiers/include/itkRGBGibbsPriorFilter.hxx @@ -530,7 +530,7 @@ RGBGibbsPriorFilter::ApplyGibbsLabeller() // Variable to store the modified pixel vector value. InputImagePixelType changedPixelVec; - changedPixelVec.Fill(NumericTraits::ZeroValue()); + changedPixelVec.Fill(typename InputImagePixelType::ValueType{}); // Set a variable to store the offset index. LabelledImageIndexType offsetIndex3D; diff --git a/Modules/Segmentation/RegionGrowing/include/itkConfidenceConnectedImageFilter.hxx b/Modules/Segmentation/RegionGrowing/include/itkConfidenceConnectedImageFilter.hxx index 73a9baf6d56..4a3368b3791 100644 --- a/Modules/Segmentation/RegionGrowing/include/itkConfidenceConnectedImageFilter.hxx +++ b/Modules/Segmentation/RegionGrowing/include/itkConfidenceConnectedImageFilter.hxx @@ -39,8 +39,8 @@ ConfidenceConnectedImageFilter::ConfidenceConnectedIm m_Seeds.clear(); m_InitialNeighborhoodRadius = 1; m_ReplaceValue = NumericTraits::OneValue(); - m_Mean = NumericTraits::ZeroValue(); - m_Variance = NumericTraits::ZeroValue(); + m_Mean = InputRealType{}; + m_Variance = InputRealType{}; } template @@ -137,7 +137,7 @@ ConfidenceConnectedImageFilter::GenerateData() OutputImageRegionType region = outputImage->GetRequestedRegion(); outputImage->SetBufferedRegion(region); outputImage->Allocate(); - outputImage->FillBuffer(NumericTraits::ZeroValue()); + outputImage->FillBuffer(OutputImagePixelType{}); // Compute the statistics of the seed point @@ -148,8 +148,8 @@ ConfidenceConnectedImageFilter::GenerateData() InputRealType lower; InputRealType upper; - m_Mean = itk::NumericTraits::ZeroValue(); - m_Variance = itk::NumericTraits::ZeroValue(); + m_Mean = InputRealType{}; + m_Variance = InputRealType{}; if (m_InitialNeighborhoodRadius > 0) { @@ -312,8 +312,8 @@ ConfidenceConnectedImageFilter::GenerateData() secondFunction->ThresholdBetween(m_ReplaceValue, m_ReplaceValue); typename NumericTraits::RealType sum, sumOfSquares; - sum = NumericTraits::ZeroValue(); - sumOfSquares = NumericTraits::ZeroValue(); + sum = InputRealType{}; + sumOfSquares = InputRealType{}; typename TOutputImage::SizeValueType numberOfSamples = 0; SecondIteratorType sit(inputImage, secondFunction, m_Seeds); @@ -378,7 +378,7 @@ ConfidenceConnectedImageFilter::GenerateData() // upper] bounds prescribed, the pixel is added to the output // segmentation and its neighbors become candidates for the // iterator to walk. - outputImage->FillBuffer(NumericTraits::ZeroValue()); + outputImage->FillBuffer(OutputImagePixelType{}); IteratorType thirdIt(outputImage, function, m_Seeds); thirdIt.GoToBegin(); try diff --git a/Modules/Segmentation/RegionGrowing/include/itkConnectedThresholdImageFilter.hxx b/Modules/Segmentation/RegionGrowing/include/itkConnectedThresholdImageFilter.hxx index 5969b19e96f..e7ca0d0c90b 100644 --- a/Modules/Segmentation/RegionGrowing/include/itkConnectedThresholdImageFilter.hxx +++ b/Modules/Segmentation/RegionGrowing/include/itkConnectedThresholdImageFilter.hxx @@ -232,7 +232,7 @@ ConnectedThresholdImageFilter::GenerateData() OutputImageRegionType region = outputImage->GetRequestedRegion(); outputImage->SetBufferedRegion(region); outputImage->Allocate(); - outputImage->FillBuffer(NumericTraits::ZeroValue()); + outputImage->FillBuffer(OutputImagePixelType{}); using FunctionType = BinaryThresholdImageFunction; diff --git a/Modules/Segmentation/RegionGrowing/include/itkIsolatedConnectedImageFilter.hxx b/Modules/Segmentation/RegionGrowing/include/itkIsolatedConnectedImageFilter.hxx index a9f716e0ccc..c29eab4d4dc 100644 --- a/Modules/Segmentation/RegionGrowing/include/itkIsolatedConnectedImageFilter.hxx +++ b/Modules/Segmentation/RegionGrowing/include/itkIsolatedConnectedImageFilter.hxx @@ -37,7 +37,7 @@ IsolatedConnectedImageFilter::IsolatedConnectedImageF m_Seeds1.clear(); m_Seeds2.clear(); m_ReplaceValue = NumericTraits::OneValue(); - m_IsolatedValue = NumericTraits::ZeroValue(); + m_IsolatedValue = InputImagePixelType{}; m_IsolatedValueTolerance = NumericTraits::OneValue(); m_FindUpperThreshold = true; m_ThresholdingFailed = false; @@ -186,7 +186,7 @@ IsolatedConnectedImageFilter::GenerateData() OutputImageRegionType region = outputImage->GetRequestedRegion(); outputImage->SetBufferedRegion(region); outputImage->Allocate(); - outputImage->FillBuffer(NumericTraits::ZeroValue()); + outputImage->FillBuffer(OutputImagePixelType{}); using FunctionType = BinaryThresholdImageFunction; using IteratorType = FloodFilledImageFunctionConditionalIterator; @@ -219,7 +219,7 @@ IsolatedConnectedImageFilter::GenerateData() { ProgressReporter progress(this, 0, region.GetNumberOfPixels(), 100, cumulatedProgress, progressWeight); cumulatedProgress += progressWeight; - outputImage->FillBuffer(NumericTraits::ZeroValue()); + outputImage->FillBuffer(OutputImagePixelType{}); function->ThresholdBetween(m_Lower, static_cast(guess)); it.GoToBegin(); while (!it.IsAtEnd()) @@ -246,7 +246,7 @@ IsolatedConnectedImageFilter::GenerateData() ++si; } - if (Math::NotExactlyEquals(seedIntensitySum, NumericTraits::ZeroValue())) + if (Math::NotExactlyEquals(seedIntensitySum, InputRealType{})) { upper = guess; } @@ -284,7 +284,7 @@ IsolatedConnectedImageFilter::GenerateData() { ProgressReporter progress(this, 0, region.GetNumberOfPixels(), 100, cumulatedProgress, progressWeight); cumulatedProgress += progressWeight; - outputImage->FillBuffer(NumericTraits::ZeroValue()); + outputImage->FillBuffer(OutputImagePixelType{}); function->ThresholdBetween(static_cast(guess), m_Upper); it.GoToBegin(); while (!it.IsAtEnd()) @@ -311,7 +311,7 @@ IsolatedConnectedImageFilter::GenerateData() ++si; } - if (Math::NotExactlyEquals(seedIntensitySum, NumericTraits::ZeroValue())) + if (Math::NotExactlyEquals(seedIntensitySum, InputRealType{})) { lower = guess; } @@ -334,7 +334,7 @@ IsolatedConnectedImageFilter::GenerateData() // now rerun the algorithm with the thresholds that separate the seeds. ProgressReporter progress(this, 0, region.GetNumberOfPixels(), 100, cumulatedProgress, progressWeight); - outputImage->FillBuffer(NumericTraits::ZeroValue()); + outputImage->FillBuffer(OutputImagePixelType{}); if (m_FindUpperThreshold) { function->ThresholdBetween(m_Lower, m_IsolatedValue); @@ -378,7 +378,7 @@ IsolatedConnectedImageFilter::GenerateData() ++si2; } if (Math::NotAlmostEquals(seed1IntensitySum, m_ReplaceValue * m_Seeds1.size()) || - Math::NotExactlyEquals(seed2IntensitySum, NumericTraits::ZeroValue())) + Math::NotExactlyEquals(seed2IntensitySum, InputRealType{})) { m_ThresholdingFailed = true; } diff --git a/Modules/Segmentation/RegionGrowing/include/itkNeighborhoodConnectedImageFilter.hxx b/Modules/Segmentation/RegionGrowing/include/itkNeighborhoodConnectedImageFilter.hxx index 0c215e8855c..d1f0b8627c7 100644 --- a/Modules/Segmentation/RegionGrowing/include/itkNeighborhoodConnectedImageFilter.hxx +++ b/Modules/Segmentation/RegionGrowing/include/itkNeighborhoodConnectedImageFilter.hxx @@ -111,7 +111,7 @@ NeighborhoodConnectedImageFilter::GenerateData() // Zero the output outputImage->SetBufferedRegion(outputImage->GetRequestedRegion()); outputImage->Allocate(); - outputImage->FillBuffer(NumericTraits::ZeroValue()); + outputImage->FillBuffer(OutputImagePixelType{}); using FunctionType = NeighborhoodBinaryThresholdImageFunction; using IteratorType = FloodFilledImageFunctionConditionalIterator; diff --git a/Modules/Segmentation/RegionGrowing/include/itkVectorConfidenceConnectedImageFilter.hxx b/Modules/Segmentation/RegionGrowing/include/itkVectorConfidenceConnectedImageFilter.hxx index 61edfe63a49..d1b93852278 100644 --- a/Modules/Segmentation/RegionGrowing/include/itkVectorConfidenceConnectedImageFilter.hxx +++ b/Modules/Segmentation/RegionGrowing/include/itkVectorConfidenceConnectedImageFilter.hxx @@ -128,7 +128,7 @@ VectorConfidenceConnectedImageFilter::GenerateData() OutputImageRegionType region = outputImage->GetRequestedRegion(); outputImage->SetBufferedRegion(region); outputImage->Allocate(); - outputImage->FillBuffer(NumericTraits::ZeroValue()); + outputImage->FillBuffer(OutputImagePixelType{}); // Compute the statistics of the seed point using VectorMeanImageFunctionType = VectorMeanImageFunction; @@ -155,8 +155,8 @@ VectorConfidenceConnectedImageFilter::GenerateData() covariance = CovarianceMatrixType(dimension, dimension); mean = MeanVectorType(dimension); - covariance.fill(NumericTraits::ZeroValue()); - mean.fill(NumericTraits::ZeroValue()); + covariance.fill(ComponentRealType{}); + mean.fill(ComponentRealType{}); using MeanFunctionVectorType = typename VectorMeanImageFunctionType::OutputType; using CovarianceFunctionMatrixType = typename CovarianceImageFunctionType::OutputType; @@ -266,8 +266,8 @@ VectorConfidenceConnectedImageFilter::GenerateData() covariance = CovarianceMatrixType(dimension, dimension); mean = MeanVectorType(dimension); - covariance.fill(NumericTraits::ZeroValue()); - mean.fill(NumericTraits::ZeroValue()); + covariance.fill(ComponentRealType{}); + mean.fill(ComponentRealType{}); SizeValueType num{}; @@ -319,7 +319,7 @@ VectorConfidenceConnectedImageFilter::GenerateData() // upper] bounds prescribed, the pixel is added to the output // segmentation and its neighbors become candidates for the // iterator to walk. - outputImage->FillBuffer(NumericTraits::ZeroValue()); + outputImage->FillBuffer(OutputImagePixelType{}); IteratorType thirdIt(outputImage, m_ThresholdFunction, m_Seeds); thirdIt.GoToBegin(); try diff --git a/Modules/Segmentation/Watersheds/include/itkIsolatedWatershedImageFilter.hxx b/Modules/Segmentation/Watersheds/include/itkIsolatedWatershedImageFilter.hxx index 03558207665..2f6669c929a 100644 --- a/Modules/Segmentation/Watersheds/include/itkIsolatedWatershedImageFilter.hxx +++ b/Modules/Segmentation/Watersheds/include/itkIsolatedWatershedImageFilter.hxx @@ -27,11 +27,11 @@ namespace itk template IsolatedWatershedImageFilter::IsolatedWatershedImageFilter() { - m_Threshold = NumericTraits::ZeroValue(); + m_Threshold = InputImagePixelType{}; m_Seed1.Fill(0); m_Seed2.Fill(0); m_ReplaceValue1 = NumericTraits::OneValue(); - m_ReplaceValue2 = NumericTraits::ZeroValue(); + m_ReplaceValue2 = OutputImagePixelType{}; m_IsolatedValue = 0.0; m_IsolatedValueTolerance = 0.001; m_UpperValueLimit = 1.0; @@ -168,7 +168,7 @@ IsolatedWatershedImageFilter::GenerateData() } else { - ot.Set(NumericTraits::ZeroValue()); + ot.Set(OutputImagePixelType{}); } ++it; ++ot; diff --git a/Modules/Segmentation/Watersheds/include/itkMorphologicalWatershedImageFilter.hxx b/Modules/Segmentation/Watersheds/include/itkMorphologicalWatershedImageFilter.hxx index bdf1d91329c..ea1f85b68fe 100644 --- a/Modules/Segmentation/Watersheds/include/itkMorphologicalWatershedImageFilter.hxx +++ b/Modules/Segmentation/Watersheds/include/itkMorphologicalWatershedImageFilter.hxx @@ -29,7 +29,7 @@ namespace itk template MorphologicalWatershedImageFilter::MorphologicalWatershedImageFilter() - : m_Level(NumericTraits::ZeroValue()) + : m_Level(InputImagePixelType{}) {} @@ -82,7 +82,7 @@ MorphologicalWatershedImageFilter::GenerateData() auto rmin = RMinType::New(); rmin->SetInput(input); rmin->SetFullyConnected(m_FullyConnected); - rmin->SetBackgroundValue(NumericTraits::ZeroValue()); + rmin->SetBackgroundValue(OutputImagePixelType{}); rmin->SetForegroundValue(NumericTraits::max()); // label the components @@ -99,7 +99,7 @@ MorphologicalWatershedImageFilter::GenerateData() wshed->SetFullyConnected(m_FullyConnected); wshed->SetMarkWatershedLine(m_MarkWatershedLine); - if (m_Level != NumericTraits::ZeroValue()) + if (m_Level != InputImagePixelType{}) { // insert a h-minima filter to remove the smallest minima // diff --git a/Modules/Segmentation/Watersheds/test/itkMorphologicalWatershedImageFilterTest.cxx b/Modules/Segmentation/Watersheds/test/itkMorphologicalWatershedImageFilterTest.cxx index e659712fd0a..3d01d3b8b78 100644 --- a/Modules/Segmentation/Watersheds/test/itkMorphologicalWatershedImageFilterTest.cxx +++ b/Modules/Segmentation/Watersheds/test/itkMorphologicalWatershedImageFilterTest.cxx @@ -83,10 +83,10 @@ itkMorphologicalWatershedImageFilterTest(int argc, char * argv[]) using RescaleType = itk::IntensityWindowingImageFilter; auto rescaler = RescaleType::New(); rescaler->SetInput(filter->GetOutput()); - rescaler->SetWindowMinimum(itk::NumericTraits::ZeroValue()); + rescaler->SetWindowMinimum(PixelType{}); rescaler->SetWindowMaximum(minMaxCalculator->GetMaximum()); rescaler->SetOutputMaximum(itk::NumericTraits::max()); - rescaler->SetOutputMinimum(itk::NumericTraits::ZeroValue()); + rescaler->SetOutputMinimum(PixelType{}); // Write output image using WriterType = itk::ImageFileWriter; diff --git a/Modules/Video/BridgeOpenCV/test/itkOpenCVImageBridgeRGBTest.cxx b/Modules/Video/BridgeOpenCV/test/itkOpenCVImageBridgeRGBTest.cxx index c987db78b3c..2bfe5a60719 100644 --- a/Modules/Video/BridgeOpenCV/test/itkOpenCVImageBridgeRGBTest.cxx +++ b/Modules/Video/BridgeOpenCV/test/itkOpenCVImageBridgeRGBTest.cxx @@ -73,7 +73,7 @@ RGBImageTotalAbsDifference(const itk::Image, VDimensi localDiff += itk::Math::abs(validPx[i] - testPx[i]); } - if (localDiff != itk::NumericTraits::ZeroValue()) + if (localDiff != TPixelValue{}) { IterType testIt2 = testIt; ++testIt2; @@ -170,7 +170,7 @@ itkOpenCVImageBridgeTestTemplatedRGB(char * argv0, char * argv1) ComponentType itkIplDiff1 = RGBImageTotalAbsDifference(baselineImage, outIplITK); // Check results of IplImage -> itk::Image - if (itkIplDiff1 != itk::NumericTraits::ZeroValue()) + if (itkIplDiff1 != ComponentType{}) { std::cerr << "Images didn't match for pixel type " << typeid(PixelType).name() << " for IplImage -> ITK (RGB), with image difference = " << itkIplDiff1 << std::endl; @@ -185,7 +185,7 @@ itkOpenCVImageBridgeTestTemplatedRGB(char * argv0, char * argv1) ComponentType itkCvMatDiff = RGBImageTotalAbsDifference(baselineImage, outMatITK); // Check results of cv::Mat -> itk::Image - if (itkCvMatDiff != itk::NumericTraits::ZeroValue()) + if (itkCvMatDiff != ComponentType{}) { std::cerr << "Images didn't match for pixel type " << typeid(PixelType).name() << " for cv::Mat -> ITK (RGB)" << std::endl; diff --git a/Modules/Video/IO/include/itkVideoFileWriter.hxx b/Modules/Video/IO/include/itkVideoFileWriter.hxx index 80504d91a96..2b9286b9ac5 100644 --- a/Modules/Video/IO/include/itkVideoFileWriter.hxx +++ b/Modules/Video/IO/include/itkVideoFileWriter.hxx @@ -95,7 +95,7 @@ VideoFileWriter::Write() } // Make sure FramesPerSecond and FourCC have been set - if (Math::ExactlyEquals(m_FramesPerSecond, NumericTraits::ZeroValue()) || m_FourCC.length() == 0) + if (Math::ExactlyEquals(m_FramesPerSecond, TemporalRatioType{}) || m_FourCC.length() == 0) { itkExceptionMacro("Cannot write with FramesPerSecond or FourCC unset"); } diff --git a/Modules/Video/IO/src/itkVideoIOBase.cxx b/Modules/Video/IO/src/itkVideoIOBase.cxx index b8b85a8dfcb..b7d0fad35a4 100644 --- a/Modules/Video/IO/src/itkVideoIOBase.cxx +++ b/Modules/Video/IO/src/itkVideoIOBase.cxx @@ -25,10 +25,10 @@ namespace itk { VideoIOBase::VideoIOBase() - : m_FrameTotal(NumericTraits::ZeroValue()) - , m_CurrentFrame(NumericTraits::ZeroValue()) - , m_IFrameInterval(NumericTraits::ZeroValue()) - , m_LastIFrame(NumericTraits::ZeroValue()) + : m_FrameTotal(SizeValueType{}) + , m_CurrentFrame(SizeValueType{}) + , m_IFrameInterval(SizeValueType{}) + , m_LastIFrame(SizeValueType{}) {}