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
3 changes: 1 addition & 2 deletions Modules/Core/Common/test/itkAdaptorComparisonTest.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -204,8 +204,7 @@ itkAdaptorComparisonTest(int, char *[])
vector_image->SetRegions(region);
vector_image->Allocate();

VectorImageType::PixelType initialVectorValue;
initialVectorValue.Fill(1.2345); // arbitrary value;
auto initialVectorValue = itk::MakeFilled<VectorImageType::PixelType>(1.2345); // arbitrary value;
vector_image->FillBuffer(initialVectorValue);

// Time trials
Expand Down
9 changes: 4 additions & 5 deletions Modules/Core/Common/test/itkAggregateTypesGTest.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -287,11 +287,10 @@ class CommonIndexOffsetMathOps

//============ Test Copy with Round/Cast Type ====================================
{
AggregateType known3s{ { 3, 3, 3, 3 } };
AggregateType threes{};
AggregateType known4s{ { 4, 4, 4, 4 } };
itk::Point<double, 4> p1;
p1.Fill(3.5);
AggregateType known3s{ { 3, 3, 3, 3 } };
AggregateType threes{};
AggregateType known4s{ { 4, 4, 4, 4 } };
auto p1 = itk::MakeFilled<itk::Point<double, 4>>(3.5);
threes.CopyWithRound(p1);
ITK_EXPECT_VECTOR_NEAR(threes, known4s, 0);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,12 @@ itkConicShellInteriorExteriorSpatialFunctionTest(int, char *[])
InteriorExteriorSpatialFunction);

// Set the conic shell properties
ConicShellInteriorExteriorSpatialFunctionType::InputType origin;
origin.Fill(1.0);
auto origin = itk::MakeFilled<ConicShellInteriorExteriorSpatialFunctionType::InputType>(1.0);

conicShellInteriorExteriorSpatialFunction->SetOrigin(origin);
ITK_TEST_SET_GET_VALUE(origin, conicShellInteriorExteriorSpatialFunction->GetOrigin());

ConicShellInteriorExteriorSpatialFunctionType::GradientType originGradient;
originGradient.Fill(1.6);
auto originGradient = itk::MakeFilled<ConicShellInteriorExteriorSpatialFunctionType::GradientType>(1.6);
originGradient.GetVnlVector().normalize();
conicShellInteriorExteriorSpatialFunction->SetOriginGradient(originGradient);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,8 +192,7 @@ itkConstNeighborhoodIteratorTest(int, char *[])
printnb<itk::ConstNeighborhoodIterator<TestImageType>>(ra_it, false);

println("Adding [1, 1, 1, 1]");
OffsetType a_off;
a_off.Fill(1);
auto a_off = itk::MakeFilled<OffsetType>(1);
ra_it += a_off;
printnb<itk::ConstNeighborhoodIterator<TestImageType>>(ra_it, false);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -241,8 +241,7 @@ itkConstNeighborhoodIteratorWithOnlyIndexTestRun()
ra_it.SetLocation(loc);

