21 #include <vtkCleanPolyData.h>
31 class mitkAnisotropicIterativeClosestPointRegistrationTestSuite :
public mitk::TestFixture
33 CPPUNIT_TEST_SUITE(mitkAnisotropicIterativeClosestPointRegistrationTestSuite);
36 CPPUNIT_TEST_SUITE_END();
39 typedef itk::Matrix<double, 3, 3>
Matrix3x3;
40 typedef itk::Vector<double, 3> Vector3;
41 typedef std::vector<Matrix3x3> CovarianceMatrixList;
49 CovarianceMatrixList m_SigmasMovingSurface;
50 CovarianceMatrixList m_SigmasFixedSurface;
52 double m_FRENormalizationFactor;
71 matrixCalculator->SetInputSurface(m_MovingSurface);
72 matrixCalculator->ComputeCovarianceMatrices();
73 m_SigmasMovingSurface = matrixCalculator->GetCovarianceMatrices();
74 const double meanVarX = matrixCalculator->GetMeanVariance();
76 matrixCalculator->SetInputSurface(m_FixedSurface);
77 matrixCalculator->ComputeCovarianceMatrices();
78 m_SigmasFixedSurface = matrixCalculator->GetCovarianceMatrices();
79 const double meanVarY = matrixCalculator->GetMeanVariance();
81 m_FRENormalizationFactor = sqrt(meanVarX + meanVarY);
84 void tearDown()
override
86 m_MovingSurface = NULL;
87 m_FixedSurface = NULL;
89 m_TargetsMovingSurface = NULL;
90 m_TargetsFixedSurface = NULL;
92 m_SigmasMovingSurface.clear();
93 m_SigmasFixedSurface.clear();
96 void testAicpRegistration()
98 const double expFRE = 27.5799;
99 const double expTRE = 1.68835;
104 aICP->SetMovingSurface(m_MovingSurface);
105 aICP->SetFixedSurface(m_FixedSurface);
106 aICP->SetCovarianceMatricesMovingSurface(m_SigmasMovingSurface);
107 aICP->SetCovarianceMatricesFixedSurface(m_SigmasFixedSurface);
108 aICP->SetFRENormalizationFactor(m_FRENormalizationFactor);
109 aICP->SetThreshold(0.000001);
114 MITK_INFO <<
"FRE: Expected: " << expFRE <<
", computed: " << aICP->GetFRE();
115 CPPUNIT_ASSERT_MESSAGE(
"mitkAnisotropicIterativeClosestPointRegistrationTest:AicpRegistration Test FRE",
121 m_TargetsFixedSurface.GetPointer(),
123 aICP->GetTranslation());
127 MITK_INFO <<
"TRE: Expected: " << expTRE <<
", computed: " << tre;
128 CPPUNIT_ASSERT_MESSAGE(
"mitkAnisotropicIterativeClosestPointRegistrationTest:AicpRegistration Test TRE",
132 void testTrimmedAicpregistration()
134 const double expFRE = 4.8912;
135 const double expTRE = 0.0484215;
141 aICP->SetMovingSurface(m_MovingSurface);
142 aICP->SetFixedSurface(m_FixedSurface);
143 aICP->SetCovarianceMatricesMovingSurface(m_SigmasMovingSurface);
144 aICP->SetCovarianceMatricesFixedSurface(m_SigmasFixedSurface);
145 aICP->SetFRENormalizationFactor(m_FRENormalizationFactor);
146 aICP->SetThreshold(0.000001);
147 aICP->SetTrimmFactor(0.50);
152 MITK_INFO <<
"FRE: Expected: " << expFRE <<
", computed: " << aICP->GetFRE();
154 CPPUNIT_ASSERT_MESSAGE(
"mitkAnisotropicIterativeClosestPointRegistrationTest:AicpRegistration Test FRE",
160 m_TargetsFixedSurface.GetPointer(),
162 aICP->GetTranslation());
164 MITK_INFO <<
"TRE: Expected: " << expTRE <<
", computed: " << tre;
165 CPPUNIT_ASSERT_MESSAGE(
"mitkAnisotropicIterativeClosestPointRegistrationTest:AicpRegistration Test TRE",
static mitk::Surface::Pointer LoadSurface(const std::string &path)
LoadSurface Convenience method to load an arbitrary mitkSurface.
itk::SmartPointer< Self > Pointer
MITK_TEST_SUITE_REGISTRATION(mitkImageToItk)
#define MITK_TEST(TESTMETHOD)
Adds a test to the current test suite.
static std::string GetTestDataFilePath(const std::string &testData)
Get the absolute path for test data.
static double ComputeTargetRegistrationError(const mitk::PointSet *movingTargets, const mitk::PointSet *fixedTargets, const Rotation &rotation, const Translation &translation)
Compute the target registration error between two point sets.
Test fixture for parameterized tests.
static mitk::PointSet::Pointer LoadPointSet(const std::string &path)
LoadPointSet Convenience method to load an arbitrary mitkPointSet.
MITKNEWMODULE_EXPORT bool Equal(mitk::ExampleDataStructure *leftHandSide, mitk::ExampleDataStructure *rightHandSide, mitk::ScalarType eps, bool verbose)
Returns true if the example data structures are considered equal.
static itkEventMacro(BoundingShapeInteractionEvent, itk::AnyEvent) class MITKBOUNDINGSHAPE_EXPORT BoundingShapeInteractor Pointer New()
Basic interaction methods for mitk::GeometryData.