16 #include "mitkVtkAbstractTransformPlaneGeometry.h" 18 #include <vtkSphericalTransform.h> 20 #include <vnl/vnl_quaternion.h> 21 #include <vnl/vnl_quaternion.txx> 32 std::cout <<
"Initializing an x-/y-plane (xyPlane) as parameter plane by InitializeStandardPlane(rightVector, " 33 "downVector, spacing = nullptr): " 44 xyPlane->InitializeStandardPlane(right, bottom);
45 xyPlane->SetOrigin(origin);
46 xyPlane->SetSizeInUnits(width, height);
48 std::cout <<
"Creating VtkAbstractTransformPlaneGeometry: " << std::endl;
49 mitk::VtkAbstractTransformPlaneGeometry::Pointer abstractgeometry = mitk::VtkAbstractTransformPlaneGeometry::New();
51 std::cout <<
"Setting xyPlane as parameter plane of VtkAbstractTransformPlaneGeometry: " << std::endl;
52 abstractgeometry->SetPlane(xyPlane);
54 std::cout <<
"Testing whether the bounds of xyPlane and the parametric bounds of VtkAbstractTransformPlaneGeometry " 56 if ((
mitk::Equal(const_cast<mitk::BoundingBox *>(abstractgeometry->GetParametricBoundingBox())->
GetMinimum(),
58 (
mitk::Equal(const_cast<mitk::BoundingBox *>(abstractgeometry->GetParametricBoundingBox())->GetMaximum(),
59 const_cast<mitk::BoundingBox *
>(xyPlane->GetBoundingBox())->GetMaximum()) ==
false))
61 std::cout <<
"[FAILED]" << std::endl;
64 std::cout <<
"[PASSED]" << std::endl;
66 std::cout <<
"Testing whether the parametic bounds of VtkAbstractTransformPlaneGeometry and the bounds of the plane " 67 "accessed from there are equal: ";
68 if ((
mitk::Equal(const_cast<mitk::BoundingBox *>(abstractgeometry->GetParametricBoundingBox())->
GetMinimum(),
71 (
mitk::Equal(const_cast<mitk::BoundingBox *>(abstractgeometry->GetParametricBoundingBox())->GetMaximum(),
72 const_cast<mitk::BoundingBox *
>(abstractgeometry->GetPlane()->GetBoundingBox())->GetMaximum()) ==
75 std::cout <<
"[FAILED]" << std::endl;
78 std::cout <<
"[PASSED]" << std::endl;
80 std::cout <<
"Change parametic bounds of VtkAbstractTransformPlaneGeometry and test whether they are equal to the " 81 "bounds of the plane accessed from there: " 85 abstractgeometry->SetParametricBounds(bounds);
86 if ((
mitk::Equal(const_cast<mitk::BoundingBox *>(abstractgeometry->GetParametricBoundingBox())->
GetMinimum(),
89 (
mitk::Equal(const_cast<mitk::BoundingBox *>(abstractgeometry->GetParametricBoundingBox())->GetMaximum(),
90 const_cast<mitk::BoundingBox *
>(abstractgeometry->GetPlane()->GetBoundingBox())->GetMaximum()) ==
93 std::cout <<
"[FAILED]" << std::endl;
96 std::cout <<
"[PASSED]" << std::endl;
98 std::cout <<
"Initializing an phi-/theta-plane (sphereParameterPlane) as parameter plane by " 99 "InitializeStandardPlane(rightVector, downVector, spacing = nullptr): " 103 widthInMM = 2 * vnl_math::pi;
105 heightInMM = vnl_math::pi;
111 sphereParameterPlane->InitializeStandardPlane(right, bottom);
112 sphereParameterPlane->SetOrigin(origin);
113 sphereParameterPlane->SetSizeInUnits(width, height);
115 std::cout <<
"Creating an vtkSphericalTransform (sphericalTransform) to use with sphereParameterPlane: " << std::endl;
116 vtkSphericalTransform *sphericalTransform = vtkSphericalTransform::New();
118 std::cout <<
"Setting sphereParameterPlane as parameter plane and sphericalTransform as transform of " 119 "VtkAbstractTransformPlaneGeometry: " 121 abstractgeometry->SetPlane(sphereParameterPlane);
122 abstractgeometry->SetVtkAbstractTransform(sphericalTransform);
124 std::cout <<
"Testing whether the bounds of sphereParameterPlane and the parametric bounds of " 125 "VtkAbstractTransformPlaneGeometry are equal: ";
126 if ((
mitk::Equal(const_cast<mitk::BoundingBox *>(abstractgeometry->GetParametricBoundingBox())->
GetMinimum(),
128 (
mitk::Equal(const_cast<mitk::BoundingBox *>(abstractgeometry->GetParametricBoundingBox())->GetMaximum(),
129 const_cast<mitk::BoundingBox *
>(sphereParameterPlane->GetBoundingBox())->GetMaximum()) ==
false))
131 std::cout <<
"[FAILED]" << std::endl;
134 std::cout <<
"[PASSED]" << std::endl;
136 std::cout <<
"Testing whether the parametic bounds of VtkAbstractTransformPlaneGeometry and the bounds of the plane " 137 "accessed from there are equal: ";
138 if ((
mitk::Equal(const_cast<mitk::BoundingBox *>(abstractgeometry->GetParametricBoundingBox())->
GetMinimum(),
141 (
mitk::Equal(const_cast<mitk::BoundingBox *>(abstractgeometry->GetParametricBoundingBox())->GetMaximum(),
142 const_cast<mitk::BoundingBox *
>(abstractgeometry->GetPlane()->GetBoundingBox())->GetMaximum()) ==
145 std::cout <<
"[FAILED]" << std::endl;
148 std::cout <<
"[PASSED]" << std::endl;
150 std::cout <<
"Testing mapping Map(pt2d_mm(phi=Pi,theta=Pi/2.0), pt3d_mm) and compare with expected (-radius, 0, 0): ";
153 pt2d_mm[0] = vnl_math::pi;
154 pt2d_mm[1] = vnl_math::pi_over_2;
156 abstractgeometry->Map(pt2d_mm, pt3d_mm);
157 if (
mitk::Equal(pt3d_mm, expected_pt3d_mm) ==
false)
159 std::cout <<
"[FAILED]" << std::endl;
162 std::cout <<
"[PASSED]" << std::endl;
164 std::cout <<
"Testing mapping Map(pt3d_mm, pt2d_mm) and compare with expected: ";
166 abstractgeometry->Map(pt3d_mm, testpt2d_mm);
169 std::cout <<
"[FAILED]" << std::endl;
172 std::cout <<
"[PASSED]" << std::endl;
174 std::cout <<
"Testing IndexToWorld(pt2d_units, pt2d_mm) and compare with expected: ";
176 pt2d_units[0] = width / 2.0;
177 pt2d_units[1] = height / 2.0;
178 pt2d_mm[0] = widthInMM / 2.0;
179 pt2d_mm[1] = heightInMM / 2.0;
180 abstractgeometry->IndexToWorld(pt2d_units, testpt2d_mm);
183 std::cout <<
"[FAILED]" << std::endl;
186 std::cout <<
"[PASSED]" << std::endl;
188 std::cout <<
"Change parametic bounds of VtkAbstractTransformPlaneGeometry and test whether they are equal to the " 189 "bounds of the plane accessed from there: " 193 abstractgeometry->SetParametricBounds(bounds);
194 if ((
mitk::Equal(const_cast<mitk::BoundingBox *>(abstractgeometry->GetParametricBoundingBox())->
GetMinimum(),
197 (
mitk::Equal(const_cast<mitk::BoundingBox *>(abstractgeometry->GetParametricBoundingBox())->GetMaximum(),
198 const_cast<mitk::BoundingBox *
>(abstractgeometry->GetPlane()->GetBoundingBox())->GetMaximum()) ==
201 std::cout <<
"[FAILED]" << std::endl;
204 std::cout <<
"[PASSED]" << std::endl;
206 std::cout <<
"Testing IndexToWorld(pt2d_units, pt2d_mm) and compare with expected: ";
207 pt2d_units[0] = width / 2.0;
208 pt2d_units[1] = height / 2.0;
209 pt2d_mm[0] = widthInMM / 2.0;
210 pt2d_mm[1] = heightInMM / 2.0;
211 abstractgeometry->IndexToWorld(pt2d_units, testpt2d_mm);
214 std::cout <<
"[FAILED]" << std::endl;
217 std::cout <<
"[PASSED]" << std::endl;
240 std::cout <<
"[TEST DONE]" << std::endl;
itk::BoundingBox< unsigned long, 3, ScalarType > BoundingBox
Standard 3D-BoundingBox typedef.
void GetMinimum(itk::Image< TPixel, VImageDimension > *itkImage, double &minimum)
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.