// $Id: Phantom.cpp,v 1.2 2006/08/02 03:39:28 pkaz Exp $ // // Contains Phantom class. This is static class that contains design // information about the phantom -- primarily the names of the points // and the CNC coordinates. It could have been implemented using the // Singleton design pattern and/or it could read the CNC data from a // file rather than having it hard-coded. #include "phantom.h" // Point names for Delrin Test Block char *Phantom::names[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "R1", "R2", "R3", "R4", "C1", "C2" }; // Total number of points int Phantom::numpts = sizeof(Phantom::names)/sizeof(char *); // Number of registration points. Should be consistent with Phantom::IsRegpoint(). int Phantom::numregpts = 4; // CNC values of points. vctDouble3 Phantom::values[] = { vctDouble3( 10, 9.125, 0), vctDouble3( 10, 22.5, -30), vctDouble3( 10, 40.875, 0), vctDouble3( 20, 27.5, -20), vctDouble3( 30, 32.5, -10), vctDouble3( 35, 17.5, -15), vctDouble3( 40, 22.5, -30), vctDouble3( 40, 45, 0), vctDouble3( 50, 27.5, -20), vctDouble3( 50.64, 40.875, 0), vctDouble3( 55.72, 9.125, 0), vctDouble3( 65, 32.5, -10), vctDouble3( 70, 22.5, -30), vctDouble3( 75, 45, 0), vctDouble3( 80, 27.5, -20), vctDouble3( 85, 17.5, -15), vctDouble3(100, 22.5, -30), vctDouble3(100, 32.5, -10), vctDouble3(110, 5, -10), vctDouble3(110, 45, 0), vctDouble3( 20, 9.125, -12), vctDouble3( 20, 40.875, -12), vctDouble3( 60.64, 40.875, -12), vctDouble3( 65.72, 9.125, -12), vctDouble3( 45, 7, 0), vctDouble3( 90, 5, -5) }; // LookupName: return the index associated with the point name. int Phantom::LookupName(char *name) { int i; // Get rid of ':' at end of name int len = strlen(name); if (name[len-1] == ':') name[len-1] = 0; for (i = 0; i < numpts; i++) { if (strcmp(name, names[i]) == 0) return i; } return -1; } // IsRegpoint: return true if the specified point should be used for registration bool Phantom::IsRegpoint(int i) { char* ptname = names[i]; return (strcmp(ptname, "1") == 0) || (strcmp(ptname, "3") == 0) || (strcmp(ptname, "10") == 0) || (strcmp(ptname, "11") == 0); }