std::cout << "Adding [1, 1, 1, 1]" << std::endl;
OffsetType a_off;
a_off.Fill(1);
auto a_off = itk::MakeFilled<OffsetType>(1);
ra_it += a_off;
for (unsigned int i = 0; i < 4; ++i)
{
Expand Down
3 changes: 1 addition & 2 deletions Modules/Core/Common/test/itkFrustumSpatialFunctionTest.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,7 @@ itkFrustumSpatialFunctionTest(int, char *[])
ITK_EXERCISE_BASIC_OBJECT_METHODS(frustrumSpatialFunction, FrustumSpatialFunction, InteriorExteriorSpatialFunction);

// Set the frustum properties
FrustumSpatialFunctionType::InputType apex;
apex.Fill(1.1);
auto apex = itk::MakeFilled<FrustumSpatialFunctionType::InputType>(1.1);

frustrumSpatialFunction->SetApex(apex);
ITK_TEST_SET_GET_VALUE(apex, frustrumSpatialFunction->GetApex());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,7 @@ ComputeOffset(TImage * image, unsigned int count, unsigned int repeat)
typename TImage::OffsetValueType offset = 0;
typename TImage::OffsetValueType accum = 0;
typename TImage::IndexType index;
typename TImage::OffsetType indexIncr;
indexIncr.Fill(1);
auto indexIncr = itk::MakeFilled<typename TImage::OffsetType>(1);

for (unsigned int j = 0; j < repeat; ++j)
{
Expand All @@ -86,8 +85,7 @@ ComputeFastOffset(TImage * image, unsigned int count, unsigned int repeat)
typename TImage::OffsetValueType offset = 0;
typename TImage::OffsetValueType accum = 0;
typename TImage::IndexType index;
typename TImage::OffsetType indexIncr;
indexIncr.Fill(1);
auto indexIncr = itk::MakeFilled<typename TImage::OffsetType>(1);

const typename TImage::OffsetValueType * offsetTable = image->GetOffsetTable();

Expand Down
3 changes: 1 addition & 2 deletions Modules/Core/Common/test/itkImageIteratorTest.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,7 @@ itkImageIteratorTest(int, char *[])
o3->SetSpacing(spacing3D);

o3->Allocate();
itk::Vector<unsigned short, 5> fillValue;
fillValue.Fill(itk::NumericTraits<unsigned short>::max());
auto fillValue = itk::MakeFilled<itk::Vector<unsigned short, 5>>(itk::NumericTraits<unsigned short>::max());
o3->FillBuffer(fillValue);

std::cout << "Setting/Getting a pixel" << std::endl;
Expand Down
24 changes: 8 additions & 16 deletions Modules/Core/Common/test/itkImageIteratorWithIndexTest.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -264,8 +264,7 @@ itkImageIteratorWithIndexTest(int, char *[])

std::cout << "Testing with Image< itk::Vector<char,4>, 3 > " << std::endl;
using VC = itk::Vector<char, 4>;
VC vc;
vc.Fill(127);
auto vc = itk::MakeFilled<VC>(127);
itkImageIteratorWithIndexTestIteratorTester<VC> TesterVC(vc);
if (TesterVC.TestIterator() == false)
{
Expand All @@ -282,8 +281,7 @@ itkImageIteratorWithIndexTest(int, char *[])

std::cout << "Testing with Image< itk::Vector<unsigned char,4>, 3 > " << std::endl;
using VUC = itk::Vector<unsigned char, 4>;
VUC vuc;
vuc.Fill(10);
auto vuc = itk::MakeFilled<VUC>(10);
itkImageIteratorWithIndexTestIteratorTester<VUC> TesterVUC(vuc);
if (TesterVUC.TestIterator() == false)
{
Expand All @@ -300,8 +298,7 @@ itkImageIteratorWithIndexTest(int, char *[])

std::cout << "Testing with Image< itk::Vector<short,4>, 3 > " << std::endl;
using VS = itk::Vector<short, 4>;
VS vs;
vs.Fill(10);
auto vs = itk::MakeFilled<VS>(10);
itkImageIteratorWithIndexTestIteratorTester<VS> TesterVS(vs);
if (TesterVS.TestIterator() == false)
{
Expand All @@ -318,8 +315,7 @@ itkImageIteratorWithIndexTest(int, char *[])

std::cout << "Testing with Image< itk::Vector<unsigned short,4>, 3 > " << std::endl;
using VUS = itk::Vector<unsigned short, 4>;
VUS vus;
vus.Fill(10);
auto vus = itk::MakeFilled<VUS>(10);
itkImageIteratorWithIndexTestIteratorTester<VUS> TesterVUS(vus);
if (TesterVUS.TestIterator() == false)
{
Expand All @@ -336,8 +332,7 @@ itkImageIteratorWithIndexTest(int, char *[])

std::cout << "Testing with Image< itk::Vector<int,4>, 3 > " << std::endl;
using VI = itk::Vector<int, 4>;
VI vi;
vi.Fill(10);
auto vi = itk::MakeFilled<VI>(10);
itkImageIteratorWithIndexTestIteratorTester<VI> TesterVI(vi);
if (TesterVI.TestIterator() == false)
{
Expand All @@ -354,8 +349,7 @@ itkImageIteratorWithIndexTest(int, char *[])

std::cout << "Testing with Image< itk::Vector<unsigned int,4>, 3 > " << std::endl;
using VUI = itk::Vector<unsigned int, 4>;
VUI vui;
vui.Fill(10);
auto vui = itk::MakeFilled<VUI>(10);
itkImageIteratorWithIndexTestIteratorTester<VUI> TesterVUI(vui);
if (TesterVUI.TestIterator() == false)
{
Expand All @@ -372,8 +366,7 @@ itkImageIteratorWithIndexTest(int, char *[])

std::cout << "Testing with Image< itk::Vector<float,4>, 3 > " << std::endl;
using VF = itk::Vector<float, 4>;
VF vf;
vf.Fill(10);
auto vf = itk::MakeFilled<VF>(10);
itkImageIteratorWithIndexTestIteratorTester<VF> TesterVF(vf);
if (TesterVF.TestIterator() == false)
{
Expand All @@ -390,8 +383,7 @@ itkImageIteratorWithIndexTest(int, char *[])

std::cout << "Testing with Image< itk::Vector<double,4>, 3 > " << std::endl;
using VD = itk::Vector<double, 4>;
VD vd;
vd.Fill(10);
auto vd = itk::MakeFilled<VD>(10);
itkImageIteratorWithIndexTestIteratorTester<VD> TesterVD(vd);
if (TesterVD.TestIterator() == false)
{
Expand Down
16 changes: 6 additions & 10 deletions Modules/Core/Common/test/itkImageTest.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,8 @@ itkImageTest(int, char *[])
image->GetSource();
image->DisconnectPipeline();

Image::SpacingType spacing;
spacing.Fill(1.0);
Image::PointType origin;
origin.Fill(1.0);
auto spacing = itk::MakeFilled<Image::SpacingType>(1.0);
auto origin = itk::MakeFilled<Image::PointType>(1.0);
Image::DirectionType direction;
direction[0][0] = .5;
direction[0][1] = .7;
Expand Down Expand Up @@ -127,9 +125,8 @@ itkImageTest(int, char *[])
region.SetSize(size);
image->SetRegions(region);

auto imageRef = Image::New();
Image::SpacingType spacingRef;
spacingRef.Fill(2);
auto imageRef = Image::New();
auto spacingRef = itk::MakeFilled<Image::SpacingType>(2);
Image::PointType originRef{};
Image::DirectionType directionRef;
directionRef.SetIdentity();
Expand Down Expand Up @@ -161,9 +158,8 @@ itkImageTest(int, char *[])
}

using Image3D = itk::Image<float, 3>;
auto volume = Image3D::New();
Image3D::SpacingType spacingVol;
spacingVol.Fill(1);
auto volume = Image3D::New();
auto spacingVol = itk::MakeFilled<Image3D::SpacingType>(1);
Image3D::PointType originVol{};
Image3D::DirectionType directionVol;
directionVol.SetIdentity();
Expand Down
6 changes: 2 additions & 4 deletions Modules/Core/Common/test/itkMatrixTest.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,7 @@ itkMatrixTest(int, char *[])
MatrixType matrix4;
matrix4 = matrix.GetTranspose();

MatrixType matrix5;
matrix5.Fill(1.7);
auto matrix5 = itk::MakeFilled<MatrixType>(1.7);

constexpr NumericType value = 2;
matrix5[1][1] = value;
Expand Down Expand Up @@ -332,8 +331,7 @@ itkMatrixTest(int, char *[])
}

using LargeMatrixType = itk::Matrix<NumericType, 7, 7>;
LargeMatrixType matrixBad;
matrixBad.Fill(2.0);
auto matrixBad = itk::MakeFilled<LargeMatrixType>(2.0);
ITK_TRY_EXPECT_EXCEPTION(matrixBad.GetInverse());

matrixBad.SetIdentity();
Expand Down
3 changes: 1 addition & 2 deletions Modules/Core/Common/test/itkPointSetToImageFilterTest1.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,7 @@ itkPointSetToImageFilterTest1(int argc, char * argv[])


BinaryImageType::SpacingType::ValueType spacingValue = 1.0;
BinaryImageType::SpacingType spacing;
spacing.Fill(spacingValue);
auto spacing = itk::MakeFilled<BinaryImageType::SpacingType>(spacingValue);
filter->SetSpacing(spacing);
ITK_TEST_SET_GET_VALUE(spacing, filter->GetSpacing());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -426,8 +426,7 @@ itkSymmetricSecondRankTensorTest(int, char *[])
tensor3D(2, 1) = 0.0; // overrides (1,2)
tensor3D(2, 2) = 29.0;

Double3DMatrixType matrix3D;
matrix3D.Fill(1.0);
auto matrix3D = itk::MakeFilled<Double3DMatrixType>(1.0);
std::vector<double> ans;
ans.push_back(26);
ans.push_back(23);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,7 @@ class DomainThreaderAssociate
BeforeThreadedExecution() override
{
this->m_DomainInThreadedExecution.resize(this->GetNumberOfWorkUnitsUsed());
DomainType unsetDomain;
unsetDomain.Fill(-1);
auto unsetDomain = itk::MakeFilled<DomainType>(-1);
for (auto & i : m_DomainInThreadedExecution)
{
i = unsetDomain;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,7 @@ itkTorusInteriorExteriorSpatialFunctionTest(int, char *[])
torusInteriorExteriorSpatialFunction, TorusInteriorExteriorSpatialFunction, InteriorExteriorSpatialFunction);

// Set the torus properties
TorusInteriorExteriorSpatialFunctionType::InputType origin;
origin.Fill(1.0);
auto origin = itk::MakeFilled<TorusInteriorExteriorSpatialFunctionType::InputType>(1.0);

torusInteriorExteriorSpatialFunction->SetOrigin(origin);
ITK_TEST_SET_GET_VALUE(origin, torusInteriorExteriorSpatialFunction->GetOrigin());
Expand Down
6 changes: 2 additions & 4 deletions Modules/Core/ImageAdaptors/test/itkImageAdaptorTest.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,7 @@ itkImageAdaptorTest(int, char *[])
}


myImageType::PointType imageOrigin;
imageOrigin.Fill(10.0);
auto imageOrigin = itk::MakeFilled<myImageType::PointType>(10.0);
myImage->SetOrigin(imageOrigin);
if (myImage->GetOrigin() != myAdaptor->GetOrigin())
{
Expand Down Expand Up @@ -184,8 +183,7 @@ itkImageAdaptorTest(int, char *[])
}


myImageType::SpacingType imageSpacing;
imageSpacing.Fill(10.0);
auto imageSpacing = itk::MakeFilled<myImageType::SpacingType>(10.0);

myImage->SetSpacing(imageSpacing);
if (myImage->GetSpacing() != myAdaptor->GetSpacing())
Expand Down
6 changes: 2 additions & 4 deletions Modules/Core/ImageAdaptors/test/itkVectorImageTest.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -707,8 +707,7 @@ itkVectorImageTest(int, char * argv[])
std::cout << "Testing ConstNeighborhoodIterator...." << std::endl;

using ConstNeighborhoodIteratorType = itk::ConstNeighborhoodIterator<VectorImageType>;
ConstNeighborhoodIteratorType::RadiusType radius;
radius.Fill(1);
auto radius = itk::MakeFilled<ConstNeighborhoodIteratorType::RadiusType>(1);

ConstNeighborhoodIteratorType::RegionType region = vectorImage->GetBufferedRegion();
auto size = ConstNeighborhoodIteratorType::SizeType::Filled(4);
Expand Down Expand Up @@ -782,8 +781,7 @@ itkVectorImageTest(int, char * argv[])

// Test operator-
--cNit;
ConstNeighborhoodIteratorType::OffsetType offset;
offset.Fill(1);
auto offset = itk::MakeFilled<ConstNeighborhoodIteratorType::OffsetType>(1);
cNit -= offset;
itk::VariableLengthVector<PixelType> pixel = cNit.GetCenterPixel();
itk::VariableLengthVector<PixelType> correctAnswer(VectorLength);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,7 @@ itkCentralDifferenceImageFunctionOnVectorTestRun()
}

// test continuous index
typename FunctionType::ContinuousIndexType cindex;
cindex.Fill(8.0);
auto cindex = itk::MakeFilled<typename FunctionType::ContinuousIndexType>(8.0);
OutputType continuousIndexOutput = function->EvaluateAtContinuousIndex(cindex);
std::cout << "ContinuousIndex: " << cindex << " Derivative: ";
std::cout << continuousIndexOutput << std::endl;
Expand All @@ -144,8 +143,7 @@ itkCentralDifferenceImageFunctionOnVectorTestRun()
result = EXIT_FAILURE;
}

typename FunctionType::PointType point;
point.Fill(8.0);
auto point = itk::MakeFilled<typename FunctionType::PointType>(8.0);
OutputType pointOutput = function->Evaluate(point);
std::cout << "Point: " << point << " Derivative: ";
std::cout << pointOutput << std::endl;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,7 @@ itkCentralDifferenceImageFunctionTest(int, char *[])
std::cout << "Index: " << index << " is inside the BufferedRegion." << std::endl;
}

FunctionType::ContinuousIndexType cindex;
cindex.Fill(8.0);
auto cindex = itk::MakeFilled<FunctionType::ContinuousIndexType>(8.0);
OutputType continuousIndexOutput = function->EvaluateAtContinuousIndex(cindex);
std::cout << "ContinuousIndex: " << cindex << " Derivative: ";
std::cout << continuousIndexOutput << std::endl;
Expand All @@ -88,8 +87,7 @@ itkCentralDifferenceImageFunctionTest(int, char *[])
result = EXIT_FAILURE;
}

FunctionType::PointType point;
point.Fill(8.0);
auto point = itk::MakeFilled<FunctionType::PointType>(8.0);
OutputType pointOutput = function->Evaluate(point);
std::cout << "Point: " << point << " Derivative: ";
std::cout << pointOutput << std::endl;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,7 @@ itkGaussianBlurImageFunctionTest(int, char *[])
// Testing Set/GetMaximumError()
{
std::cout << "Testing Set/GetMaximumError(): ";
GFunctionType::ErrorArrayType setError;

setError.Fill(0.05);
auto setError = itk::MakeFilled<GFunctionType::ErrorArrayType>(0.05);
gaussianFunction->SetMaximumError(setError);

const GFunctionType::ErrorArrayType & readError = gaussianFunction->GetMaximumError();
Expand Down Expand Up @@ -187,8 +185,7 @@ itkGaussianBlurImageFunctionTest(int, char *[])
blurredvalue_point = gaussianFunction->Evaluate(pt);


GFunctionType::ContinuousIndexType continuousIndex;
continuousIndex.Fill(25);
auto continuousIndex = itk::MakeFilled<GFunctionType::ContinuousIndexType>(25);
GFunctionType::OutputType blurredvalue_continuousIndex;
blurredvalue_continuousIndex = gaussianFunction->EvaluateAtContinuousIndex(continuousIndex);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,7 @@ TestGaussianDerivativeImageFunction()
typename DoGFunctionType::OutputType gradientPoint;
gradientPoint = DoG->Evaluate(pt);

typename DoGFunctionType::ContinuousIndexType continuousIndex;
continuousIndex.Fill(25);
auto continuousIndex = itk::MakeFilled<typename DoGFunctionType::ContinuousIndexType>(25);
typename DoGFunctionType::OutputType gradientContinuousIndex;
gradientContinuousIndex = DoG->EvaluateAtContinuousIndex(continuousIndex);

Expand Down
Loading