22 #include "vtkPolyData.h"
23 #include "vtkSphereSource.h"
38 sphereSource->SetCenter(0, 0, 0);
39 sphereSource->SetRadius(5.0);
40 sphereSource->SetThetaResolution(10);
41 sphereSource->SetPhiResolution(10);
42 sphereSource->Update();
44 vtkPolyData *polys = sphereSource->GetOutput();
46 surface->SetVtkPolyData(polys);
47 sphereSource->Delete();
50 cloneSurface = surface->Clone();
52 cloneSurface =
nullptr;
54 double bounds[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
55 polys->ComputeBounds();
56 polys->GetBounds(bounds);
58 surface->UpdateOutputInformation();
59 surface->SetRequestedRegionToLargestPossibleRegion();
64 if (bounds[0] == surfBounds[0] && bounds[1] == surfBounds[1] && bounds[2] == surfBounds[2] &&
65 bounds[3] == surfBounds[3] && bounds[4] == surfBounds[4] && bounds[5] == surfBounds[5])
73 surface->SetRequestedRegionToLargestPossibleRegion();
77 double boundsMat[5][6];
79 for (
int i = 0; i < 5; i++)
82 sphereSource->SetCenter(0, 0, 0);
83 sphereSource->SetRadius(1.0 * (i + 1.0));
84 sphereSource->SetThetaResolution(10);
85 sphereSource->SetPhiResolution(10);
86 sphereSource->Update();
87 sphereSource->GetOutput()->ComputeBounds();
88 sphereSource->GetOutput()->GetBounds(boundsMat[i]);
89 surface->SetVtkPolyData(sphereSource->GetOutput(), i);
90 sphereSource->Delete();
93 surface->UpdateOutputInformation();
94 surface->SetRequestedRegionToLargestPossibleRegion();
97 for (
int i = 0; i < 5; i++)
100 (
const_cast<mitk::BoundingBox *
>(surface->GetTimeGeometry()->GetGeometryForTimeStep(i)->GetBoundingBox()))
103 if (boundsMat[i][0] != surfBounds[0] || boundsMat[i][1] != surfBounds[1] || boundsMat[i][2] != surfBounds[2] ||
104 boundsMat[i][3] != surfBounds[3] || boundsMat[i][4] != surfBounds[4] || boundsMat[i][5] != surfBounds[5])
118 "Testing correctness of geometry for surface->GetUpdatedTimeGeometry()!");
121 sphereSource->SetCenter(0, 0, 0);
122 sphereSource->SetRadius(100.0);
123 sphereSource->SetThetaResolution(10);
124 sphereSource->SetPhiResolution(10);
125 sphereSource->Update();
126 surface->SetVtkPolyData(sphereSource->GetOutput(), 3);
127 sphereSource->Delete();
129 inputTimeGeometry = surface->GetUpdatedTimeGeometry();
135 "Explicitly changing the data of timestep 3 and checking for timebounds correctness of surface's geometry again!");
137 unsigned int numberoftimesteps = surface->GetTimeSteps();
139 dummy->Graft(surface);
142 dummy->GetTimeSteps() == numberoftimesteps,
143 "orig-numberofTimeSteps:" << numberoftimesteps <<
" copy-numberofTimeSteps:" << dummy->GetTimeSteps());
itk::BoundingBox< unsigned long, 3, ScalarType > BoundingBox
Standard 3D-BoundingBox typedef.
#define MITK_TEST_CONDITION_REQUIRED(COND, MSG)
section GeneralTestsDeprecatedOldTestingStyle Deprecated macros All tests with MITK_TEST_BEGIN()
virtual TimeStepType TimePointToTimeStep(TimePointType timePoint) const =0
Converts a time point to the corresponding time step.
itk::ImageRegion< 5 > RegionType
BoundingBoxType::BoundsArrayType BoundsArrayType
int mitkSurfaceTest(int, char *[])
static itkEventMacro(BoundingShapeInteractionEvent, itk::AnyEvent) class MITKBOUNDINGSHAPE_EXPORT BoundingShapeInteractor Pointer New()
Basic interaction methods for mitk::GeometryData.