22 #include <vnl/vnl_quaternion.h>
23 #include <vnl/vnl_quaternion.txx>
33 planeGeometry->Initialize();
40 slicedGeometry->InitializeSlicedGeometry(static_cast<unsigned int>(numberOfSlices));
41 slicedGeometry->SetOrigin(origin);
42 slicedGeometry->SetSpacing(spacing);
44 for (
unsigned int i = 0; i < numberOfSlices; ++i)
47 slicedGeometry->SetPlaneGeometry(planeGeometry, i);
50 return slicedGeometry;
56 slicedGeometry->InitializeEvenlySpaced(planeGeometry, spacing, numberOfSlices);
57 return slicedGeometry;
69 return createArray<mitk::Point3D>(x, y, z);
74 return createArray<mitk::Vector3D>(x, y, z);
86 MITK_TEST_OUTPUT(<<
"====== mitkSlicedGeometry3D_ChangeImageGeometryConsideringOriginOffset_Test() ======");
90 auto numberOfSlices = 5;
96 MITK_TEST_OUTPUT(<<
"First and last PlaneGeometry in SlicedGeometry3D are not image geometries");
97 auto firstPlaneGeometry = slicedGeometry->GetPlaneGeometry(0);
98 auto lastPlaneGeometry = slicedGeometry->GetPlaneGeometry(numberOfSlices - 1);
102 auto originOfSlicedGeometry = slicedGeometry->GetOrigin();
103 auto originOfFirstPlaneGeometry = firstPlaneGeometry->GetOrigin();
104 auto originOfLastPlaneGeometry = lastPlaneGeometry->GetOrigin();
105 auto firstCornerPointOfSlicedGeometry = slicedGeometry->GetCornerPoint(0);
106 auto secondCornerPointOfFirstPlaneGeometry = firstPlaneGeometry->GetCornerPoint(1);
107 auto thirdCornerPointOfLastPlaneGeometry = lastPlaneGeometry->GetCornerPoint(2);
109 MITK_TEST_OUTPUT(<<
"Calling SlicedGeometry3D::ChangeImageGeometryConsideringOriginOffset(true)");
110 slicedGeometry->ChangeImageGeometryConsideringOriginOffset(
true);
113 MITK_TEST_OUTPUT(<<
"First and last PlaneGeometry in SlicedGeometry3D are image geometries");
124 MITK_TEST_CONDITION_REQUIRED(firstPlaneGeometry->GetOrigin() == originOfFirstPlaneGeometry + firstPlaneGeometry->GetSpacing() * 0.5,
"");
127 MITK_TEST_OUTPUT(<<
"Calling SlicedGeometry3D::ChangeImageGeometryConsideringOriginOffset(false)");
128 slicedGeometry->ChangeImageGeometryConsideringOriginOffset(
false);
131 MITK_TEST_OUTPUT(<<
"First and last PlaneGeometry in SlicedGeometry3D are no image geometries anymore");
162 planeGeometry->InitializeStandardPlane(right, bottom, &spacing);
164 auto numberOfSlices = 5;
166 auto firstPlaneGeometry = slicedGeometry->GetPlaneGeometry(0);
168 MITK_TEST_OUTPUT(<<
"Check if first PlaneGeometry of evenly spaced SlicedGeometry is valid");
174 auto lastPlaneGeometry = slicedGeometry->GetPlaneGeometry(numberOfSlices - 1);
175 auto expectedOriginOfLastSlice =
createPoint(0.0, 0.0, thicknessInMM * (numberOfSlices - 1));
177 MITK_TEST_OUTPUT(<<
"Check if origin of last PlaneGeometry is at expected location");
182 std::cout <<
"[TEST DONE]" << std::endl;
static const mitk::ScalarType slicedGeometryEps
static T createArray(mitk::ScalarType x, mitk::ScalarType y, mitk::ScalarType z)
vnl_vector< ScalarType > VnlVector
#define MITK_TEST_CONDITION_REQUIRED(COND, MSG)
void mitkSlicedGeometry3D_ChangeImageGeometryConsideringOriginOffset_Test()
static mitk::Point3D createPoint(mitk::ScalarType x, mitk::ScalarType y, mitk::ScalarType z)
void FillVector3D(Tout &out, mitk::ScalarType x, mitk::ScalarType y, mitk::ScalarType z)
static mitk::Vector3D createVector(mitk::ScalarType x, mitk::ScalarType y, mitk::ScalarType z)
static mitk::SlicedGeometry3D::Pointer createSlicedGeometry(const mitk::Point3D &origin, const mitk::Vector3D &spacing, int numberOfSlices)
#define MITK_TEST_OUTPUT(x)
Output some text.
static mitk::SlicedGeometry3D::Pointer createEvenlySpacedSlicedGeometry(mitk::PlaneGeometry::Pointer planeGeometry, mitk::ScalarType spacing, int numberOfSlices)
int mitkSlicedGeometry3DTest(int, char *[])
static mitk::PlaneGeometry::Pointer createPlaneGeometry()
static mitk::VnlVector createVnlVector(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.