#include "mitkTestingMacros.h"
#include "mitkPlanarAngle.h"
#include "mitkPlanarCircle.h"
#include "mitkPlanarCross.h"
#include "mitkPlanarFourPointAngle.h"
#include "mitkPlanarLine.h"
#include "mitkPlanarPolygon.h"
#include "mitkPlanarRectangle.h"
#include "mitkPlanarFigureWriter.h"
#include "mitkPlanarFigureReader.h"
#include "mitkPlaneGeometry.h"
#include <itksys/SystemTools.hxx>
Go to the source code of this file.
Classes | |
class | PlanarFigureIOTestClass |
Helper class for testing PlanarFigure reader and writer classes. More... | |
class | PlanarFigureIOTestClass::PropertyMapEntryCompare |
Functions | |
int | mitkPlanarFigureIOTest (int, char *[]) |
Test for PlanarFigure reader and writer classes. |
int mitkPlanarFigureIOTest | ( | int | , |
char * | [] | ||
) |
Test for PlanarFigure reader and writer classes.
The test works as follows:
First, a number of PlanarFigure objects of different types are created and placed with various control points. These objects are the serialized to file, read again from file, and the retrieved objects are compared with their control points, properties, and geometry information to the original PlanarFigure objects.
Definition at line 333 of file mitkPlanarFigureIOTest.cpp.
References PlanarFigureIOTestClass::CreatePlanarFigures(), PlanarFigureIOTestClass::DeserializePlanarFigures(), MITK_TEST_BEGIN, MITK_TEST_END, PlanarFigureIOTestClass::SerializePlanarFigures(), and PlanarFigureIOTestClass::VerifyPlanarFigures().
{ MITK_TEST_BEGIN("PlanarFigureIO") // Create a number of PlanarFigure objects PlanarFigureIOTestClass::PlanarFigureList originalPlanarFigures = PlanarFigureIOTestClass::CreatePlanarFigures(); // Write PlanarFigure objects into temp file // tmpname static unsigned long count = 0; unsigned long n = count++; std::ostringstream name; for (int i = 0; i < 6; ++i) { name << char('a' + (n % 26)); n /= 26; } std::string myname; myname.append(name.str()); std::string fileName = itksys::SystemTools::GetCurrentWorkingDirectory() + myname + ".pf"; PlanarFigureIOTestClass::SerializePlanarFigures( originalPlanarFigures, fileName ); // Read PlanarFigure objects from temp file PlanarFigureIOTestClass::PlanarFigureList retrievedPlanarFigures = PlanarFigureIOTestClass::DeserializePlanarFigures( fileName ); // Test if original and retrieved PlanarFigure objects are the same PlanarFigureIOTestClass::VerifyPlanarFigures( originalPlanarFigures, retrievedPlanarFigures ); MITK_TEST_END() }