Skip to content

Commit cd1aa3d

Browse files
authored
Merge pull request #5635 from N-Dekker/Remove-itk-Index-from-region-initialization-in-tests
Remove zero-initialized variables declared as `itk::Index` or `IndexType` from region initialization in test
2 parents 77e3bef + 80f8bfb commit cd1aa3d

23 files changed

+49
-93
lines changed

Modules/Core/Common/test/itkAdaptorComparisonTest.cxx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -170,9 +170,8 @@ itkAdaptorComparisonTest(int, char *[])
170170
using VectorImageType = itk::Image<itk::Vector<float, 3>, 3>;
171171

172172
// Set up some images
173-
constexpr itk::Size<3> size{ 100, 100, 100 };
174-
constexpr itk::Index<3> index{ 0, 0, 0 };
175-
itk::ImageRegion<3> region = { index, size };
173+
constexpr itk::Size<3> size{ 100, 100, 100 };
174+
itk::ImageRegion<3> region{ size };
176175

177176
auto scalar_image = ScalarImageType::New();
178177
auto vector_image = VectorImageType::New();

Modules/Core/Common/test/itkConstNeighborhoodIteratorTest.cxx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,7 @@ GetTestImage(int d1, int d2, int d3, int d4)
3535
sizeND[2] = d3;
3636
sizeND[3] = d4;
3737

38-
constexpr itk::Index<4> origND{};
39-
40-
const itk::ImageRegion<4> RegionND{ origND, sizeND };
38+
const itk::ImageRegion<4> RegionND{ sizeND };
4139

4240
auto imageND = TestImageType::New();
4341
imageND->SetRegions(RegionND);

