23 #include <itksys/SystemTools.hxx>
32 class mitkPointSetFileIOTestClass
36 std::string m_FilePath;
38 mitkPointSetFileIOTestClass() {}
39 ~mitkPointSetFileIOTestClass()
41 if (!m_FilePath.empty())
43 std::remove(m_FilePath.c_str());
50 std::uniform_real_distribution<> r(0, 1);
55 for (
unsigned int position = 0; position < 3; ++position)
59 pointSet->SetPoint(position, point, t);
62 m_SavedPointSet = pointSet;
65 if (geometry !=
nullptr)
68 timeGeometry->Initialize(geometry, numberOfTimeSeries);
69 pointSet->SetTimeGeometry(timeGeometry);
77 MITK_TEST_CONDITION(pointSet1->GetSize() == pointSet2->GetSize(),
"Testing if PointSet size is correct");
81 for (
unsigned int i = 0; i < (
unsigned int)pointSet1->GetSize(t); ++i)
87 std::cout <<
"r point: " << p2 << std::endl;
88 std::cout <<
"w point: " << p1 << std::endl;
93 "Testing if X coordinates of the Point are at the same Position");
95 "Testing if Y coordinates of the Point are at the same Position");
97 "Testing if Z coordinates of the Point are at the same Position");
103 "Restored geometry must equal original one.");
110 m_SavedPointSet = NULL;
112 std::ofstream tmpStream;
114 MITK_INFO <<
"PointSet test file at " << m_FilePath;
117 catch (std::exception &e)
119 MITK_ERROR <<
"Error during pointset creation: " << e.what();
126 void PointSetLoadAndCompareTest()
133 bool identical(
true);
134 PointSetCompare(pointSet.GetPointer(), m_SavedPointSet.GetPointer(), identical);
136 catch (std::exception &e)
138 MITK_ERROR <<
"Error during pointset creation: " << e.what();
150 mitkPointSetFileIOTestClass
test;
152 test.PointSetLoadAndCompareTest();
157 mitkPointSetFileIOTestClass
test;
165 bounds[0] = -918273645.18293746;
168 bounds[3] = 918273645.18293746;
171 g->SetBounds(bounds);
173 mitk::ScalarType matrixCoeffs[9] = {0.0, 1.1, 2.2, 3.3, 4.4, 5.5, 6.6, 7.7, 8.8};
175 mitk::AffineTransform3D::MatrixType matrix;
176 matrix.GetVnlMatrix().set(matrixCoeffs);
178 mitk::AffineTransform3D::OffsetType
offset;
179 offset[0] = -43.1829374;
181 offset[2] = +43.1829374;
184 transform->SetMatrix(matrix);
185 transform->SetOffset(offset);
186 g->SetIndexToWorldTransform(transform);
188 MITK_TEST_CONDITION(test.PointSetWrite(g),
"Testing if the PointSetWriter writes Data _with_ geometry");
189 test.PointSetLoadAndCompareTest();
static void Save(const mitk::BaseData *data, const std::string &path)
Save a mitk::BaseData instance.
itk::SmartPointer< Self > Pointer
BoundingBoxType::BoundsArrayType BoundsArrayType
Follow Up Storage - Class to facilitate loading/accessing structured follow-up data.
section GeneralTestsDeprecatedOldTestingStyle Deprecated macros All tests with MITK_TEST_BEGIN()
void FillVector3D(Tout &out, mitk::ScalarType x, mitk::ScalarType y, mitk::ScalarType z)
#define MITK_TEST_CONDITION(COND, MSG)
static mitk::PointSet::Pointer LoadPointSet(const std::string &path)
LoadPointSet Convenience method to load an arbitrary mitkPointSet.
unsigned int numberOfTimeSeries
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 std::string CreateTemporaryFile(std::ofstream &tmpStream, const std::string &templateName="XXXXXX", std::string path=std::string())
int mitkPointSetFileIOTest(int, char *[])
BaseGeometry Describes the geometry of a data object.
static itkEventMacro(BoundingShapeInteractionEvent, itk::AnyEvent) class MITKBOUNDINGSHAPE_EXPORT BoundingShapeInteractor Pointer New()
Basic interaction methods for mitk::GeometryData.