Skip to content

Commit

Permalink
Merge pull request #428 from N-Dekker/Replace-Fill-zero
Browse files Browse the repository at this point in the history
STYLE: Replace `Fill(0)` on local variables with `{}` initialization
  • Loading branch information
jhlegarreta authored Nov 8, 2024
2 parents 1525fe0 + f5ca3d3 commit e8f8369
Show file tree
Hide file tree
Showing 90 changed files with 114 additions and 227 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@ main()
ImageType::SizeType smallSize;
smallSize.Fill(10);

ImageType::IndexType index;
index.Fill(0);
ImageType::IndexType index{};

ImageType::RegionType region(index, smallSize);

Expand Down
3 changes: 1 addition & 2 deletions src/Core/Common/ConvertArrayToImage/Code.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,7 @@ main()
size[1] = 200; // size along Y
size[2] = 200; // size along Z

ImportFilterType::IndexType start;
start.Fill(0);
ImportFilterType::IndexType start{};

ImportFilterType::RegionType region;
region.SetIndex(start);
Expand Down
6 changes: 2 additions & 4 deletions src/Core/Common/CreateAnotherInstanceOfAFilter/Code.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ void
CreateImage(typename TImage::Pointer image)
{
using ImageType = TImage;
typename ImageType::IndexType start;
start.Fill(0);
typename ImageType::IndexType start{};

typename ImageType::SizeType size;
size.Fill(2);
Expand Down Expand Up @@ -55,8 +54,7 @@ main()
filter2->SetInput(image);
filter2->Update();

itk::Index<Dimension> index;
index.Fill(0);
itk::Index<Dimension> index{};

std::cout << filter2->GetOutput()->GetPixel(index) << std::endl;

Expand Down
3 changes: 1 addition & 2 deletions src/Core/Common/CreateVectorImage/Code.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ main()
// Create an image
using ImageType = itk::VectorImage<float, 2>;

ImageType::IndexType start;
start.Fill(0);
ImageType::IndexType start{};

ImageType::SizeType size;
size.Fill(2);
Expand Down
3 changes: 1 addition & 2 deletions src/Core/Common/CropImageBySpecifyingRegion/Code.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ main()
{
using ImageType = itk::Image<unsigned char, 2>;

ImageType::IndexType start;
start.Fill(0);
ImageType::IndexType start{};

ImageType::SizeType size;
size.Fill(10);
Expand Down
12 changes: 4 additions & 8 deletions src/Core/Common/ImageRegionOverlap/Code.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -88,19 +88,15 @@ main(int argc, char * argv[])
regionC.Crop(regionB);
regionC.PadByRadius(10);

RGBPixelType pix_black;
pix_black.Fill(0);
RGBPixelType pix_black{};

RGBPixelType pix_red;
pix_red.Fill(0);
RGBPixelType pix_red{};
pix_red[0] = 255;

RGBPixelType pix_green;
pix_green.Fill(0);
RGBPixelType pix_green{};
pix_green[1] = 255;

RGBPixelType pix_blue;
pix_blue.Fill(0);
RGBPixelType pix_blue{};
pix_blue[2] = 255;

// A black canvas
Expand Down
3 changes: 1 addition & 2 deletions src/Core/Common/ImportPixelBufferIntoAnImage/Code.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,7 @@ main(int argc, char * argv[])
size[0] = 200; // size along X
size[1] = 200; // size along Y

ImportFilterType::IndexType start;
start.Fill(0);
ImportFilterType::IndexType start{};

ImportFilterType::RegionType region;
region.SetIndex(start);
Expand Down
3 changes: 1 addition & 2 deletions src/Core/Common/IsPixelInsideRegion/Code.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@ main()
SizeType size;
size.Fill(3);

IndexType start;
start.Fill(0);
IndexType start{};

RegionType region(start, size);

Expand Down
3 changes: 1 addition & 2 deletions src/Core/Common/IterateImageStartingAtSeed/Code.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,7 @@ main(int /*argc*/, char * /*argv*/[])
void
CreateImage(ImageType::Pointer image)
{
itk::Index<2> start;
start.Fill(0);
itk::Index<2> start{};

itk::Size<2> size;
size.Fill(100);
Expand Down
3 changes: 1 addition & 2 deletions src/Core/Common/IterateLineThroughImage/Code.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,7 @@ CreateImage(ImageType::Pointer image)
ImageType::SizeType regionSize;
regionSize.Fill(100);

ImageType::IndexType regionIndex;
regionIndex.Fill(0);
ImageType::IndexType regionIndex{};

ImageType::RegionType region;
region.SetSize(regionSize);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,7 @@ CreateImage(ImageType::Pointer image)
ImageType::SizeType regionSize;
regionSize.Fill(3);

ImageType::IndexType regionIndex;
regionIndex.Fill(0);
ImageType::IndexType regionIndex{};

ImageType::RegionType region;
region.SetSize(regionSize);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,7 @@ main()

auto image = ImageType::New();

ImageType::IndexType start;
start.Fill(0);
ImageType::IndexType start{};

ImageType::SizeType size;
size.Fill(10);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,7 @@ main()
void
CreateImage(ImageType::Pointer image)
{
ImageType::IndexType start;
start.Fill(0);
ImageType::IndexType start{};

ImageType::SizeType size;
size.Fill(10);
Expand Down
6 changes: 2 additions & 4 deletions src/Core/Common/IterateOverSpecificRegion/Code.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@ main()
ImageType::SizeType exclusionRegionSize;
exclusionRegionSize.Fill(2);

ImageType::IndexType exclusionRegionIndex;
exclusionRegionIndex.Fill(0);
ImageType::IndexType exclusionRegionIndex{};

ImageType::RegionType exclusionRegion(exclusionRegionIndex, exclusionRegionSize);

Expand Down Expand Up @@ -62,8 +61,7 @@ CreateImage(ImageType::Pointer image)
ImageType::SizeType regionSize;
regionSize.Fill(3);

ImageType::IndexType regionIndex;
regionIndex.Fill(0);
ImageType::IndexType regionIndex{};

ImageType::RegionType region(regionIndex, regionSize);

Expand Down
3 changes: 1 addition & 2 deletions src/Core/Common/NeighborhoodIteratorOnVectorImage/Code.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ main()
// Create an image
auto image = VectorImageType::New();

itk::Index<2> start;
start.Fill(0);
itk::Index<2> start{};

itk::Size<2> size;
size.Fill(10);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ main()
ImageType::SizeType regionSize;
regionSize.Fill(3);

ImageType::IndexType regionIndex;
regionIndex.Fill(0);
ImageType::IndexType regionIndex{};

ImageType::RegionType region(regionIndex, regionSize);

Expand Down
3 changes: 1 addition & 2 deletions src/Core/Common/SetPixelValueInOneImage/Code.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,7 @@ main(int argc, char * argv[])

ImageType::RegionType region;

ImageType::IndexType start;
start.Fill(0);
ImageType::IndexType start{};

region.SetIndex(start);

Expand Down
3 changes: 1 addition & 2 deletions src/Core/Common/StoreNonPixelDataInImage/Code.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,7 @@ main()
void
CreateImage(ImageType::Pointer image)
{
ImageType::IndexType start;
start.Fill(0);
ImageType::IndexType start{};

ImageType::SizeType size;
size.Fill(10);
Expand Down
3 changes: 1 addition & 2 deletions src/Core/Common/WatchAFilter/Code.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@ CreateImage(typename TImage::Pointer image)

// Create an image with 2 connected components
typename ImageType::RegionType region;
typename ImageType::IndexType start;
start.Fill(0);
typename ImageType::IndexType start{};

typename ImageType::SizeType size;
size.Fill(100);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,7 @@ main()
void
CreateImage(ImageType::Pointer image)
{
ImageType::IndexType start;
start.Fill(0);
ImageType::IndexType start{};

ImageType::SizeType size;
size.Fill(10);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@ main()
auto image = VectorImageType::New();
CreateImage(image);

itk::Index<2> index;
index.Fill(0);
itk::Index<2> index{};

std::cout << image->GetPixel(index) << std::endl;

Expand All @@ -50,8 +49,7 @@ main()
void
CreateImage(VectorImageType::Pointer image)
{
VectorImageType::IndexType start;
start.Fill(0);
VectorImageType::IndexType start{};

VectorImageType::SizeType size;
size.Fill(2);
Expand Down
6 changes: 2 additions & 4 deletions src/Core/ImageAdaptors/PresentImageAfterOperation/Code.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,7 @@ main()
auto image = VectorImageType::New();
CreateImage(image);

itk::Index<2> index;
index.Fill(0);
itk::Index<2> index{};

std::cout << image->GetPixel(index) << std::endl;

Expand All @@ -79,8 +78,7 @@ main()
void
CreateImage(VectorImageType::Pointer image)
{
VectorImageType::IndexType start;
start.Fill(0);
VectorImageType::IndexType start{};

VectorImageType::SizeType size;
size.Fill(2);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,7 @@ main()
void
CreateImage(VectorImageType::Pointer image)
{
VectorImageType::IndexType start;
start.Fill(0);
VectorImageType::IndexType start{};

VectorImageType::SizeType size;
size.Fill(2);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,7 @@ main()
void
CreateImage(VectorImageType::Pointer image)
{
VectorImageType::IndexType start;
start.Fill(0);
VectorImageType::IndexType start{};

VectorImageType::SizeType size;
size.Fill(2);
Expand Down
3 changes: 1 addition & 2 deletions src/Core/ImageFunction/ComputeMedianOfImageAtPixel/Code.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,7 @@ main()
void
CreateImage(UnsignedCharImageType::Pointer image)
{
itk::Index<2> start;
start.Fill(0);
itk::Index<2> start{};

itk::Size<2> size;
size.Fill(100);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,7 @@ void
CreateImage(UnsignedCharImageType::Pointer image)
{
// Create an image with 2 connected components
UnsignedCharImageType::IndexType start;
start.Fill(0);
UnsignedCharImageType::IndexType start{};

UnsignedCharImageType::SizeType size;
size.Fill(100);
Expand Down
3 changes: 1 addition & 2 deletions src/Core/Transform/TranslateAVectorImage/Code.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@ main()
using VectorImageType = itk::Image<VectorType, 2>;

auto image = VectorImageType::New();
itk::Index<2> start;
start.Fill(0);
itk::Index<2> start{};

itk::Size<2> size;
size.Fill(10);
Expand Down
3 changes: 1 addition & 2 deletions src/Developer/ImageFilterMultipleOutputsDifferentType.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ template <typename TInputImage, typename TOutputImage1, typename TOutputImage2>
void
ImageFilterMultipleOutputsDifferentType<TInputImage, TOutputImage1, TOutputImage2>::GenerateData()
{
itk::Index<2> start;
start.Fill(0);
itk::Index<2> start{};

itk::Size<2> size;
size.Fill(20);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,7 @@ void
CreateImage(ImageType::Pointer image)
{
// Create an image
ImageType::IndexType start;
start.Fill(0);
ImageType::IndexType start{};

ImageType::SizeType size;
size.Fill(100);
Expand Down
3 changes: 1 addition & 2 deletions src/Filtering/Convolution/ConvolveImageWithKernel/Code.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,7 @@ main(int argc, char * argv[])
void
CreateKernel(ImageType::Pointer kernel, unsigned int width)
{
ImageType::IndexType start;
start.Fill(0);
ImageType::IndexType start{};

ImageType::SizeType size;
size.Fill(width);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,7 @@ main()
void
CreateMask(MaskType * const mask)
{
ImageType::IndexType start;
start.Fill(0);
ImageType::IndexType start{};

ImageType::SizeType size;
size.Fill(51);
Expand Down Expand Up @@ -161,8 +160,7 @@ CreateMask(MaskType * const mask)
void
CreateImage(ImageType * const image)
{
ImageType::IndexType start;
start.Fill(0);
ImageType::IndexType start{};

ImageType::SizeType size;
size.Fill(51);
Expand All @@ -177,8 +175,7 @@ CreateImage(ImageType * const image)
void
CreateImageOfSquare(ImageType * const image, const itk::Index<2> & cornerOfSquare)
{
ImageType::IndexType start;
start.Fill(0);
ImageType::IndexType start{};

ImageType::SizeType size;
size.Fill(51);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,7 @@ main()
void
CreateImage(ImageType::Pointer image, const itk::Index<2> & cornerOfSquare)
{
ImageType::IndexType start;
start.Fill(0);
ImageType::IndexType start{};

ImageType::SizeType size;
size.Fill(51);
Expand Down
Loading

0 comments on commit e8f8369

Please sign in to comment.