Modules/Core/Common/test/itkConstNeighborhoodIteratorWithOnlyIndexTest.cxx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,7 @@ itkConstNeighborhoodIteratorWithOnlyIndexTestGetTestImage(int d1, int d2, int d3
2929
sizeND[2] = d3;
3030
sizeND[3] = d4;
3131

32-
constexpr itk::Index<4> origND{};
33-
34-
const itk::ImageRegion<4> RegionND{ origND, sizeND };
32+
const itk::ImageRegion<4> RegionND{ sizeND };
3533

3634
auto imageND = TImage::New();
3735
imageND->SetRegions(RegionND);

Modules/Core/Common/test/itkConstantBoundaryConditionTest.cxx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -121,10 +121,9 @@ int
121121
itkConstantBoundaryConditionTest(int, char *[])
122122
{
123123
// Test an image to cover one operator() method.
124-
auto image = ImageType::New();
125-
constexpr SizeType imageSize{ 5, 5 };
126-
constexpr IndexType imageIndex{ 0, 0 };
127-
RegionType imageRegion{ imageIndex, imageSize };
124+
auto image = ImageType::New();
125+
constexpr SizeType imageSize{ 5, 5 };
126+
RegionType imageRegion{ imageSize };
128127
image->SetRegions(imageRegion);
129128
image->Allocate();
130129

Modules/Core/Common/test/itkMinimumMaximumImageCalculatorTest.cxx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,7 @@ itkMinimumMaximumImageCalculatorTest(int, char *[])
9898

9999
// Set the region over which perform the computations
100100
constexpr itk::Size<3> regionSize{ { 4, 4, 4 } };
101-
constexpr itk::Index<3> idx{ { 0, 0, 0 } };
102-
const MinMaxCalculatorType::RegionType computationRegion{ idx, regionSize };
101+
const MinMaxCalculatorType::RegionType computationRegion{ regionSize };
103102

104103
calculator->SetRegion(computationRegion);
105104

Modules/Core/Common/test/itkPeriodicBoundaryConditionTest.cxx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -124,9 +124,8 @@ itkPeriodicBoundaryConditionTest(int, char *[])
124124
// Test an image to cover one operator() method.
125125
auto image = ImageType::New();
126126

127-
constexpr SizeType imageSize{ 5, 5 };
128-
constexpr IndexType imageIndex{ 0, 0 };
129-
const RegionType imageRegion(imageIndex, imageSize);
127+
constexpr SizeType imageSize{ 5, 5 };
128+
const RegionType imageRegion{ imageSize };
130129
image->SetRegions(imageRegion);
131130
image->Allocate();
132131

Modules/Core/Common/test/itkSliceIteratorTest.cxx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -147,10 +147,9 @@ itkSliceIteratorTest(int, char *[])
147147
try
148148
{
149149

150-
constexpr itk::Size<2> hoodRadius{ 2, 2 };
151-
constexpr itk::Size<2> imgSize{ 20, 20 };
152-
constexpr itk::Index<2> zeroIndex{};
153-
itk::ImageRegion<2> reg = { zeroIndex, imgSize };
150+
constexpr itk::Size<2> hoodRadius{ 2, 2 };
151+
constexpr itk::Size<2> imgSize{ 20, 20 };
152+
itk::ImageRegion<2> reg{ imgSize };
154153

155154
const std::slice hslice(10, 5, 1); // slice through the horizontal center
156155
const std::slice vslice(2, 5, 5); // slice through the vertical center

Modules/Core/Common/test/itkZeroFluxBoundaryConditionTest.cxx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -124,9 +124,8 @@ itkZeroFluxBoundaryConditionTest(int, char *[])
124124
// Test an image to cover one operator() method.
125125
auto image = ImageType::New();
126126

127-
constexpr SizeType imageSize{ 5, 5 };
128-
constexpr IndexType imageIndex{ 0, 0 };
129-
const RegionType imageRegion{ imageIndex, imageSize };
127+
constexpr SizeType imageSize{ 5, 5 };
128+
const RegionType imageRegion{ imageSize };
130129
image->SetRegions(imageRegion);
131130
image->Allocate();
132131

Modules/Filtering/ImageFilterBase/test/itkCastImageFilterTest.cxx

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -283,10 +283,8 @@ TestVectorImageCast1()
283283
// Create a 1x3 image of 2D vectors
284284
auto image = FloatVectorImageType::New();
285285

286-
constexpr itk::Size<2> size{ { 1, 3 } };
287-
constexpr itk::Index<2> start{ { 0, 0 } };
288-
289-
const itk::ImageRegion<2> region(start, size);
286+
constexpr itk::Size<2> size{ { 1, 3 } };
287+
const itk::ImageRegion<2> region{ size };
290288
image->SetNumberOfComponentsPerPixel(2);
291289
image->SetRegions(region);
292290
image->Allocate();
@@ -350,10 +348,8 @@ TestVectorImageCast2()
350348
// Create a 1x3 image of 2D vectors
351349
auto image = FloatVectorImageType::New();
352350

353-
constexpr itk::Size<2> size{ { 1, 3 } };
354-
constexpr itk::Index<2> start{ { 0, 0 } };
355-
356-
const itk::ImageRegion<2> region(start, size);
351+
constexpr itk::Size<2> size{ { 1, 3 } };
352+
const itk::ImageRegion<2> region{ size };
357353
image->SetNumberOfComponentsPerPixel(2);
358354
image->SetRegions(region);
359355
image->Allocate();

Modules/Filtering/ImageIntensity/test/itkDivideImageFilterTest2.cxx

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,6 @@ itkDivideImageFilterTest2(int, char *[])
4040
// Declare appropriate Iterator types for each image
4141
using OutputImageIteratorType = itk::ImageRegionIteratorWithIndex<OutputImageType>;
4242

43-
44-
// Declare the type of the index to access images
45-
using IndexType = itk::Index<Dimension>;
46-
4743
// Declare the type of the size
4844
using SizeType = itk::Size<Dimension>;
4945

@@ -55,9 +51,8 @@ itkDivideImageFilterTest2(int, char *[])
5551
auto inputImageB = InputImageType2::New();
5652

5753
// Define their size, and start index
58-
constexpr SizeType size{ 2, 2, 2 };
59-
constexpr IndexType start{ 0, 0, 0 };
60-
RegionType region{ start, size };
54+
constexpr SizeType size{ 2, 2, 2 };
55+
RegionType region{ size };
6156

6257
// Initialize Image A
6358
inputImageA->SetRegions(region);

0 commit comments

Comments
 (0)