Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace T var; var.Fill with auto var = T::Filled, for both Index and Size #431

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions src/Core/Common/AddOffsetToIndex/Code.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ main()
{
constexpr unsigned int Dimension = 2;

itk::Index<Dimension> index;
index.Fill(5);
auto index = itk::Index<Dimension>::Filled(5);

itk::Offset<Dimension> offset;
offset.Fill(1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,13 @@ main()

using ImageType = itk::Image<PixelType, Dimension>;

ImageType::SizeType smallSize;
smallSize.Fill(10);
auto smallSize = ImageType::SizeType::Filled(10);

ImageType::IndexType index{};

ImageType::RegionType region(index, smallSize);

ImageType::SizeType bigSize;
bigSize.Fill(10000);
auto bigSize = ImageType::SizeType::Filled(10000);

using RandomSourceType = itk::RandomImageSource<ImageType>;
auto randomImageSource = RandomSourceType::New();
Expand Down
3 changes: 1 addition & 2 deletions src/Core/Common/CreateABackwardDifferenceOperator/Code.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@ main()
// Create the operator for the X axis derivative
backwardDifferenceOperator.SetDirection(0);

itk::Size<Dimension> radius;
radius.Fill(1);
auto radius = itk::Size<Dimension>::Filled(1);

backwardDifferenceOperator.CreateToRadius(radius);

Expand Down
6 changes: 2 additions & 4 deletions src/Core/Common/CreateAnImageRegion/Code.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,9 @@ main()
constexpr unsigned int Dimension = 2;

using RegionType = itk::ImageRegion<Dimension>;
RegionType::SizeType size;
size.Fill(3);
auto size = RegionType::SizeType::Filled(3);

RegionType::IndexType index;
index.Fill(1);
auto index = RegionType::IndexType::Filled(1);

RegionType region(index, size);

Expand Down
3 changes: 1 addition & 2 deletions src/Core/Common/CreateAnotherInstanceOfAFilter/Code.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ CreateImage(typename TImage::Pointer image)
using ImageType = TImage;
typename ImageType::IndexType start{};

typename ImageType::SizeType size;
size.Fill(2);
auto size = ImageType::SizeType::Filled(2);

typename ImageType::RegionType region(start, size);

Expand Down
3 changes: 1 addition & 2 deletions src/Core/Common/CreateDerivativeKernel/Code.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ main()
using DerivativeOperatorType = itk::DerivativeOperator<float, 2>;
DerivativeOperatorType derivativeOperator;
derivativeOperator.SetDirection(0); // Create the operator for the X axis derivative
itk::Size<2> radius;
radius.Fill(1);
auto radius = itk::Size<2>::Filled(1);
derivativeOperator.CreateToRadius(radius);

std::cout << "Size: " << derivativeOperator.GetSize() << std::endl;
Expand Down
3 changes: 1 addition & 2 deletions src/Core/Common/CreateForwardDifferenceKernel/Code.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ main()
using ForwardDifferenceOperatorType = itk::ForwardDifferenceOperator<float, 2>;
ForwardDifferenceOperatorType forwardDifferenceOperator;
forwardDifferenceOperator.SetDirection(0); // Create the operator for the X axis derivative
itk::Size<2> radius;
radius.Fill(1);
auto radius = itk::Size<2>::Filled(1);
forwardDifferenceOperator.CreateToRadius(radius);

std::cout << "Size: " << forwardDifferenceOperator.GetSize() << std::endl;
Expand Down
3 changes: 1 addition & 2 deletions src/Core/Common/CreateGaussianDerivativeKernel/Code.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ main()
using GaussianDerivativeOperatorType = itk::GaussianDerivativeOperator<float, 2>;
GaussianDerivativeOperatorType gaussianDerivativeOperator;
gaussianDerivativeOperator.SetDirection(0); // Create the operator for the X axis derivative
itk::Size<2> radius;
radius.Fill(1);
auto radius = itk::Size<2>::Filled(1);
gaussianDerivativeOperator.CreateToRadius(radius);

std::cout << "Size: " << gaussianDerivativeOperator.GetSize() << std::endl;
Expand Down
3 changes: 1 addition & 2 deletions src/Core/Common/CreateGaussianKernel/Code.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ main()
using GaussianOperatorType = itk::GaussianOperator<float, 2>;
GaussianOperatorType gaussianOperator;
gaussianOperator.SetDirection(0); // Create the operator for the X axis derivative
itk::Size<2> radius;
radius.Fill(1);
auto radius = itk::Size<2>::Filled(1);
gaussianOperator.CreateToRadius(radius);

std::cout << "Size: " << gaussianOperator.GetSize() << std::endl;
Expand Down
3 changes: 1 addition & 2 deletions src/Core/Common/CreateLaplacianKernel/Code.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ main()
{
using LaplacianOperatorType = itk::LaplacianOperator<float, 2>;
LaplacianOperatorType laplacianOperator;
itk::Size<2> radius;
radius.Fill(1);
auto radius = itk::Size<2>::Filled(1);
laplacianOperator.CreateToRadius(radius);

std::cout << "Size: " << laplacianOperator.GetSize() << std::endl;
Expand Down
3 changes: 1 addition & 2 deletions src/Core/Common/CreateSobelKernel/Code.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ main()
using SobelOperatorType = itk::SobelOperator<float, 2>;
SobelOperatorType sobelOperator;
sobelOperator.SetDirection(0); // Create the operator for the X axis derivative
itk::Size<2> radius;
radius.Fill(1);
auto radius = itk::Size<2>::Filled(1);
sobelOperator.CreateToRadius(radius);

std::cout << sobelOperator << 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 @@ -25,8 +25,7 @@ main()

ImageType::IndexType start{};

ImageType::SizeType size;
size.Fill(2);
auto size = ImageType::SizeType::Filled(2);

ImageType::RegionType region(start, size);

Expand Down
12 changes: 4 additions & 8 deletions src/Core/Common/CropImageBySpecifyingRegion/Code.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ main()

ImageType::IndexType start{};

ImageType::SizeType size;
size.Fill(10);
auto size = ImageType::SizeType::Filled(10);

ImageType::RegionType region(start, size);

Expand All @@ -39,11 +38,9 @@ main()

std::cout << "Image largest region: " << image->GetLargestPossibleRegion() << std::endl;

ImageType::IndexType desiredStart;
desiredStart.Fill(3);
auto desiredStart = ImageType::IndexType::Filled(3);

ImageType::SizeType desiredSize;
desiredSize.Fill(4);
auto desiredSize = ImageType::SizeType::Filled(4);

ImageType::RegionType desiredRegion(desiredStart, desiredSize);

Expand All @@ -62,8 +59,7 @@ main()
output->DisconnectPipeline();
output->FillBuffer(2);

itk::Index<2> index;
index.Fill(5);
auto index = itk::Index<2>::Filled(5);

std::cout << "new largest region: " << output->GetLargestPossibleRegion() << std::endl;
std::cout << "new: " << (int)output->GetPixel(index) << std::endl;
Expand Down
3 changes: 1 addition & 2 deletions src/Core/Common/DemonstrateAllOperators/Code.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,7 @@ main()
operators.push_back(new AnnulusOperatorType);
operators.push_back(new BackwardDifferenceOperatorType);

itk::Size<2> radius;
radius.Fill(1);
auto radius = itk::Size<2>::Filled(1);

for (auto & operatorId : operators)
{
Expand Down
6 changes: 2 additions & 4 deletions src/Core/Common/DistanceBetweenIndices/Code.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,9 @@
int
main()
{
itk::Index<2> pixel1;
pixel1.Fill(2);
auto pixel1 = itk::Index<2>::Filled(2);

itk::Index<2> pixel2;
pixel2.Fill(4);
auto pixel2 = itk::Index<2>::Filled(4);

itk::Point<double, 2> p1;
p1[0] = pixel1[0];
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 @@ -29,8 +29,7 @@ main()
using SizeType = RegionType::SizeType;
using IndexType = RegionType::IndexType;

SizeType size;
size.Fill(3);
auto size = SizeType::Filled(3);

IndexType start{};

Expand Down
6 changes: 2 additions & 4 deletions src/Core/Common/IterateImageStartingAtSeed/Code.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,7 @@ CreateImage(ImageType::Pointer image)
{
itk::Index<2> start{};

itk::Size<2> size;
size.Fill(100);
auto size = itk::Size<2>::Filled(100);

itk::ImageRegion<2> region(start, size);
image->SetRegions(region);
Expand All @@ -74,8 +73,7 @@ CreateImage(ImageType::Pointer image)
// Make a line
for (unsigned int i = 20; i < 50; ++i)
{
itk::Index<2> pixelIndex;
pixelIndex.Fill(i);
auto pixelIndex = itk::Index<2>::Filled(i);

image->SetPixel(pixelIndex, 255);
}
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 @@ -88,8 +88,7 @@ main(int argc, char * argv[])
void
CreateImage(ImageType::Pointer image)
{
ImageType::SizeType regionSize;
regionSize.Fill(100);
auto regionSize = ImageType::SizeType::Filled(100);

ImageType::IndexType regionIndex{};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,7 @@ main()
void
CreateImage(ImageType::Pointer image)
{
ImageType::SizeType regionSize;
regionSize.Fill(3);
auto regionSize = ImageType::SizeType::Filled(3);

ImageType::IndexType regionIndex{};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,7 @@ main()

ImageType::IndexType start{};

ImageType::SizeType size;
size.Fill(10);
auto size = ImageType::SizeType::Filled(10);

ImageType::RegionType region(start, size);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,7 @@ main()

using IteratorType = itk::ShapedNeighborhoodIterator<ImageType>;

itk::Size<2> radius;
radius.Fill(1);
auto radius = itk::Size<2>::Filled(1);
IteratorType iterator(radius, image, image->GetLargestPossibleRegion());
std::cout << "By default there are " << iterator.GetActiveIndexListSize() << " active indices." << std::endl;

Expand Down Expand Up @@ -87,8 +86,7 @@ CreateImage(ImageType::Pointer image)
{
ImageType::IndexType start{};

ImageType::SizeType size;
size.Fill(10);
auto size = ImageType::SizeType::Filled(10);

ImageType::RegionType region(start, size);

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 @@ -29,8 +29,7 @@ int
main()
{

ImageType::SizeType exclusionRegionSize;
exclusionRegionSize.Fill(2);
auto exclusionRegionSize = ImageType::SizeType::Filled(2);

ImageType::IndexType exclusionRegionIndex{};

Expand Down Expand Up @@ -58,8 +57,7 @@ main()
void
CreateImage(ImageType::Pointer image)
{
ImageType::SizeType regionSize;
regionSize.Fill(3);
auto regionSize = ImageType::SizeType::Filled(3);

ImageType::IndexType regionIndex{};

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 @@ -28,8 +28,7 @@ main()

itk::Index<2> start{};

itk::Size<2> size;
size.Fill(10);
auto size = itk::Size<2>::Filled(10);

itk::ImageRegion<2> region(start, size);

Expand Down
3 changes: 1 addition & 2 deletions src/Core/Common/ObserveAnEvent/Code.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,7 @@ main()
using SourceType = itk::GaussianImageSource<ImageType>;
auto source = SourceType::New();

ImageType::SizeType size;
size.Fill(128);
auto size = ImageType::SizeType::Filled(128);
source->SetSize(size);

SourceType::ArrayType sigma;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ main()
using ImageType = itk::Image<unsigned char, 2>;
auto image = ImageType::New();

ImageType::SizeType regionSize;
regionSize.Fill(3);
auto regionSize = ImageType::SizeType::Filled(3);

ImageType::IndexType regionIndex{};

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 @@ -78,8 +78,7 @@ CreateImage(ImageType::Pointer image)
{
ImageType::IndexType start{};

ImageType::SizeType size;
size.Fill(10);
auto size = ImageType::SizeType::Filled(10);

ImageType::RegionType region;
region.SetSize(size);
Expand Down
5 changes: 2 additions & 3 deletions src/Core/Common/StreamAPipeline/Code.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,8 @@ main(int argc, char * argv[])
using ImageType = itk::Image<PixelType, Dimension>;

using SourceType = itk::RandomImageSource<ImageType>;
auto source = SourceType::New();
ImageType::SizeType size;
size.Fill(numberOfSplits);
auto source = SourceType::New();
auto size = ImageType::SizeType::Filled(numberOfSplits);
source->SetSize(size);

using MonitorFilterType = itk::PipelineMonitorImageFilter<ImageType>;
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 @@ -31,8 +31,7 @@ CreateImage(typename TImage::Pointer image)
typename ImageType::RegionType region;
typename ImageType::IndexType start{};

typename ImageType::SizeType size;
size.Fill(100);
auto size = ImageType::SizeType::Filled(100);

region.SetSize(size);
region.SetIndex(start);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,7 @@ CreateImage(ImageType::Pointer image)
{
ImageType::IndexType start{};

ImageType::SizeType size;
size.Fill(10);
auto size = ImageType::SizeType::Filled(10);

ImageType::RegionType region;
region.SetSize(size);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,7 @@ CreateImage(VectorImageType::Pointer image)
{
VectorImageType::IndexType start{};

VectorImageType::SizeType size;
size.Fill(2);
auto size = VectorImageType::SizeType::Filled(2);

VectorImageType::RegionType region;
region.SetSize(size);
Expand Down
3 changes: 1 addition & 2 deletions src/Core/ImageAdaptors/PresentImageAfterOperation/Code.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,7 @@ CreateImage(VectorImageType::Pointer image)
{
VectorImageType::IndexType start{};

VectorImageType::SizeType size;
size.Fill(2);
auto size = VectorImageType::SizeType::Filled(2);

VectorImageType::RegionType region;
region.SetSize(size);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,7 @@ CreateImage(VectorImageType::Pointer image)
{
VectorImageType::IndexType start{};

VectorImageType::SizeType size;
size.Fill(2);
auto size = VectorImageType::SizeType::Filled(2);

VectorImageType::RegionType region;
region.SetSize(size);
Expand Down
Loading
Loading