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/itkAnnulusOperatorGTest.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,7 @@ TEST(AnnulusOperator, CreateAndInspect)

EXPECT_NO_THROW(normalizedAnnulus.CreateOperator());

OperatorType::SizeType normalizedAnnulusSize;
normalizedAnnulusSize = normalizedAnnulus.GetSize();
const OperatorType::SizeType normalizedAnnulusSize = normalizedAnnulus.GetSize();

std::cout << std::endl;
std::cout << "Annulus, N = " << normalizedAnnulusSize << ", r = " << normalizedAnnulus.GetInnerRadius()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -255,10 +255,8 @@ itkBSplineInterpolationWeightFunctionTest(int, char *[])
std::cout << "Number Of Weights: " << numberOfWeights << std::endl;

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

weights = function->Evaluate(position);
WeightsType weights = function->Evaluate(position);

std::cout << "Position: " << position << std::endl;
std::cout << "Weights: " << weights << std::endl;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,11 @@ TEST(ImageRandomNonRepeatingIteratorWithIndex, SupportsSubregions)
it.SetNumberOfSamples(numberOfPixelsSize0);
it.GoToBegin();
{
ImageType::IndexType indexFill0;
// Because the random iterator does not repeat, this should
// fill the image with indices
while (!it.IsAtEnd())
{
indexFill0 = it.GetIndex();
const ImageType::IndexType indexFill0 = it.GetIndex();
it.Set(indexFill0);
++it;
}
Expand Down Expand Up @@ -117,10 +116,9 @@ TEST(ImageRandomNonRepeatingIteratorWithIndex, SupportsSubregions)

std::cout << "Verifying const iterator... ";
std::cout << "Random walk of the Iterator over the image " << std::endl;
ImageType::IndexType indexConstMatch;
while (!cot.IsAtEnd())
{
indexConstMatch = cot.GetIndex();
const ImageType::IndexType indexConstMatch = cot.GetIndex();
EXPECT_EQ(cot.Get(), indexConstMatch)
<< "Values don't correspond to what was stored " << std::endl
<< "Test failed at index " << indexConstMatch << " value is " << cot.Get() << std::endl;
Expand Down
4 changes: 1 addition & 3 deletions Modules/Core/Common/test/itkVersorTest.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -271,9 +271,7 @@ itkVersorTest(int, char *[])
const ValueType cosangle = std::cos(angle / 2.0);
const ValueType sinangle = std::sin(angle / 2.0);

VectorType xb;

xb = xa * sinangle;
const VectorType xb = xa * sinangle;

if (itk::Math::Absolute(qa.GetX() - xb[0]) > epsilon)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -220,10 +220,9 @@ TestContinuousIndexDerivative(const TInterpolator * interp,

if (isInside)
{
typename TInterpolator::CovariantVectorType value;
const double value2 = interp->EvaluateAtContinuousIndex(index);
const double value2 = interp->EvaluateAtContinuousIndex(index);
std::cout << "Interpolated Value: " << value2 << '\n';
value = interp->EvaluateDerivativeAtContinuousIndex(index);
const typename TInterpolator::CovariantVectorType value = interp->EvaluateDerivativeAtContinuousIndex(index);
std::cout << " Value: ";
for (int i = 0; i < ImageDimension3D; ++i)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -204,17 +204,15 @@ class BSplineDeformableTransformTest2Helper

fi.GoToBegin();

typename TransformType::InputPointType fixedPoint;
typename TransformType::OutputPointType movingPoint;
typename DeformationFieldType::IndexType index;
typename TransformType::InputPointType fixedPoint;

VectorType displacement;

while (!fi.IsAtEnd())
{
index = fi.ComputeIndex();
const typename DeformationFieldType::IndexType index = fi.ComputeIndex();
field->TransformIndexToPhysicalPoint(index, fixedPoint);
movingPoint = bsplineTransform->TransformPoint(fixedPoint);
const typename TransformType::OutputPointType movingPoint = bsplineTransform->TransformPoint(fixedPoint);
displacement[0] = movingPoint[0] - fixedPoint[0];
displacement[1] = movingPoint[1] - fixedPoint[1];
fi.Set(displacement);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -218,17 +218,15 @@ class BSplineDeformableTransformTest3Helper

fi.GoToBegin();

typename TransformType::InputPointType fixedPoint;
typename TransformType::OutputPointType movingPoint;
typename DeformationFieldType::IndexType index;
typename TransformType::InputPointType fixedPoint;

VectorType displacement;

while (!fi.IsAtEnd())
{
index = fi.ComputeIndex();
const typename DeformationFieldType::IndexType index = fi.ComputeIndex();
field->TransformIndexToPhysicalPoint(index, fixedPoint);
movingPoint = bsplineTransform->TransformPoint(fixedPoint);
const typename TransformType::OutputPointType movingPoint = bsplineTransform->TransformPoint(fixedPoint);
displacement[0] = movingPoint[0] - fixedPoint[0];
displacement[1] = movingPoint[1] - fixedPoint[1];
fi.Set(displacement);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,20 +164,16 @@ itkBSplineTransformInitializerTest1(int argc, char * argv[])

fi.GoToBegin();

TransformType::InputPointType fixedPoint;
TransformType::OutputPointType movingPoint;
TransformType::JacobianType jacobian;
DeformationFieldType::IndexType index;

VectorType displacement;
TransformType::InputPointType fixedPoint;
TransformType::JacobianType jacobian;

while (!fi.IsAtEnd())
{
index = fi.ComputeIndex();
const DeformationFieldType::IndexType index = fi.ComputeIndex();
field->TransformIndexToPhysicalPoint(index, fixedPoint);
movingPoint = bsplineTransform->TransformPoint(fixedPoint);
const TransformType::OutputPointType movingPoint = bsplineTransform->TransformPoint(fixedPoint);
bsplineTransform->ComputeJacobianWithRespectToParameters(fixedPoint, jacobian);
displacement = movingPoint - fixedPoint;
const VectorType displacement = movingPoint - fixedPoint;
fi.Set(displacement);
++fi;
}
Expand Down
8 changes: 3 additions & 5 deletions Modules/Core/Transform/test/itkBSplineTransformTest2.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -180,17 +180,15 @@ class BSplineTransformTest2Helper

fi.GoToBegin();

typename TransformType::InputPointType fixedPoint;
typename TransformType::OutputPointType movingPoint;
typename DeformationFieldType::IndexType index;
typename TransformType::InputPointType fixedPoint;

VectorType displacement;

while (!fi.IsAtEnd())
{
index = fi.ComputeIndex();
const typename DeformationFieldType::IndexType index = fi.ComputeIndex();
field->TransformIndexToPhysicalPoint(index, fixedPoint);
movingPoint = bsplineTransform->TransformPoint(fixedPoint);
const typename TransformType::OutputPointType movingPoint = bsplineTransform->TransformPoint(fixedPoint);
displacement[0] = movingPoint[0] - fixedPoint[0];
displacement[1] = movingPoint[1] - fixedPoint[1];
fi.Set(displacement);
Expand Down
8 changes: 3 additions & 5 deletions Modules/Core/Transform/test/itkBSplineTransformTest3.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -205,17 +205,15 @@ class BSplineTransformTest3Helper

fi.GoToBegin();

typename TransformType::InputPointType fixedPoint;
typename TransformType::OutputPointType movingPoint;
typename DeformationFieldType::IndexType index;
typename TransformType::InputPointType fixedPoint;

VectorType displacement;

while (!fi.IsAtEnd())
{
index = fi.ComputeIndex();
const typename DeformationFieldType::IndexType index = fi.ComputeIndex();
field->TransformIndexToPhysicalPoint(index, fixedPoint);
movingPoint = bsplineTransform->TransformPoint(fixedPoint);
const typename TransformType::OutputPointType movingPoint = bsplineTransform->TransformPoint(fixedPoint);
displacement[0] = movingPoint[0] - fixedPoint[0];
displacement[1] = movingPoint[1] - fixedPoint[1];
fi.Set(displacement);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,11 +135,9 @@ itkComposeScaleSkewVersor3DTransformTest(int, char *[])
// Rotate an itk::Point
constexpr TransformType::InputPointType::ValueType pInit[3]{ 1, 4, 9 };
const TransformType::InputPointType p = pInit;
TransformType::OutputPointType q;
q = versor.Transform(p);
const TransformType::OutputPointType q = versor.Transform(p);

TransformType::OutputPointType r;
r = rotation->TransformPoint(p);
const TransformType::OutputPointType r = rotation->TransformPoint(p);
for (unsigned int i = 0; i < 3; ++i)
{
if (itk::Math::Absolute(q[i] - r[i]) > epsilon)
Expand All @@ -163,11 +161,9 @@ itkComposeScaleSkewVersor3DTransformTest(int, char *[])
// Translate an itk::Vector
TransformType::InputVectorType::ValueType pInit[3] = { 1, 4, 9 };
const TransformType::InputVectorType p = pInit;
TransformType::OutputVectorType q;
q = versor.Transform(p);
const TransformType::OutputVectorType q = versor.Transform(p);

TransformType::OutputVectorType r;
r = rotation->TransformVector(p);
const TransformType::OutputVectorType r = rotation->TransformVector(p);
for (unsigned int i = 0; i < 3; ++i)
{
if (itk::Math::Absolute(q[i] - r[i]) > epsilon)
Expand All @@ -191,11 +187,9 @@ itkComposeScaleSkewVersor3DTransformTest(int, char *[])
// Translate an itk::CovariantVector
TransformType::InputCovariantVectorType::ValueType pInit[3] = { 1, 4, 9 };
const TransformType::InputCovariantVectorType p = pInit;
TransformType::OutputCovariantVectorType q;
q = versor.Transform(p);
const TransformType::OutputCovariantVectorType q = versor.Transform(p);

TransformType::OutputCovariantVectorType r;
r = rotation->TransformCovariantVector(p);
const TransformType::OutputCovariantVectorType r = rotation->TransformCovariantVector(p);
for (unsigned int i = 0; i < 3; ++i)
{
if (itk::Math::Absolute(q[i] - r[i]) > epsilon)
Expand All @@ -222,11 +216,9 @@ itkComposeScaleSkewVersor3DTransformTest(int, char *[])
p[1] = 4;
p[2] = 9;

TransformType::OutputVnlVectorType q;
q = versor.Transform(p);
const TransformType::OutputVnlVectorType q = versor.Transform(p);

TransformType::OutputVnlVectorType r;
r = rotation->TransformVector(p);
const TransformType::OutputVnlVectorType r = rotation->TransformVector(p);
for (unsigned int i = 0; i < 3; ++i)
{
if (itk::Math::Absolute(q[i] - r[i]) > epsilon)
Expand Down Expand Up @@ -266,8 +258,7 @@ itkComposeScaleSkewVersor3DTransformTest(int, char *[])

transform->SetCenter(center);

TransformType::OutputPointType transformedPoint;
transformedPoint = transform->TransformPoint(center);
const TransformType::OutputPointType transformedPoint = transform->TransformPoint(center);
for (unsigned int i = 0; i < 3; ++i)
{
if (itk::Math::Absolute(center[i] - transformedPoint[i]) > epsilon)
Expand Down Expand Up @@ -487,12 +478,9 @@ itkComposeScaleSkewVersor3DTransformTest(int, char *[])
pnt[i] = randomNumberDistribution(randomNumberEngine);
}

TransformType::OutputPointType tPnt;
tPnt = transform->TransformPoint(pnt);
TransformType::OutputPointType tPnt2;
tPnt2 = transform2->TransformPoint(pnt);
TransformType::OutputPointType tPnt3;
tPnt3 = transform3->TransformPoint(pnt);
const TransformType::OutputPointType tPnt = transform->TransformPoint(pnt);
const TransformType::OutputPointType tPnt2 = transform2->TransformPoint(pnt);
const TransformType::OutputPointType tPnt3 = transform3->TransformPoint(pnt);

for (unsigned int i = 0; i < 3; ++i)
{
Expand Down
12 changes: 4 additions & 8 deletions Modules/Core/Transform/test/itkEuler2DTransformTest.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,7 @@ itkEuler2DTransformTest(int, char *[])
q[0] = p[0] * costh - p[1] * sinth;
q[1] = p[0] * sinth + p[1] * costh;

EulerTransformType::OutputPointType r;
r = eulerTransform->TransformPoint(p);
EulerTransformType::OutputPointType r = eulerTransform->TransformPoint(p);
for (unsigned int i = 0; i < N; ++i)
{
if (itk::Math::Absolute(q[i] - r[i]) > epsilon)
Expand Down Expand Up @@ -199,15 +198,13 @@ itkEuler2DTransformTest(int, char *[])
p1[0] = 96.8;
p1[1] = -3.2;

TransformType::InputPointType p2;
p2 = t1->TransformPoint(p1);
const TransformType::InputPointType p2 = t1->TransformPoint(p1);

// Test inverse
TransformType::Pointer t22;
t1->CloneInverseTo(t22);

TransformType::InputPointType p3;
p3 = t22->TransformPoint(p2);
const TransformType::InputPointType p3 = t22->TransformPoint(p2);

std::cout << "Test CloneInverseTo(): ";
if (!CheckEqual(p1, p3))
Expand Down Expand Up @@ -244,8 +241,7 @@ itkEuler2DTransformTest(int, char *[])
TransformType::Pointer t3;
t1->CloneTo(t3);

TransformType::InputPointType p4;
p4 = t3->TransformPoint(p1);
const TransformType::InputPointType p4 = t3->TransformPoint(p1);

std::cout << "Test Clone(): ";
if (!CheckEqual(p2, p4))
Expand Down
Loading
Loading