Skip to content

Commit a0d4cef

Browse files
N-Dekkerhjmjohnson
authored andcommitted
STYLE: Replace NumericTraits<float> ZeroValue() and OneValue() calls
Replaced `NumericTraits<float>::ZeroValue()` calls by `0.0f`. Also replaced the one call to `itk::NumericTraits<float>::OneValue()`, from inside itkMathTest. Follow-up to similar commits for `double`, but now specific for `float`, as suggested by Dženan Zukić.
1 parent 7182b61 commit a0d4cef

File tree

6 files changed

+6
-7
lines changed

6 files changed

+6
-7
lines changed

Modules/Core/Common/test/itkBoundaryConditionTest.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ itkBoundaryConditionTest(int, char *[])
170170
SmartIteratorType it2d(sz2, image2D, image2D->GetRequestedRegion());
171171

172172
itk::ConstantBoundaryCondition<ImageType2D> cbc;
173-
cbc.SetConstant(itk::NumericTraits<float>::ZeroValue());
173+
cbc.SetConstant(0.0f);
174174
it2d.OverrideBoundaryCondition(&cbc);
175175

176176
SmartIteratorType::NeighborhoodType tempN;

Modules/Core/Common/test/itkMathTest.cxx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -622,8 +622,7 @@ main(int, char *[])
622622
}
623623

624624
// Test comparison values of different types
625-
if (itk::Math::NotExactlyEquals(itk::NumericTraits<float>::OneValue(), 1.0) ||
626-
itk::Math::NotExactlyEquals(1.0, static_cast<float>(1)))
625+
if (itk::Math::NotExactlyEquals(1.0f, 1.0) || itk::Math::NotExactlyEquals(1.0, 1.0f))
627626
{
628627
std::cout << __FILE__ << " " << __LINE__ << " " << f << " == " << d << std::endl;
629628
testPassStatus = EXIT_FAILURE;

Modules/IO/MINC/test/itkMINCImageIOTest.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -441,7 +441,7 @@ MINCReadWriteTest(const char * fileName, const char * minc_storage_type, double
441441
success = EXIT_FAILURE;
442442
}
443443

444-
float metaDataFloat = itk::NumericTraits<float>::ZeroValue();
444+
float metaDataFloat = 0.0f;
445445
if (!itk::ExposeMetaData<float>(metaDict2, "acquisition:TestFloat", metaDataFloat) || metaDataFloat != 1.2f)
446446
{
447447
std::cerr << "Failure reading metaData "

Modules/IO/MeshFreeSurfer/src/itkFreeSurferAsciiMeshIO.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ FreeSurferAsciiMeshIO ::WritePoints(void * buffer)
307307
}
308308
case IOComponentEnum::FLOAT:
309309
{
310-
WritePoints(static_cast<float *>(buffer), outputFile, itk::NumericTraits<float>::ZeroValue());
310+
WritePoints(static_cast<float *>(buffer), outputFile, 0.0f);
311311

312312
break;
313313
}

Modules/Segmentation/LevelSets/include/itkCurvesLevelSetFunction.hxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ CurvesLevelSetFunction<TImageType, TFeatureImageType>::CalculateAdvectionImage()
5757

5858
typename VectorImageType::Pointer gradientImage;
5959

60-
if (Math::NotAlmostEquals(m_DerivativeSigma, NumericTraits<float>::ZeroValue()))
60+
if (Math::NotAlmostEquals(m_DerivativeSigma, 0.0f))
6161
{
6262
using DerivativeFilterType = GradientRecursiveGaussianImageFilter<FeatureImageType, VectorImageType>;
6363

Modules/Segmentation/LevelSets/include/itkGeodesicActiveContourLevelSetFunction.hxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ GeodesicActiveContourLevelSetFunction<TImageType, TFeatureImageType>::CalculateA
4646

4747
typename VectorImageType::Pointer gradientImage;
4848

49-
if (Math::NotAlmostEquals(m_DerivativeSigma, NumericTraits<float>::ZeroValue()))
49+
if (Math::NotAlmostEquals(m_DerivativeSigma, 0.0f))
5050
{
5151
using DerivativeFilterType = GradientRecursiveGaussianImageFilter<FeatureImageType, VectorImageType>;
5252

0 commit comments

Comments
 (0)