32 #include "vnl/vnl_vector.h"
33 #include <itkAffineGeometryFrame.h>
51 m_Geometries.reserve(100);
54 for (
unsigned int i = 0; i < 100; ++i)
79 vnl_vector<mitk::ScalarType> normal = vnl_cross_3d(rightVector.GetVnlVector(), downVector.GetVnlVector());
85 origin[0] = 12 + 0.03 * i;
89 matrix.GetVnlMatrix().set_column(0, rightVector.GetVnlVector());
90 matrix.GetVnlMatrix().set_column(1, downVector.GetVnlVector());
91 matrix.GetVnlMatrix().set_column(2, normal);
92 transform->SetMatrix(matrix);
93 transform->SetOffset(origin);
95 plane->InitializeStandardPlane(width, height, transform, views[i % 3], i,
true,
false);
97 m_Geometries.push_back(plane);
105 MITK_TEST_OUTPUT(<<
"Starting Test: ######### A d d P l a n e P o s i t i o n #########");
121 for (
unsigned int i = 1; i < m_Geometries.size(); ++i)
129 "Checking for correct number of planepositions");
140 for (
unsigned int i = 0; i < (m_Geometries.size() - 1) * 0.5; ++i)
147 "Checking for correct number of planepositions");
160 MITK_TEST_OUTPUT(<<
"Starting Test: ######### G e t P l a n e P o s i t i o n #########");
163 for (
unsigned int i = 0; i < m_Geometries.size(); ++i)
165 auto plane = m_Geometries.at(i);
168 (!
mitk::Equal(op->GetHeight(), plane->GetExtent(1)) || !
mitk::Equal(op->GetWidth(), plane->GetExtent(0)) ||
169 !
mitk::Equal(op->GetSpacing(), plane->GetSpacing()) ||
170 !
mitk::Equal(op->GetTransform()->GetOffset(), plane->GetIndexToWorldTransform()->GetOffset()) ||
171 !
mitk::Equal(op->GetDirectionVector().GetVnlVector(),
172 plane->GetIndexToWorldTransform()->GetMatrix().GetVnlMatrix().get_column(2).normalize()) ||
180 "Checking for correct extent");
183 "Checking for correct offset");
184 MITK_INFO <<
"Op: " << op->GetDirectionVector()
185 <<
" plane: " << plane->GetIndexToWorldTransform()->GetMatrix().GetVnlMatrix().get_column(2) <<
"\n";
187 plane->GetIndexToWorldTransform()->GetMatrix().GetVnlMatrix().get_column(2)),
188 "Checking for correct direction");
191 "Checking for correct matrix");
211 MITK_TEST_OUTPUT(<<
"Starting Test: ######### R e m o v e P l a n e P o s i t i o n #########");
227 for (
unsigned int i = 0; i < m_Geometries.size() * 0.5; i++)
231 removed = (size2 == (size - (i + 1)));
245 MITK_TEST_OUTPUT(<<
"Starting Test: ######### R e m o v e A l l #########");
ServiceReferenceU GetServiceReference(const std::string &clazz)
itk::SmartPointer< Self > Pointer
bool MatrixEqualElementWise(const vnl_matrix_fixed< TCoordRep, NRows, NCols > &matrix1, const vnl_matrix_fixed< TCoordRep, NRows, NCols > &matrix2, mitk::ScalarType epsilon=mitk::eps)
Check for element-wise matrix equality with a user defined accuracy.
int testGetPlanePosition()
#define MITK_TEST_CONDITION_REQUIRED(COND, MSG)
section GeneralTestsDeprecatedOldTestingStyle Deprecated macros All tests with MITK_TEST_BEGIN()
Constants for most interaction classes, due to the generic StateMachines.
mitk::RestorePlanePositionOperation * GetPlanePosition(unsigned int ID)
Getter for a specific plane position with a given ID.
void FillVector3D(Tout &out, mitk::ScalarType x, mitk::ScalarType y, mitk::ScalarType z)
void * GetService(const ServiceReferenceBase &reference)
std::vector< unsigned int > m_SliceIndices
int testRemovePlanePosition()
#define MITK_TEST_OUTPUT(x)
Output some text.
#define MITK_TEST_CONDITION(COND, MSG)
bool RemovePlanePosition(unsigned int ID)
Removes the plane at the position ID from the list.
mitk::PlanePositionManagerService * m_Service
std::vector< mitk::PlaneGeometry::Pointer > m_Geometries
int mitkPlanePositionManagerTest(int, char *[])
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.
int testAddPlanePosition()
unsigned int GetNumberOfPlanePositions()
Getting the number of all stored planes.
unsigned int AddNewPlanePosition(const mitk::PlaneGeometry *plane, unsigned int sliceIndex=0)
Adds a new plane position to the list. If this geometry is identical to one of the list nothing will ...
static ModuleContext * GetModuleContext()
Returns the module context of the calling module.
void RemoveAllPlanePositions()
Clears the complete positionlist.
static itkEventMacro(BoundingShapeInteractionEvent, itk::AnyEvent) class MITKBOUNDINGSHAPE_EXPORT BoundingShapeInteractor Pointer New()
Basic interaction methods for mitk::GeometryData.