Skip to content

Commit

Permalink
ENH: Add test demonstrating change in fixed paramers
Browse files Browse the repository at this point in the history
When applying SetIdentity(), the fixed parameters should not be modified.
The fixed paramers represent the stationary component of the transform
and setting the transform back to an identity should not modify the
stationary components.
  • Loading branch information
hjmjohnson committed Feb 28, 2024
1 parent 1b01d5c commit 198cc19
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions Modules/Core/Transform/test/itkEuler3DTransformTest.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,34 @@ itkEuler3DTransformTest(int, char *[])
using EulerTransformType = itk::Euler3DTransform<double>;
auto eulerTransform = EulerTransformType::New();

// Testing preservation of the center of rotation
auto eulerTransformWithCenter = EulerTransformType::New();
const itk::Point<double, 3> centerOfRotation({ 200, 400, 300 });
eulerTransformWithCenter->SetCenter(centerOfRotation);
std::cout << "Testing Set/GetCenter(): ";
if (eulerTransformWithCenter->GetCenter() != centerOfRotation)
{
std::cerr << "Error in Set/GetCenter() " << std::endl;
return EXIT_FAILURE;
}
std::cout << "[ PASSED ]" << std::endl;
std::cout << "Testing GetCenter() after SetIdentity(): ";
eulerTransformWithCenter->SetIdentity();
// The center of rotation should be preserved when the transform is set to identity.
// Reseting a transform to identity should not affect the FixedParameters.
std::cout << "Testing Set/GetCenter(): " << std::endl;
if (eulerTransformWithCenter->GetCenter() != centerOfRotation)
{
std::cerr << "Error in GetCenter() after calling SetIdentity() " << std::endl;
return EXIT_FAILURE;
}
std::cout << "[ PASSED ]" << std::endl;

// Testing Identity
std::cout << "Testing identity transform: ";
eulerTransform->SetIdentity();


EulerTransformType::OffsetType offset = eulerTransform->GetOffset();
if (offset[0] != 0.0 || offset[1] != 0.0 || offset[2] != 0.0)
{
Expand Down

0 comments on commit 198cc19

Please sign in to comment.