MCPcopy Create free account
hub / github.com/MITK/MITK / TestContourModel

Function TestContourModel

Modules/ContourModel/Testing/mitkContourModelIOTest.cpp:21–51  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

19#include <mitkContourModel.h>
20
21static void TestContourModel(mitk::ContourModel *contour, std::string fileName)
22{
23 std::string filename = std::string(MITK_TEST_OUTPUT_DIR) + fileName;
24
25 mitk::IOUtil::Save(contour, filename);
26
27 std::vector<itk::SmartPointer<mitk::BaseData>> readerOutput = mitk::IOUtil::Load(filename);
28
29 mitk::ContourModel::Pointer contour2 = dynamic_cast<mitk::ContourModel *>(readerOutput.at(0).GetPointer());
30
31 MITK_TEST_CONDITION_REQUIRED(contour2.IsNotNull(), "contour is not null");
32
33 MITK_TEST_CONDITION_REQUIRED(contour->GetNumberOfVertices() == contour2->GetNumberOfVertices(),
34 "contours have the same number of vertices");
35
36 auto it = contour2->IteratorBegin();
37 auto end = contour2->IteratorEnd();
38
39 auto it2 = contour2->IteratorBegin();
40
41 bool areEqual = true;
42
43 while (it != end)
44 {
45 areEqual &= ((*it)->Coordinates == (*it2)->Coordinates);
46 it++;
47 it2++;
48 }
49
50 MITK_TEST_CONDITION(areEqual, "contours are equal");
51}
52
53static void TestContourModelIO_OneTimeStep()
54{

Callers 1

Calls 7

LoadFunction · 0.85
GetPointerMethod · 0.80
atMethod · 0.80
IsNotNullMethod · 0.80
GetNumberOfVerticesMethod · 0.80
IteratorBeginMethod · 0.45
IteratorEndMethod · 0.45

Tested by

no test coverage detected