Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -254,11 +254,10 @@ itkBSplineInterpolationWeightFunctionTest(int, char *[])

std::cout << "Number Of Weights: " << numberOfWeights << std::endl;

ContinuousIndexType position;
WeightsType weights;
IndexType startIndex;
auto position = itk::MakeFilled<ContinuousIndexType>(4.15);
WeightsType weights;
IndexType startIndex;

position.Fill(4.15);
weights = function->Evaluate(position);

std::cout << "Position: " << position << std::endl;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,8 @@ testMemoryAccess(OptimizerParametersType & params, ImageVectorPointer imageOfVec
int
itkImageVectorOptimizerParametersHelperTest(int, char *[])
{
SizeType size;
constexpr int dimLength{ 3 };
size.Fill(dimLength);
auto size = itk::MakeFilled<SizeType>(dimLength);

const RegionType region{ size };

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,13 +109,10 @@ GaussianInterpolateImageFunction<TImageType, TCoordinate>::EvaluateAtContinuousI

RealType sum_me = 0.0;
RealType sum_m = 0.0;
ArrayType dsum_me;
ArrayType dsum_m;
ArrayType dw;
ArrayType dsum_me{};
ArrayType dsum_m{};
ArrayType dw{};

dsum_m.Fill(0.0);
dsum_me.Fill(0.0);
dw.Fill(0.0);

for (ImageRegionConstIteratorWithIndex It(this->GetInputImage(), region); !It.IsAtEnd(); ++It)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,9 @@ itkCentralDifferenceImageFunctionTest(int, char *[])

function->SetInputImage(image);

ImageType::IndexType index;
auto index = itk::MakeFilled<ImageType::IndexType>(8);

// pick an index inside the image
index.Fill(8);
OutputType indexOutput = function->EvaluateAtIndex(index);
std::cout << "Index: " << index << " Derivative: ";
std::cout << indexOutput << std::endl;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,9 @@ itkGaussianInterpolateImageFunctionTest(int, char *[])
image->SetRegions(region);
image->Allocate();

ImageType::PointType origin;
ImageType::SpacingType spacing;
ImageType::PointType origin{};
auto spacing = itk::MakeFilled<ImageType::SpacingType>(1.0);

origin.Fill(0.0);
spacing.Fill(1.0);

image->SetOrigin(origin);
image->SetSpacing(spacing);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,8 @@ RunLinearInterpolateTest()
auto variablevectorimage = VariableVectorImageType::New();
variablevectorimage->SetVectorLength(VectorDimension);

SizeType size;
constexpr int dimMaxLength{ 3 };
size.Fill(dimMaxLength);
auto size = itk::MakeFilled<SizeType>(dimMaxLength);

const RegionType region{ size };

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,9 @@ itkNearestNeighborInterpolateImageFunctionTest(int, char *[])
variablevectorimage->SetRegions(region);
variablevectorimage->Allocate();

ImageType::PointType origin;
ImageType::SpacingType spacing;
ImageType::PointType origin{};
auto spacing = itk::MakeFilled<ImageType::SpacingType>(1.0);

origin.Fill(0.0);
spacing.Fill(1.0);

image->SetOrigin(origin);
image->SetSpacing(spacing);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,8 @@ ContourSpatialObject<TDimension>::GetOrientationInObjectSpace() const
const ContourPointListType & points = this->GetPoints();
auto it = points.begin();
auto itend = points.end();
PointType minPnt;
PointType maxPnt;
minPnt.Fill(NumericTraits<double>::max());
maxPnt.Fill(NumericTraits<double>::NonpositiveMin());
auto minPnt = MakeFilled<PointType>(NumericTraits<double>::max());
auto maxPnt = MakeFilled<PointType>(NumericTraits<double>::NonpositiveMin());
while (it != itend)
{
PointType curpoint = it->GetPositionInObjectSpace();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,8 @@ PolygonSpatialObject<TDimension>::GetOrientationInObjectSpace() const
const PolygonPointListType & points = this->GetPoints();
auto it = points.begin();
auto itend = points.end();
PointType minPnt;
PointType maxPnt;
minPnt.Fill(NumericTraits<double>::max());
maxPnt.Fill(NumericTraits<double>::NonpositiveMin());
auto minPnt = MakeFilled<PointType>(NumericTraits<double>::max());
auto maxPnt = MakeFilled<PointType>(NumericTraits<double>::NonpositiveMin());
while (it != itend)
{
PointType curpoint = it->GetPositionInObjectSpace();
Expand Down
5 changes: 2 additions & 3 deletions Modules/Core/Transform/include/itkKernelTransform.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -318,11 +318,10 @@ auto
KernelTransform<TParametersValueType, VDimension>::TransformPoint(const InputPointType & thisPoint) const
-> OutputPointType
{
OutputPointType result;

using ValueType = typename OutputPointType::ValueType;

result.Fill(ValueType{});
auto result = MakeFilled<OutputPointType>(ValueType{});


// TODO: It is unclear if the following line is needed.
this->ComputeDeformationContribution(thisPoint, result);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,11 +152,10 @@ itkBSplineDeformableTransformTest1()
*/
using PointType = TransformType::InputPointType;

PointType inputPoint;
auto inputPoint = itk::MakeFilled<PointType>(9.0);
PointType outputPoint;

// point within the grid support region
inputPoint.Fill(9.0);
outputPoint = transform->TransformPoint(inputPoint);

std::cout << "Input Point: " << inputPoint << std::endl;
Expand Down
3 changes: 1 addition & 2 deletions Modules/Core/Transform/test/itkBSplineTransformTest.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -177,11 +177,10 @@ itkBSplineTransformTest1()
*/
using PointType = TransformType::InputPointType;

PointType inputPoint;
auto inputPoint = itk::MakeFilled<PointType>(9.0);
PointType outputPoint;

// point within the grid support region
inputPoint.Fill(9.0);
outputPoint = transform->TransformPoint(inputPoint);

std::cout << "Input Point: " << inputPoint << std::endl;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,11 +181,9 @@ template <typename TInputImage, typename TOutputImage>
auto
PatchBasedDenoisingBaseImageFilter<TInputImage, TOutputImage>::GetPatchDiameterInVoxels() const -> PatchRadiusType
{
PatchRadiusType one;
PatchRadiusType two;
auto one = MakeFilled<PatchRadiusType>(1);
auto two = MakeFilled<PatchRadiusType>(2);

one.Fill(1);
two.Fill(2);
const PatchRadiusType radius = this->GetPatchRadiusInVoxels();
const PatchRadiusType diameter = two * radius + one;
return diameter;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,12 @@ itkComposeDisplacementFieldsImageFilterTest(int, char *[])
using DisplacementFieldType = itk::Image<VectorType, ImageDimension>;

// Create a displacement field
DisplacementFieldType::PointType origin;
DisplacementFieldType::SpacingType spacing;
DisplacementFieldType::SizeType size;
DisplacementFieldType::PointType origin{};
auto spacing = itk::MakeFilled<DisplacementFieldType::SpacingType>(0.5);
auto size = itk::MakeFilled<DisplacementFieldType::SizeType>(100);
DisplacementFieldType::DirectionType direction;

direction.SetIdentity();
origin.Fill(0.0);
spacing.Fill(0.5);
size.Fill(100);

auto ones = itk::MakeFilled<VectorType>(1);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,12 @@ itkDisplacementFieldToBSplineImageFilterTest(int, char *[])
using PointSetType = itk::PointSet<VectorType, ImageDimension>;

// Create a displacement field
DisplacementFieldType::PointType origin;
DisplacementFieldType::SpacingType spacing;
DisplacementFieldType::SizeType size;
DisplacementFieldType::PointType origin{};
auto spacing = itk::MakeFilled<DisplacementFieldType::SpacingType>(0.5);
auto size = itk::MakeFilled<DisplacementFieldType::SizeType>(100);
DisplacementFieldType::DirectionType direction;

direction.SetIdentity();
origin.Fill(0.0);
spacing.Fill(0.5);
size.Fill(100);

auto ones = itk::MakeFilled<VectorType>(1);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,12 @@ itkInvertDisplacementFieldImageFilterTest(int argc, char * argv[])
using DisplacementFieldType = itk::Image<VectorType, ImageDimension>;

// Create a displacement field
DisplacementFieldType::PointType origin;
DisplacementFieldType::SpacingType spacing;
DisplacementFieldType::SizeType size;
DisplacementFieldType::PointType origin{};
auto spacing = itk::MakeFilled<DisplacementFieldType::SpacingType>(0.5);
auto size = itk::MakeFilled<DisplacementFieldType::SizeType>(100);
DisplacementFieldType::DirectionType direction;

direction.SetIdentity();
origin.Fill(0.0);
spacing.Fill(0.5);
size.Fill(100);

auto ones = itk::MakeFilled<VectorType>(1);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,13 +91,12 @@ itkTimeVaryingBSplineVelocityFieldTransformTest(int, char *[])

// Now test the transform

TimeVaryingVelocityFieldType::PointType timeVaryingVelocityFieldOrigin;
TimeVaryingVelocityFieldType::SpacingType timeVaryingVelocityFieldSpacing;
TimeVaryingVelocityFieldType::PointType timeVaryingVelocityFieldOrigin;
auto timeVaryingVelocityFieldSpacing = itk::MakeFilled<TimeVaryingVelocityFieldType::SpacingType>(1.0);
TimeVaryingVelocityFieldType::SizeType timeVaryingVelocityFieldSize;
TimeVaryingVelocityFieldType::DirectionType timeVaryingVelocityFieldDirection;

timeVaryingVelocityFieldDirection.SetIdentity();
timeVaryingVelocityFieldSpacing.Fill(1.0);
for (unsigned int d = 0; d < 4; ++d)
{
const float physicalDimensions = (size[d] - splineOrder) * spacing[d];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,9 @@ TEST(ContourMeanDistanceImageFilter, Test)
using RegionType = Image1Type::RegionType;

using IndexType = Image1Type::IndexType;
IndexType index;
auto index = itk::MakeFilled<IndexType>(10);

size.Fill(20);
index.Fill(10);
RegionType region1 = { index, size };

size.Fill(15);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -200,10 +200,8 @@ itkGradientRecursiveGaussianFilterTest3(int argc, char * argv[])
using myImageVector1DType = itk::Image<myVector1DType, myDimension>;

myGradImage1DType::Pointer vector1DGradImage = nullptr;
myVector1DType vector1Dborder;
myVector1DType vector1Dfill;
vector1Dborder.Fill(0.0);
vector1Dfill.Fill(100.0);
myVector1DType vector1Dborder{};
auto vector1Dfill = itk::MakeFilled<myVector1DType>(100.0);
int runResult = itkGradientRecursiveGaussianFilterTest3Run<myImageVector1DType, myGradImage1DType, myComponents1D>(
vector1Dborder, vector1Dfill, vector1DGradImage, argv[1]);
if (runResult == EXIT_FAILURE)
Expand Down Expand Up @@ -237,9 +235,8 @@ itkGradientRecursiveGaussianFilterTest3(int argc, char * argv[])
using myImageVar2DType = itk::Image<myVarVector2DType, myDimension>;

myGradImage2DType::Pointer vector2DGradImage = nullptr;
myVector2DType vector2Dborder;
auto vector2Dborder = itk::MakeFilled<myVector2DType>(pixelBorder);
myVector2DType vector2Dfill;
vector2Dborder.Fill(pixelBorder);
vector2Dfill[0] = pixelFill;
vector2Dfill[1] = pixelFill / 2.0;
runResult = itkGradientRecursiveGaussianFilterTest3Run<myImage2DType, myGradImage2DType, myComponents2D>(
Expand Down Expand Up @@ -295,9 +292,8 @@ itkGradientRecursiveGaussianFilterTest3(int argc, char * argv[])
using myImage3DType = itk::Image<myVector3DType, myDimension>;

myGradImage3DType::Pointer vector3DGradImage = nullptr;
myVector3DType vector3Dborder;
auto vector3Dborder = itk::MakeFilled<myVector3DType>(pixelBorder);
myVector3DType vector3Dfill;
vector3Dborder.Fill(pixelBorder);
vector3Dfill[0] = pixelFill;
vector3Dfill[1] = pixelFill / 2.0;
vector3Dfill[2] = pixelFill / 3.0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,10 @@ itkBSplineControlPointImageFunctionTest(int, char *[])

auto phiLattice = VectorImageType::New();

VectorImageType::SizeType size;
VectorImageType::SpacingType spacing;
VectorImageType::PointType origin;
auto size = itk::MakeFilled<VectorImageType::SizeType>(4);
auto spacing = itk::MakeFilled<VectorImageType::SpacingType>(1.0);
VectorImageType::PointType origin{};

size.Fill(4);
spacing.Fill(1.0);
origin.Fill(0.0);
phiLattice->SetOrigin(origin);
phiLattice->SetSpacing(spacing);
phiLattice->SetRegions(size);
Expand All @@ -50,10 +47,8 @@ itkBSplineControlPointImageFunctionTest(int, char *[])
// To create the specified function, the first and last control points have
// a value of 1.0;

VectorImageType::IndexType index;
VectorImageType::PixelType value;
index.Fill(0);
value.Fill(1.0);
VectorImageType::IndexType index{};
auto value = itk::MakeFilled<VectorImageType::PixelType>(1.0);
phiLattice->SetPixel(index, value);
index.Fill(3);
value.Fill(1.0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,9 @@ itkBSplineScatteredDataPointSetToImageFilterTest3(int argc, char * argv[])
ITK_EXERCISE_BASIC_OBJECT_METHODS(filter, BSplineScatteredDataPointSetToImageFilter, PointSetToImageFilter);

// Define the parametric domain
auto spacing = itk::MakeFilled<ImageType::SpacingType>(0.001);
ImageType::SizeType size;
auto spacing = itk::MakeFilled<ImageType::SpacingType>(0.001);
auto size = itk::MakeFilled<ImageType::SizeType>(static_cast<unsigned int>(1.0 / spacing[0] + .5) + 1);
// Adding 0.5 to avoid rounding errors
size.Fill(static_cast<unsigned int>(1.0 / spacing[0] + .5) + 1);
constexpr ImageType::PointType origin{};

filter->SetSize(size);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,12 @@ itkFlatStructuringElementTest(int, char *[])
k2 = SE2Type::Polygon(r2, 5);

using SE3Type = itk::FlatStructuringElement<3>;
SE3Type::RadiusType r3;
auto r3 = itk::MakeFilled<SE3Type::RadiusType>(scalarRadius);

SE3Type::Self result3{};
result3.RadiusIsParametricOff();
ITK_TEST_SET_GET_VALUE(false, result3.GetRadiusIsParametric());

r3.Fill(scalarRadius);
SE3Type k3;

k3 = SE3Type::Box(r3);
Expand Down Expand Up @@ -130,13 +129,12 @@ itkFlatStructuringElementTest(int, char *[])
}

using SE4Type = itk::FlatStructuringElement<4>;
SE4Type::RadiusType r4;
auto r4 = itk::MakeFilled<SE4Type::RadiusType>(scalarRadius);

SE4Type::Self result4{};
result4.RadiusIsParametricOn();
ITK_TEST_SET_GET_VALUE(true, result4.GetRadiusIsParametric());

r4.Fill(scalarRadius);
SE4Type k4;

k4 = SE4Type::Box(r4);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,8 @@ ChainCodeToFourierSeriesPathFilter<TInputChainCodePath, TOutputFourierSeriesPath
for (unsigned int n = 0; n < numHarmonics; ++n)
{
auto index = inputPtr->GetStart();
VectorType cosCoefficient;
cosCoefficient.Fill(0.0);
VectorType sinCoefficient;
sinCoefficient.Fill(0.0);
VectorType cosCoefficient{};
VectorType sinCoefficient{};

for (InputPathInputType step = 0; step < numSteps; ++step)
{
Expand Down
Loading
Loading