19 #include "vtkPolyData.h" 20 #include "vtkSphereSource.h" 26 vtkSphereSource *sphereSource = vtkSphereSource::New();
27 sphereSource->SetCenter(0, 0, 0);
28 sphereSource->SetRadius(5.0);
29 sphereSource->SetThetaResolution(10);
30 sphereSource->SetPhiResolution(10);
31 sphereSource->Update();
33 vtkPolyData *polys = sphereSource->GetOutput();
34 surface->SetVtkPolyData(polys);
35 sphereSource->Delete();
38 MITK_TEST_OUTPUT(<<
"Testing mitk::SurfaceToSurfaceFilter::SetInput() and ::GetNumberOfInputs() : ");
39 filter->SetInput(surface);
50 "Test if number of outputs == number of inputs");
56 outputSurface = filter->GetOutput();
57 MITK_TEST_CONDITION(outputSurface->GetSizeOfPolyDataSeries() == surface->GetSizeOfPolyDataSeries(),
58 "Test if number of PolyDatas in PolyDataSeries of output == number of PolyDatas of input");
63 std::vector<vtkPolyData *> polydatas;
64 for (
unsigned int i = 0; i < 5; ++i)
66 sphereSource = vtkSphereSource::New();
67 sphereSource->SetCenter(0, i, 0);
68 sphereSource->SetRadius(5.0 + i);
69 sphereSource->SetThetaResolution(10);
70 sphereSource->SetPhiResolution(10);
71 sphereSource->Update();
73 vtkPolyData *poly = sphereSource->GetOutput();
75 s->SetVtkPolyData(poly);
76 s2sFilter->SetInput(i, s);
77 polydatas.push_back(s2sFilter->GetOutput(i)->GetVtkPolyData());
78 sphereSource->Delete();
82 for (
unsigned int i = 0; i < 5; ++i)
85 "Test if pointers are still equal");
89 s2sFilter->CreateOutputsForAllInputs();
90 for (
unsigned int i = 0; i < 5; ++i)
92 MITK_TEST_CONDITION(s2sFilter->GetOutput(i)->GetVtkPolyData() != polydatas.at(i),
"Test if pointers are not equal");
Class for storing surfaces (vtkPolyData).
int mitkSurfaceToSurfaceFilterTest(int, char *[])
#define MITK_TEST_FOR_EXCEPTION(EXCEPTIONCLASS, STATEMENT)
Simplified version of MITK_TEST_FOR_EXCEPTION_BEGIN / END for a single statement. ...
#define MITK_TEST_OUTPUT(x)
Output some text.
An object of this class represents an exception of MITK. Please don't instantiate exceptions manually...
#define MITK_TEST_CONDITION(COND, MSG)
#define MITK_ASSERT_EQUAL(EXPECTED, ACTUAL, MSG)
Testing macro to test if two objects are equal.