Skip to content

Commit 581dcca

Browse files
committed
STYLE: Replace T var; var.Fill(x) with auto var = MakeFilled<T>(x)
Replace in Files, doing: Find what: ^( [ ]+)([^ ].*)[ ]+(\w+);[\r\n]+\1\3\.Fill\( Replace with: $1auto $3 = MakeFilled<$2>\( Simplify the creation of containers with initial values.
1 parent 7d908e9 commit 581dcca

File tree

86 files changed

+348
-573
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

86 files changed

+348
-573
lines changed

Examples/DataRepresentation/Image/Image4.cxx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -170,8 +170,7 @@ main(int, char *[])
170170

171171
// Software Guide : BeginCodeSnippet
172172
// coordinates of the center of the first pixel in N-D
173-
ImageType::PointType newOrigin;
174-
newOrigin.Fill(0.0);
173+
auto newOrigin = itk::MakeFilled<ImageType::PointType>(0.0);
175174
image->SetOrigin(newOrigin);
176175
// Software Guide : EndCodeSnippet
177176

@@ -443,8 +442,7 @@ main(int, char *[])
443442
// Software Guide : BeginCodeSnippet
444443
using MatrixType =
445444
itk::Matrix<itk::SpacePrecisionType, Dimension, Dimension>;
446-
MatrixType SpacingMatrix;
447-
SpacingMatrix.Fill(0.0F);
445+
auto SpacingMatrix = itk::MakeFilled<MatrixType>(0.0F);
448446

449447
const ImageType::SpacingType & ImageSpacing = image->GetSpacing();
450448
SpacingMatrix(0, 0) = ImageSpacing[0];

Examples/DataRepresentation/Image/Image5.cxx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,7 @@ main(int argc, char * argv[])
117117
size[1] = 200; // size along Y
118118
size[2] = 200; // size along Z
119119

120-
ImportFilterType::IndexType start;
121-
start.Fill(0);
120+
auto start = itk::MakeFilled<ImportFilterType::IndexType>(0);
122121

123122
ImportFilterType::RegionType region;
124123
region.SetIndex(start);

Examples/Filtering/GaussianBlurImageFunction.cxx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,7 @@ main(int argc, char * argv[])
6262
auto gaussianFunction = GFunctionType::New();
6363
gaussianFunction->SetInputImage(inputImage);
6464

65-
GFunctionType::ErrorArrayType setError;
66-
setError.Fill(0.01);
65+
auto setError = itk::MakeFilled<GFunctionType::ErrorArrayType>(0.01);
6766
gaussianFunction->SetMaximumError(setError);
6867
gaussianFunction->SetSigma(std::stod(argv[3]));
6968
gaussianFunction->SetMaximumKernelWidth(std::stoi(argv[4]));

Examples/Filtering/ResampleImageFilter6.cxx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,7 @@ main(int argc, char * argv[])
6969

7070

7171
// Software Guide : BeginCodeSnippet
72-
PixelType defaultValue;
73-
defaultValue.Fill(50);
72+
auto defaultValue = itk::MakeFilled<PixelType>(50);
7473

7574
filter->SetDefaultPixelValue(defaultValue);
7675
// Software Guide : EndCodeSnippet

Examples/Filtering/ResampleImageFilter9.cxx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,7 @@ main(int argc, char * argv[])
9595
linearFilter->SetTransform(transform);
9696

9797
// Software Guide : BeginCodeSnippet
98-
PixelType defaultValue;
99-
defaultValue.Fill(50);
98+
auto defaultValue = itk::MakeFilled<PixelType>(50);
10099
nearestFilter->SetDefaultPixelValue(defaultValue);
101100
linearFilter->SetDefaultPixelValue(defaultValue);
102101
// Software Guide : EndCodeSnippet

Examples/IO/TransformReadWrite.cxx

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,8 @@ main(int argc, char * argv[])
5555
auto composite = CompositeTransformType::New();
5656

5757
using AffineTransformType = itk::AffineTransform<ScalarType, Dimension>;
58-
auto affine = AffineTransformType::New();
59-
AffineTransformType::InputPointType cor;
60-
cor.Fill(12);
58+
auto affine = AffineTransformType::New();
59+
auto cor = itk::MakeFilled<AffineTransformType::InputPointType>(12);
6160
affine->SetCenter(cor);
6261

6362
composite->AddTransform(affine);
@@ -76,10 +75,9 @@ main(int argc, char * argv[])
7675

7776
auto bspline = BSplineTransformType::New();
7877

79-
BSplineTransformType::OriginType origin;
80-
origin.Fill(100);
81-
BSplineTransformType::PhysicalDimensionsType dimensions;
82-
dimensions.Fill(1.5 * 9.0);
78+
auto origin = itk::MakeFilled<BSplineTransformType::OriginType>(100);
79+
auto dimensions =
80+
itk::MakeFilled<BSplineTransformType::PhysicalDimensionsType>(1.5 * 9.0);
8381

8482
bspline->SetTransformDomainOrigin(origin);
8583
bspline->SetTransformDomainPhysicalDimensions(dimensions);

Examples/Iterators/NeighborhoodIterators1.cxx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,7 @@ main(int argc, char ** argv)
118118
// Software Guide : EndLatex
119119

120120
// Software Guide : BeginCodeSnippet
121-
NeighborhoodIteratorType::RadiusType radius;
122-
radius.Fill(1);
121+
auto radius = itk::MakeFilled<NeighborhoodIteratorType::RadiusType>(1);
123122
NeighborhoodIteratorType it(
124123
radius, reader->GetOutput(), reader->GetOutput()->GetRequestedRegion());
125124
// Software Guide : EndCodeSnippet

Examples/Iterators/NeighborhoodIterators5.cxx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,8 +128,8 @@ main(int argc, char ** argv)
128128
// Software Guide : EndLatex
129129

130130
// Software Guide : BeginCodeSnippet
131-
NeighborhoodIteratorType::RadiusType radius;
132-
radius.Fill(gaussianOperator.GetRadius()[0]);
131+
auto radius = itk::MakeFilled<NeighborhoodIteratorType::RadiusType>(
132+
gaussianOperator.GetRadius()[0]);
133133
// Software Guide EndCodeSnippet
134134

135135
// Software Guide : BeginLatex

Examples/Iterators/NeighborhoodIterators6.cxx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -141,8 +141,7 @@ main(int argc, char ** argv)
141141
// Software Guide : EndLatex
142142

143143
// Software Guide : BeginCodeSnippet
144-
NeighborhoodIteratorType::RadiusType radius;
145-
radius.Fill(1);
144+
auto radius = itk::MakeFilled<NeighborhoodIteratorType::RadiusType>(1);
146145
NeighborhoodIteratorType it(radius, input, input->GetRequestedRegion());
147146

148147
it.SetLocation(index);
@@ -164,8 +163,7 @@ main(int argc, char ** argv)
164163
bool flag = true;
165164
while (flag == true)
166165
{
167-
NeighborhoodIteratorType::OffsetType nextMove;
168-
nextMove.Fill(0);
166+
auto nextMove = itk::MakeFilled<NeighborhoodIteratorType::OffsetType>(0);
169167

170168
flag = false;
171169

Examples/Iterators/ShapedNeighborhoodIterators1.cxx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,8 @@ main(int argc, char ** argv)
111111

112112
// Software Guide : BeginCodeSnippet
113113
unsigned int element_radius = std::stoi(argv[3]);
114-
ShapedNeighborhoodIteratorType::RadiusType radius;
115-
radius.Fill(element_radius);
114+
auto radius = itk::MakeFilled<ShapedNeighborhoodIteratorType::RadiusType>(
115+
element_radius);
116116
// Software Guide : EndCodeSnippet
117117

118118
// Software Guide : BeginLatex

0 commit comments

Comments
 (0)