Skip to content

Commit 2d7b402

Browse files
committed
STYLE: Remove itk::Index variables from region initialization in tests
Removed `constexpr itk::Index` variables initialized by zero's, that were only there as the index argument of a region initialization. Follow-up to pull request #5627 commit f9885d2 "STYLE: Remove `T::IndexType index{}` from region initialization in tests"
1 parent 150da41 commit 2d7b402

File tree

7 files changed

+13
-27
lines changed

7 files changed

+13
-27
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/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/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/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/IO/SpatialObjects/test/itkReadWriteSpatialObjectTest.cxx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -279,10 +279,7 @@ itkReadWriteSpatialObjectTest(int argc, char * argv[])
279279
spacing[i] = i + 1;
280280
}
281281

282-
RegionType region;
283-
region.SetSize(size);
284-
constexpr itk::Index<3> zeroIndex{};
285-
region.SetIndex(zeroIndex);
282+
RegionType region{ size };
286283
itkImage->SetRegions(region);
287284
itkImage->SetSpacing(spacing);
288285
itkImage->Allocate();

0 commit comments

Comments
 (0)