19 #include "itkPSMPointTree.h" 24 int itkPSMPointTreeTest(
int,
char* [])
26 typedef itk::Point<double, 3> PointType;
27 const unsigned int SZ = 10;
30 std::string errstring =
"";
39 lb[0] = 0.0f; lb[1] = 0.0f; lb[2] = 0.0f;
40 ub[0] = ub[1] = ub[2] =
static_cast<double>(SZ);
45 for (
unsigned int x = 1; x < SZ; x++)
47 for (
unsigned int y = 1; y < SZ; y++)
49 for (
unsigned int z = 1; z < SZ; z++)
51 pt[0] =
static_cast<double>(x);
52 pt[1] =
static_cast<double>(y);
53 pt[2] =
static_cast<double>(z);
62 ub[0] =
static_cast<double>(SZ/2);
63 ub[1] =
static_cast<double>(SZ/2);
64 ub[2] =
static_cast<double>(SZ/2);
71 if ( (*it)->Point[0] > ub[0] || (*it)->Point[1] > ub[1] || (*it)->Point[2] > ub[2] )
74 errstring =
"Points were sorted into the wrong tree bin.";
78 catch(itk::ExceptionObject &e)
80 errstring =
"ITK exception with description: " + std::string(e.GetDescription())
81 + std::string(
"\n at location:") + std::string(e.GetLocation())
82 + std::string(
"\n in file:") + std::string(e.GetFile());
87 errstring =
"Unknown exception thrown";
93 std::cout <<
"All tests passed" << std::endl;
98 std::cout <<
"Test failed with the following error:" << std::endl;
99 std::cout << errstring << std::endl;
PointListType::iterator AddPoint(const PointType &, unsigned int, NodePointerType &)
void ConstructTree(const PointType &, const PointType &, unsigned int)
PointIteratorListType FindPointsInRegion(const PointType &, const PointType &) const