25 vtkPoints *p1 = s1->GetVtkPolyData()->GetPoints();
26 vtkPoints *p2 = s2->GetVtkPolyData()->GetPoints();
28 if (p1->GetNumberOfPoints() != p2->GetNumberOfPoints())
31 for (
int i = 0; i < p1->GetNumberOfPoints(); ++i)
33 if (p1->GetPoint(i)[0] != p2->GetPoint(i)[0] || p1->GetPoint(i)[1] != p2->GetPoint(i)[1] ||
34 p1->GetPoint(i)[2] != p2->GetPoint(i)[2])
44 CPPUNIT_TEST_SUITE(mitkImageToSurfaceFilterTestSuite);
45 MITK_TEST(testImageToSurfaceFilterInitialization);
51 CPPUNIT_TEST_SUITE_END();
63 void tearDown()
override {}
64 void testImageToSurfaceFilterInitialization()
67 CPPUNIT_ASSERT_MESSAGE(
"Testing instantiation of test object", testObject.IsNotNull());
70 CPPUNIT_ASSERT_MESSAGE(
"Testing initialization of threshold member variable", testObject->GetThreshold() == 1.0f);
71 CPPUNIT_ASSERT_MESSAGE(
"Testing initialization of smooth member variable", testObject->GetSmooth() ==
false);
72 CPPUNIT_ASSERT_MESSAGE(
"Testing initialization of decimate member variable",
74 CPPUNIT_ASSERT_MESSAGE(
"Testing initialization of target reduction member variable",
75 testObject->GetTargetReduction() == 0.95f);
81 testObject->SetInput(m_BallImage);
82 CPPUNIT_ASSERT_MESSAGE(
"Testing set / get input!", testObject->GetInput() == m_BallImage);
85 void testSurfaceGeneration()
88 testObject->SetInput(m_BallImage);
91 resultSurface = testObject->GetOutput();
92 CPPUNIT_ASSERT_MESSAGE(
"Testing surface generation!", testObject->GetOutput() != NULL);
95 void testDecimatePromeshDecimation()
98 testObject->SetInput(m_BallImage);
101 resultSurface = testObject->GetOutput();
106 testObject->SetTargetReduction(0.5f);
107 testObject->Update();
110 CPPUNIT_ASSERT_MESSAGE(
"Testing DecimatePro mesh decimation!",
111 testSurface1->GetVtkPolyData()->GetPoints()->GetNumberOfPoints() >
112 testSurface2->GetVtkPolyData()->GetPoints()->GetNumberOfPoints());
115 void testQuadricDecimation()
118 testObject->SetInput(m_BallImage);
119 testObject->Update();
121 resultSurface = testObject->GetOutput();
126 testObject->SetTargetReduction(0.5f);
127 testObject->Update();
130 CPPUNIT_ASSERT_MESSAGE(
"Testing QuadricDecimation mesh decimation!",
131 testSurface1->GetVtkPolyData()->GetPoints()->GetNumberOfPoints() >
132 testSurface3->GetVtkPolyData()->GetPoints()->GetNumberOfPoints());
135 void testSmoothingOfSurface()
138 testObject->SetInput(m_BallImage);
139 testObject->Update();
141 resultSurface = testObject->GetOutput();
145 testObject->SetSmooth(
true);
147 testObject->Update();
149 CPPUNIT_ASSERT_MESSAGE(
"Testing smoothing of surface changes point data!",
MITK_TEST_SUITE_REGISTRATION(mitkImageToItk)
bool CompareSurfacePointPositions(mitk::Surface::Pointer s1, mitk::Surface::Pointer s2)
#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.
Test fixture for parameterized tests.
static mitk::Image::Pointer LoadImage(const std::string &path)
LoadImage Convenience method to load an arbitrary mitkImage.