| 19 | #include <mitkContourModel.h> |
| 20 | |
| 21 | static 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 | |
| 53 | static void TestContourModelIO_OneTimeStep() |
| 54 | { |
no test coverage detected