17 #include "mitkExternAbstractTransformGeometry.h"
22 #include <vtkSphericalTransform.h>
33 std::cout <<
"Initializing an x-/y-plane (xyPlane) as parameter plane by InitializeStandardPlane(rightVector, "
34 "downVector, spacing = NULL): "
45 xyPlane->InitializeStandardPlane(right, bottom);
46 xyPlane->SetOrigin(origin);
47 xyPlane->SetSizeInUnits(width, height);
49 std::cout <<
"Creating AbstractTransformGeometry: " << std::endl;
52 std::cout <<
"Setting xyPlane as parameter plane of AbstractTransformGeometry: " << std::endl;
53 abstractgeometry->SetPlane(xyPlane);
56 <<
"Testing whether the bounds of xyPlane and the parametric bounds of AbstractTransformGeometry are equal: ";
57 if ((
mitk::Equal(const_cast<mitk::BoundingBox *>(abstractgeometry->GetParametricBoundingBox())->GetMinimum(),
58 const_cast<mitk::BoundingBox *
>(xyPlane->GetBoundingBox())->GetMinimum()) ==
false) ||
59 (
mitk::Equal(const_cast<mitk::BoundingBox *>(abstractgeometry->GetParametricBoundingBox())->GetMaximum(),
60 const_cast<mitk::BoundingBox *
>(xyPlane->GetBoundingBox())->GetMaximum()) ==
false))
62 std::cout <<
"[FAILED]" << std::endl;
65 std::cout <<
"[PASSED]" << std::endl;
67 std::cout <<
"Testing whether the parametic bounds of AbstractTransformGeometry and the bounds of the plane accessed "
68 "from there are equal: ";
69 if ((
mitk::Equal(const_cast<mitk::BoundingBox *>(abstractgeometry->GetParametricBoundingBox())->GetMinimum(),
70 const_cast<mitk::BoundingBox *
>(abstractgeometry->GetPlane()->GetBoundingBox())->GetMinimum()) ==
72 (
mitk::Equal(const_cast<mitk::BoundingBox *>(abstractgeometry->GetParametricBoundingBox())->GetMaximum(),
73 const_cast<mitk::BoundingBox *
>(abstractgeometry->GetPlane()->GetBoundingBox())->GetMaximum()) ==
76 std::cout <<
"[FAILED]" << std::endl;
79 std::cout <<
"[PASSED]" << std::endl;
81 std::cout <<
"Change parametic bounds of AbstractTransformGeometry and test whether they are equal to the bounds of "
82 "the plane accessed from there: "
86 abstractgeometry->SetParametricBounds(bounds);
87 if ((
mitk::Equal(const_cast<mitk::BoundingBox *>(abstractgeometry->GetParametricBoundingBox())->GetMinimum(),
88 const_cast<mitk::BoundingBox *
>(abstractgeometry->GetPlane()->GetBoundingBox())->GetMinimum()) ==
90 (
mitk::Equal(const_cast<mitk::BoundingBox *>(abstractgeometry->GetParametricBoundingBox())->GetMaximum(),
91 const_cast<mitk::BoundingBox *
>(abstractgeometry->GetPlane()->GetBoundingBox())->GetMaximum()) ==
94 std::cout <<
"[FAILED]" << std::endl;
97 std::cout <<
"[PASSED]" << std::endl;
99 std::cout <<
"Initializing an phi-/theta-plane (sphereParameterPlane) as parameter plane by "
100 "InitializeStandardPlane(rightVector, downVector, spacing = NULL): "
104 widthInMM = 2 * vnl_math::pi;
106 heightInMM = vnl_math::pi;
112 sphereParameterPlane->InitializeStandardPlane(right, bottom);
113 sphereParameterPlane->SetOrigin(origin);
114 sphereParameterPlane->SetSizeInUnits(width, height);
116 std::cout <<
"Creating an vtkSphericalTransform (sphericalTransform) to use with sphereParameterPlane: " << std::endl;
119 std::cout <<
"Setting sphereParameterPlane as parameter plane and sphericalTransform as transform of "
120 "AbstractTransformGeometry: "
122 abstractgeometry->SetPlane(sphereParameterPlane);
123 abstractgeometry->SetVtkAbstractTransform(sphericalTransform);
125 std::cout <<
"Testing whether the bounds of sphereParameterPlane and the parametric bounds of "
126 "AbstractTransformGeometry are equal: ";
127 if ((
mitk::Equal(const_cast<mitk::BoundingBox *>(abstractgeometry->GetParametricBoundingBox())->GetMinimum(),
128 const_cast<mitk::BoundingBox *
>(sphereParameterPlane->GetBoundingBox())->GetMinimum()) ==
false) ||
129 (
mitk::Equal(const_cast<mitk::BoundingBox *>(abstractgeometry->GetParametricBoundingBox())->GetMaximum(),
130 const_cast<mitk::BoundingBox *
>(sphereParameterPlane->GetBoundingBox())->GetMaximum()) ==
false))
132 std::cout <<
"[FAILED]" << std::endl;
135 std::cout <<
"[PASSED]" << std::endl;
137 std::cout <<
"Testing whether the parametic bounds of AbstractTransformGeometry and the bounds of the plane accessed "
138 "from there are equal: ";
139 if ((
mitk::Equal(const_cast<mitk::BoundingBox *>(abstractgeometry->GetParametricBoundingBox())->GetMinimum(),
140 const_cast<mitk::BoundingBox *
>(abstractgeometry->GetPlane()->GetBoundingBox())->GetMinimum()) ==
142 (
mitk::Equal(const_cast<mitk::BoundingBox *>(abstractgeometry->GetParametricBoundingBox())->GetMaximum(),
143 const_cast<mitk::BoundingBox *
>(abstractgeometry->GetPlane()->GetBoundingBox())->GetMaximum()) ==
146 std::cout <<
"[FAILED]" << std::endl;
149 std::cout <<
"[PASSED]" << std::endl;
151 std::cout <<
"Testing mapping Map(pt2d_mm(phi=Pi,theta=Pi/2.0), pt3d_mm) and compare with expected (-radius, 0, 0): ";
154 pt2d_mm[0] = vnl_math::pi;
155 pt2d_mm[1] = vnl_math::pi_over_2;
157 abstractgeometry->Map(pt2d_mm, pt3d_mm);
158 if (
mitk::Equal(pt3d_mm, expected_pt3d_mm) ==
false)
160 std::cout <<
"[FAILED]" << std::endl;
163 std::cout <<
"[PASSED]" << std::endl;
165 std::cout <<
"Testing mapping Map(pt3d_mm, pt2d_mm) and compare with expected: ";
167 abstractgeometry->Map(pt3d_mm, testpt2d_mm);
170 std::cout <<
"[FAILED]" << std::endl;
173 std::cout <<
"[PASSED]" << std::endl;
175 std::cout <<
"Testing IndexToWorld(pt2d_units, pt2d_mm) and compare with expected: ";
177 pt2d_units[0] = width / 2.0;
178 pt2d_units[1] = height / 2.0;
179 pt2d_mm[0] = widthInMM / 2.0;
180 pt2d_mm[1] = heightInMM / 2.0;
181 abstractgeometry->IndexToWorld(pt2d_units, testpt2d_mm);
184 std::cout <<
"[FAILED]" << std::endl;
187 std::cout <<
"[PASSED]" << std::endl;
189 std::cout <<
"Change parametic bounds of AbstractTransformGeometry and test whether they are equal to the bounds of "
190 "the plane accessed from there: "
194 abstractgeometry->SetParametricBounds(bounds);
195 if ((
mitk::Equal(const_cast<mitk::BoundingBox *>(abstractgeometry->GetParametricBoundingBox())->GetMinimum(),
196 const_cast<mitk::BoundingBox *
>(abstractgeometry->GetPlane()->GetBoundingBox())->GetMinimum()) ==
198 (
mitk::Equal(const_cast<mitk::BoundingBox *>(abstractgeometry->GetParametricBoundingBox())->GetMaximum(),
199 const_cast<mitk::BoundingBox *
>(abstractgeometry->GetPlane()->GetBoundingBox())->GetMaximum()) ==
202 std::cout <<
"[FAILED]" << std::endl;
205 std::cout <<
"[PASSED]" << std::endl;
207 std::cout <<
"Testing IndexToWorld(pt2d_units, pt2d_mm) and compare with expected: ";
208 pt2d_units[0] = width / 2.0;
209 pt2d_units[1] = height / 2.0;
210 pt2d_mm[0] = widthInMM / 2.0;
211 pt2d_mm[1] = heightInMM / 2.0;
212 abstractgeometry->IndexToWorld(pt2d_units, testpt2d_mm);
215 std::cout <<
"[FAILED]" << std::endl;
218 std::cout <<
"[PASSED]" << std::endl;
241 sphericalTransform->Delete();
243 std::cout <<
"[TEST DONE]" << std::endl;
itk::BoundingBox< unsigned long, 3, ScalarType > BoundingBox
Standard 3D-BoundingBox typedef.
itk::SmartPointer< Self > Pointer
void FillVector3D(Tout &out, mitk::ScalarType x, mitk::ScalarType y, mitk::ScalarType z)
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.