Skip to content

Commit a8dd05b

Browse files
authored
Merge pull request #5655 from N-Dekker/FillBuffer-in-ImageIntensity-tests
STYLE: Replace iterations with FillBuffer calls in ImageIntensity tests
2 parents 87fd5d3 + e2110ab commit a8dd05b

File tree

3 files changed

+5
-28
lines changed

3 files changed

+5
-28
lines changed

Modules/Filtering/ImageIntensity/test/itkAtan2ImageFilterTest.cxx

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -68,24 +68,14 @@ itkAtan2ImageFilterTest(int, char *[])
6868

6969
// Initialize the content of Image A
7070
const double sinValue = std::sin(itk::Math::pi / 6.0);
71-
it1.GoToBegin();
72-
while (!it1.IsAtEnd())
73-
{
74-
it1.Set(sinValue);
75-
++it1;
76-
}
71+
sinImage->FillBuffer(sinValue);
7772

7873
// Create one iterator for the Input Image (this is a light object)
7974
InputIteratorType it2(cosImage, cosImage->GetBufferedRegion());
8075

8176
// Initialize the content of Image A
8277
const double cosValue = std::cos(itk::Math::pi / 6.0);
83-
it2.GoToBegin();
84-
while (!it2.IsAtEnd())
85-
{
86-
it2.Set(cosValue);
87-
++it2;
88-
}
78+
cosImage->FillBuffer(cosValue);
8979

9080
// Declare the type for the Atan filter
9181
using FilterType = itk::Atan2ImageFilter<InputImageType, InputImageType, OutputImageType>;

Modules/Filtering/ImageIntensity/test/itkImageAdaptorNthElementTest.cxx

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -98,11 +98,7 @@ itkImageAdaptorNthElementTest(int, char *[])
9898
initialPixelValue[1] = 11;
9999
initialPixelValue[2] = 17;
100100

101-
while (!it.IsAtEnd())
102-
{
103-
it.Set(initialPixelValue);
104-
++it;
105-
}
101+
myContainerPixelImage->FillBuffer(initialPixelValue);
106102

107103
std::cout << "Initial Container Image Values : " << std::endl;
108104
it.GoToBegin();
@@ -142,11 +138,7 @@ itkImageAdaptorNthElementTest(int, char *[])
142138

143139
constexpr myFloatPixelType initialFloatValue{ 5.0 };
144140

145-
while (!itf.IsAtEnd())
146-
{
147-
itf.Set(initialFloatValue);
148-
++itf;
149-
}
141+
myFloatImage->FillBuffer(initialFloatValue);
150142

151143
std::cout << "Initial Float Image Values : " << std::endl;
152144
itf.GoToBegin();

Modules/Filtering/ImageIntensity/test/itkVectorToRGBImageAdaptorTest.cxx

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -81,12 +81,7 @@ itkVectorToRGBImageAdaptorTest(int, char *[])
8181
vector[2] = 1.4;
8282

8383
// Initializing all the pixel in the image
84-
it1.GoToBegin();
85-
while (!it1.IsAtEnd())
86-
{
87-
it1.Set(vector);
88-
++it1;
89-
}
84+
image->FillBuffer(vector);
9085

9186
// Reading the values to verify the image content
9287
std::cout << "--- Before --- " << std::endl;

0 commit comments

Comments
 (0)