Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Examples/Iterators/ImageLinearIteratorWithIndex2.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ main(int argc, char * argv[])
it.GoToBegin();
while (!it.IsAtEnd())
{
SumType sum = itk::NumericTraits<SumType>::ZeroValue();
SumType sum{};
it.GoToBeginOfLine();
index4D = it.GetIndex();
while (!it.IsAtEndOfLine())
Expand Down
2 changes: 1 addition & 1 deletion Examples/RegistrationITKv4/ThinPlateSplineWarp.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ main(int argc, char * argv[])
targetLandMarks->GetPoints();
// Software Guide : EndCodeSnippet

PointIdType id = itk::NumericTraits<PointIdType>::ZeroValue();
PointIdType id{};

// Read in the list of landmarks
std::ifstream infile;
Expand Down
2 changes: 1 addition & 1 deletion Modules/Core/Common/test/itkIntTypesTest.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ bool
CheckTraits(bool issigned, T * = nullptr)
{
// make sure that we have a specialized NumericTraits
T t0 = itk::NumericTraits<T>::ZeroValue();
T t0{};
T t1 = itk::NumericTraits<T>::OneValue();

// just here so that we use the variable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ itkSymmetricSecondRankTensorTest(int, char *[])
tensor3D(2, 1) = 0.0; // overrides (1,2)
tensor3D(2, 2) = 29.0;

AccumulateValueType expectedTrace = itk::NumericTraits<AccumulateValueType>::ZeroValue();
AccumulateValueType expectedTrace{};

expectedTrace += tensor3D(0, 0);
expectedTrace += tensor3D(1, 1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ class ITK_TEMPLATE_EXPORT GPUFiniteDifferenceFunction : public FiniteDifferenceF
void * itkNotUsed(globalData),
const FloatOffsetType & itkNotUsed(offset = FloatOffsetType(0.0))) override
{
PixelType pix = itk::NumericTraits<PixelType>::ZeroValue();
PixelType pix{};
return pix;
}
#endif
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ itkImageMaskSpatialObjectTest2(int, char *[])
{
point += incrementVector;
const bool isInside = maskSO->IsInsideInWorldSpace(point);
double value = itk::NumericTraits<PixelType>::ZeroValue();
double value{};
maskSO->ValueAtInWorldSpace(point, value);
const bool isZero = (itk::Math::ExactlyEquals(value, itk::NumericTraits<PixelType>::ZeroValue()));
if ((isInside && isZero) || (!isInside && !isZero))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ itkDiffusionTensor3DTest(int, char *[])
tensor3(2, 1) = 0.0; // overrides (1,2)
tensor3(2, 2) = 29.0;

AccumulateValueType expectedTrace = itk::NumericTraits<AccumulateValueType>::ZeroValue();
AccumulateValueType expectedTrace{};

expectedTrace += tensor3(0, 0);
expectedTrace += tensor3(1, 1);
Expand Down Expand Up @@ -430,13 +430,13 @@ itkDiffusionTensor3DTest(int, char *[])
TensorType nonpositiveMinTensor = itk::NumericTraits<TensorType>::NonpositiveMin();
std::cout << nonpositiveMinTensor << std::endl;

TensorType zeroValue = itk::NumericTraits<TensorType>::ZeroValue();
TensorType zeroValue{};
std::cout << zeroValue << std::endl;

TensorType oneValue = itk::NumericTraits<TensorType>::OneValue();
std::cout << oneValue << std::endl;

TensorType zero = itk::NumericTraits<TensorType>::ZeroValue();
TensorType zero{};
std::cout << zero << std::endl;

TensorType one = itk::NumericTraits<TensorType>::OneValue();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ itkGaussianExponentialDiffeomorphicTransformTest(int, char *[])
std::cout << "Test SmoothDisplacementFieldGauss" << std::endl;
DisplacementTransformType::ParametersType params;
using ParametersValueType = DisplacementTransformType::ParametersValueType;
ParametersValueType paramsZero = itk::NumericTraits<itk::NumericTraits<ParametersValueType>::ValueType>::ZeroValue();
ParametersValueType paramsZero{};
DisplacementTransformType::ParametersType paramsFill(displacementTransform->GetNumberOfParameters());
DisplacementTransformType::ParametersValueType paramsFillValue = 0.0;
paramsFill.Fill(paramsFillValue);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ itkGaussianSmoothingOnUpdateDisplacementFieldTransformTest(int, char *[])
/* Test SmoothDisplacementFieldGauss */
std::cout << "Test SmoothDisplacementFieldGauss" << std::endl;
using ParametersValueType = DisplacementTransformType::ParametersValueType;
ParametersValueType paramsZero = itk::NumericTraits<itk::NumericTraits<ParametersValueType>::ValueType>::ZeroValue();
ParametersValueType paramsZero{};
DisplacementTransformType::ParametersType params;
DisplacementTransformType::ParametersType paramsFill(displacementTransform->GetNumberOfParameters());
DisplacementTransformType::ParametersValueType paramsFillValue = 0.0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ itkContourDirectedMeanDistanceImageFilterTest(int, char *[])
region2.SetIndex(index);

itk::ImageRegionIterator<Image1Type> it1(image1, region1);
Pixel1Type count = itk::NumericTraits<Pixel1Type>::ZeroValue();
Pixel1Type count{};
while (!it1.IsAtEnd())
{
it1.Set(++count);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ itkContourMeanDistanceImageFilterTest(int argc, char * argv[])
region2.SetIndex(index);

itk::ImageRegionIterator<Image1Type> it1(image1, region1);
Pixel1Type count = itk::NumericTraits<Pixel1Type>::ZeroValue();
Pixel1Type count{};
while (!it1.IsAtEnd())
{
it1.Set(++count);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ itkDirectedHausdorffDistanceImageFilterTest1(int, char *[])
region2.SetIndex(index);

itk::ImageRegionIterator<Image1Type> it1(image1, region1);
Pixel1Type count = itk::NumericTraits<Pixel1Type>::ZeroValue();
Pixel1Type count{};
while (!it1.IsAtEnd())
{
it1.Set(++count);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ itkHausdorffDistanceImageFilterTest(int argc, char * argv[])
region2.SetIndex(index);

itk::ImageRegionIterator<Image1Type> it1(image1, region1);
Pixel1Type count = itk::NumericTraits<Pixel1Type>::ZeroValue();
Pixel1Type count{};
while (!it1.IsAtEnd())
{
it1.Set(++count);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ itkFastMarchingBaseTest(int argc, char * argv[])
double normalizationFactor = 1.0;
ITK_TEST_SET_GET_VALUE(normalizationFactor, fmm->GetNormalizationFactor());

auto targetReachedValue = itk::NumericTraits<typename ImageFastMarching::OutputPixelType>::ZeroValue();
typename ImageFastMarching::OutputPixelType targetReachedValue{};
ITK_TEST_EXPECT_EQUAL(targetReachedValue, fmm->GetTargetReachedValue());

bool collectPoints = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ FastMarchingImageFilter(unsigned int argc, char * argv[])
return EXIT_FAILURE;
}

LabelType label_zero = itk::NumericTraits<LabelType>::ZeroValue();
LabelType label_zero{};

using ContourFilterType = itk::LabelContourImageFilter<LabelImageType, LabelImageType>;
auto contour = ContourFilterType::New();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ itkFastMarchingUpwindGradientBaseTest(int, char *[])
}
criterion->SetTargetNodes(TargetNodes);

auto targetOffset = itk::NumericTraits<typename CriterionType::OutputPixelType>::ZeroValue();
typename CriterionType::OutputPixelType targetOffset{};
criterion->SetTargetOffset(targetOffset);
ITK_TEST_SET_GET_VALUE(targetOffset, criterion->GetTargetOffset());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ itkSimpleContourExtractorImageFilterTest(int argc, char * argv[])
FilterType::InputPixelType inputForegroundValue = 255;
FilterType::InputPixelType inputBackgroundValue = 0;
FilterType::OutputPixelType outputForegroundValue = itk::NumericTraits<FilterType::OutputPixelType>::max();
FilterType::OutputPixelType outputBackgroundValue = itk::NumericTraits<FilterType::OutputPixelType>::ZeroValue();
FilterType::OutputPixelType outputBackgroundValue{};

filter->SetInputForegroundValue(inputForegroundValue);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ itkMaskNeighborhoodOperatorImageFilterTest(int argc, char * argv[])
filter1->SetMaskImage(mask1);
filter1->SetOperator(sobelHorizontal);

auto defaultValue = itk::NumericTraits<typename FilterType::OutputPixelType>::ZeroValue();
typename FilterType::OutputPixelType defaultValue{};
filter1->SetDefaultValue(defaultValue);
ITK_TEST_SET_GET_VALUE(defaultValue, filter1->GetDefaultValue());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ PolyLineParametricPath<VDimension>::IncrementInput(InputType & input) const -> O
// Save this input index since we will use it to calculate the offset
const IndexType originalIndex = this->EvaluateToIndex(input);

InputType potentialTimestep = itk::NumericTraits<InputType>::ZeroValue();
InputType potentialTimestep{};
bool timeStepSmallEnough = false;
while (!timeStepSmallEnough)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ itkExtractOrthogonalSwath2DImageFilterTest(int argc, char * argv[])
extractOrthogonalSwath2DImageFilter, ExtractOrthogonalSwath2DImageFilter, ImageAndPathToImageFilter);


auto defaultPixelValue = itk::NumericTraits<typename ImageType::PixelType>::ZeroValue();
typename ImageType::PixelType defaultPixelValue{};
extractOrthogonalSwath2DImageFilter->SetDefaultPixelValue(defaultPixelValue);

extractOrthogonalSwath2DImageFilter->SetImageInput(inputImage);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ itkCleanQuadEdgeMeshFilterTest(int argc, char * argv[])

filter->SetInput(mesh);

auto absTol = itk::NumericTraits<typename CleanFilterType::InputCoordRepType>::ZeroValue();
typename CleanFilterType::InputCoordRepType absTol{};
filter->SetAbsoluteTolerance(absTol);
ITK_TEST_SET_GET_VALUE(absTol, filter->GetAbsoluteTolerance());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ itkLargeImageWriteConvertReadTest(int argc, char * argv[])
IteratorType itr(image, region);
itr.GoToBegin();

OutputPixelType pixelValue = itk::NumericTraits<OutputPixelType>::ZeroValue();
OutputPixelType pixelValue{};

chronometer.Start("Initializing");
while (!itr.IsAtEnd())
Expand Down
5 changes: 2 additions & 3 deletions Modules/IO/ImageBase/test/itkLargeImageWriteReadTest.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ ActualTest(std::string filename, typename TImageType::SizeType size)
typename ImageType::RegionType region;
typename ImageType::IndexType index;

PixelType pixelValue;

itk::TimeProbesCollectorBase chronometer;

Expand Down Expand Up @@ -73,7 +72,7 @@ ActualTest(std::string filename, typename TImageType::SizeType size)
IteratorType itr(image, region);
itr.GoToBegin();

pixelValue = itk::NumericTraits<PixelType>::ZeroValue();
PixelType pixelValue{};

chronometer.Start("Initializing");
while (!itr.IsAtEnd())
Expand Down Expand Up @@ -127,7 +126,7 @@ ActualTest(std::string filename, typename TImageType::SizeType size)

std::cout << "Comparing the pixel values..." << std::endl;

pixelValue = itk::NumericTraits<PixelType>::ZeroValue();
PixelType pixelValue{};

chronometer.Start("Compare");
while (!ritr.IsAtEnd())
Expand Down
4 changes: 2 additions & 2 deletions Modules/IO/MINC/test/itkMINCImageIOTest.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,7 @@ MINCReadWriteTest(const char * fileName, const char * minc_storage_type, double
success = EXIT_FAILURE;
}

int metaDataInt = itk::NumericTraits<int>::ZeroValue();
int metaDataInt{};
if (!itk::ExposeMetaData<int>(metaDict2, "acquisition:TestInt", metaDataInt) || metaDataInt != 4)
{
std::cerr << "Failure reading metaData "
Expand Down Expand Up @@ -705,7 +705,7 @@ MINCReadWriteTestVector(const char * fileName,
success = EXIT_FAILURE;
}

int metaDataInt = itk::NumericTraits<int>::ZeroValue();
int metaDataInt{};
if (!itk::ExposeMetaData<int>(metaDict2, "acquisition:TestInt", metaDataInt) || metaDataInt != 4)
{
std::cerr << "Failure reading metaData "
Expand Down
4 changes: 2 additions & 2 deletions Modules/IO/MeshBYU/include/itkBYUMeshIO.h
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ class ITKIOMeshBYU_EXPORT BYUMeshIO : public MeshIOBase
WritePoints(T * buffer, std::ofstream & outputFile)
{
Indent indent(1);
SizeValueType index = itk::NumericTraits<SizeValueType>::ZeroValue();
SizeValueType index{};

for (SizeValueType ii = 0; ii < this->m_NumberOfPoints; ++ii)
{
Expand All @@ -137,7 +137,7 @@ class ITKIOMeshBYU_EXPORT BYUMeshIO : public MeshIOBase
WriteCells(T * buffer, std::ofstream & outputFile)
{
Indent indent(7);
SizeValueType index = itk::NumericTraits<SizeValueType>::ZeroValue();
SizeValueType index{};

for (SizeValueType ii = 0; ii < this->m_NumberOfCells; ++ii)
{
Expand Down
2 changes: 1 addition & 1 deletion Modules/IO/MeshBYU/src/itkBYUMeshIO.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ BYUMeshIO::ReadCells(void * buffer)
inputFile.precision(12);
auto * data = static_cast<unsigned int *>(buffer);
SizeValueType numPoints = 0;
SizeValueType id = itk::NumericTraits<SizeValueType>::ZeroValue();
SizeValueType id{};
SizeValueType index = 2;
int ptId;
m_FirstCellId -= 1;
Expand Down
4 changes: 2 additions & 2 deletions Modules/IO/MeshBase/include/itkMeshIOBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -738,8 +738,8 @@ class ITKIOMeshBase_EXPORT MeshIOBase : public LightProcessObject
{
if (input && output)
{
SizeValueType inputIndex = itk::NumericTraits<SizeValueType>::ZeroValue();
SizeValueType outputIndex = itk::NumericTraits<SizeValueType>::ZeroValue();
SizeValueType inputIndex{};
SizeValueType outputIndex{};

for (SizeValueType ii = 0; ii < m_NumberOfCells; ++ii)
{
Expand Down
6 changes: 3 additions & 3 deletions Modules/IO/MeshOBJ/include/itkOBJMeshIO.h
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ class ITKIOMeshOBJ_EXPORT OBJMeshIO : public MeshIOBase
void
WritePoints(T * buffer, std::ofstream & outputFile)
{
SizeValueType index = itk::NumericTraits<SizeValueType>::ZeroValue();
SizeValueType index{};

for (SizeValueType ii = 0; ii < this->m_NumberOfPoints; ++ii)
{
Expand All @@ -133,7 +133,7 @@ class ITKIOMeshOBJ_EXPORT OBJMeshIO : public MeshIOBase
void
WriteCells(T * buffer, std::ofstream & outputFile)
{
SizeValueType index = itk::NumericTraits<SizeValueType>::ZeroValue();
SizeValueType index{};

for (SizeValueType ii = 0; ii < this->m_NumberOfCells; ++ii)
{
Expand All @@ -154,7 +154,7 @@ class ITKIOMeshOBJ_EXPORT OBJMeshIO : public MeshIOBase
void
WritePointData(T * buffer, std::ofstream & outputFile)
{
SizeValueType index = itk::NumericTraits<SizeValueType>::ZeroValue();
SizeValueType index{};

for (SizeValueType ii = 0; ii < this->m_NumberOfPointPixels; ++ii)
{
Expand Down
2 changes: 1 addition & 1 deletion Modules/IO/RAW/test/itkRawImageIOTest3.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ itkRawImageIOTest3(int argc, char * argv[])

ImageIteratorType ii(image, region);

PixelType value = itk::NumericTraits<PixelType>::ZeroValue();
PixelType value{};
ii.GoToBegin();
while (!ii.IsAtEnd())
{
Expand Down
4 changes: 2 additions & 2 deletions Modules/IO/RAW/test/itkRawImageIOTest4.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ class RawImageIOReadFileTester
it.SetDirection(0);


PixelType value = itk::NumericTraits<PixelType>::ZeroValue();
PixelType value{};
while (!it.IsAtEnd())
{
while (!it.IsAtEndOfLine())
Expand Down Expand Up @@ -121,7 +121,7 @@ itkRawImageIOTest4(int argc, char * argv[])
using ComponentType = itk::PixelTraits<PixelType>::ValueType;
using ByteSwapperType = itk::ByteSwapper<ComponentType>;

PixelType value = itk::NumericTraits<PixelType>::ZeroValue();
PixelType value{};
unsigned int numberOfPixels = dims[0] * dims[1];


Expand Down
2 changes: 1 addition & 1 deletion Modules/IO/RAW/test/itkRawImageIOTest5.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class RawImageReaderAndWriter
m_Image->SetRegions(region);
m_Image->Allocate();

PixelType value = itk::NumericTraits<PixelType>::ZeroValue();
PixelType value{};

// Fill the image with incremental values.
using IteratorType = itk::ImageRegionIterator<ImageType>;
Expand Down
6 changes: 2 additions & 4 deletions Modules/IO/TIFF/test/itkLargeTIFFImageWriteReadTest.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,6 @@ itkLargeTIFFImageWriteReadTestHelper(std::string filename, typename TImage::Size
typename ImageType::RegionType region;
typename ImageType::IndexType index;

PixelType pixelValue;

itk::TimeProbesCollectorBase chronometer;

{
Expand Down Expand Up @@ -82,7 +80,7 @@ itkLargeTIFFImageWriteReadTestHelper(std::string filename, typename TImage::Size
IteratorType itr(image, region);
itr.GoToBegin();

pixelValue = itk::NumericTraits<PixelType>::ZeroValue();
PixelType pixelValue{};

chronometer.Start("Initializing");
while (!itr.IsAtEnd())
Expand Down Expand Up @@ -129,7 +127,7 @@ itkLargeTIFFImageWriteReadTestHelper(std::string filename, typename TImage::Size

std::cout << "Comparing the pixel values..." << std::endl;

pixelValue = itk::NumericTraits<PixelType>::ZeroValue();
PixelType pixelValue{};

chronometer.Start("Compare");
while (!ritr.IsAtEnd())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ auto
DiscreteGradientMagnitudeGaussianImageFunction<TInputImage, TOutput>::EvaluateAtIndex(const IndexType & index) const
-> OutputType
{
OutputType gradientMagnitude = itk::NumericTraits<OutputType>::ZeroValue();
OutputType gradientMagnitude{};
OutputType temp;

for (unsigned int i = 0; i < m_KernelArray.Size(); ++i)
Expand Down
Loading