19 #include <itksys/SystemTools.hxx> 28 class mitkPointSetFileIOTestClass
32 std::string m_FilePath;
34 mitkPointSetFileIOTestClass() {}
35 ~mitkPointSetFileIOTestClass()
37 if (!m_FilePath.empty())
39 std::remove(m_FilePath.c_str());
46 std::uniform_real_distribution<> r(0, 1);
51 for (
unsigned int position = 0; position < 3; ++position)
55 pointSet->SetPoint(position, point, t);
58 m_SavedPointSet = pointSet;
61 if (geometry !=
nullptr)
64 timeGeometry->Initialize(geometry, numberOfTimeSeries);
65 pointSet->SetTimeGeometry(timeGeometry);
73 MITK_TEST_CONDITION(pointSet1->GetSize() == pointSet2->GetSize(),
"Testing if PointSet size is correct");
77 for (
unsigned int i = 0; i < (
unsigned int)pointSet1->GetSize(t); ++i)
83 std::cout <<
"r point: " << p2 << std::endl;
84 std::cout <<
"w point: " << p1 << std::endl;
89 "Testing if X coordinates of the Point are at the same Position");
91 "Testing if Y coordinates of the Point are at the same Position");
93 "Testing if Z coordinates of the Point are at the same Position");
99 "Restored geometry must equal original one.");
106 m_SavedPointSet =
nullptr;
108 std::ofstream tmpStream;
110 MITK_INFO <<
"PointSet test file at " << m_FilePath;
113 catch (std::exception &e)
115 MITK_ERROR <<
"Error during pointset creation: " << e.what();
122 void PointSetLoadAndCompareTest()
129 bool identical(
true);
130 PointSetCompare(pointSet.GetPointer(), m_SavedPointSet.GetPointer(), identical);
132 catch (std::exception &e)
134 MITK_ERROR <<
"Error during pointset creation: " << e.what();
146 mitkPointSetFileIOTestClass
test;
148 test.PointSetLoadAndCompareTest();
153 mitkPointSetFileIOTestClass
test;
161 bounds[0] = -918273645.18293746;
164 bounds[3] = 918273645.18293746;
167 g->SetBounds(bounds);
169 mitk::ScalarType matrixCoeffs[9] = {0.0, 1.1, 2.2, 3.3, 4.4, 5.5, 6.6, 7.7, 8.8};
171 mitk::AffineTransform3D::MatrixType matrix;
172 matrix.GetVnlMatrix().set(matrixCoeffs);
174 mitk::AffineTransform3D::OffsetType
offset;
175 offset[0] = -43.1829374;
177 offset[2] = +43.1829374;
179 mitk::AffineTransform3D::Pointer transform = mitk::AffineTransform3D::New();
180 transform->SetMatrix(matrix);
181 transform->SetOffset(offset);
182 g->SetIndexToWorldTransform(transform);
184 MITK_TEST_CONDITION(test.PointSetWrite(g),
"Testing if the PointSetWriter writes Data _with_ geometry");
185 test.PointSetLoadAndCompareTest();
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)
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 void Save(const mitk::BaseData *data, const std::string &path, bool setPathProperty=false)
Save a mitk::BaseData instance.
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.