X-Git-Url: http://git.kpe.io/?a=blobdiff_plain;f=include%2Fphantom.h;h=dbaf169fc430d46ba8d7f09b12c773d112607505;hb=ab4a3ba2c1ba9672136b5022897f81fc55d03493;hp=21b08c40822e0ba769d53b7832fc87ff589abf95;hpb=63ddd1048df804cc73f21c1cdaf70f32324d0197;p=ctsim.git diff --git a/include/phantom.h b/include/phantom.h index 21b08c4..dbaf169 100644 --- a/include/phantom.h +++ b/include/phantom.h @@ -9,7 +9,7 @@ ** This is part of the CTSim program ** Copyright (C) 1983-2000 Kevin Rosenberg ** -** $Id: phantom.h,v 1.1 2000/06/19 18:45:36 kevin Exp $ +** $Id: phantom.h,v 1.8 2000/07/19 04:33:27 kevin Exp $ ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License (version 2) as @@ -56,7 +56,7 @@ class PhantomElement ~PhantomElement (void); - bool isPointInside (double x, double y, const CoordType coord_type); + bool isPointInside (double x, double y, const CoordType coord_type) const; bool clipLineNormalizedCoords (double& x1, double& y1, double& x2, double& y2) const; @@ -80,9 +80,9 @@ class PhantomElement private: PhmElemType m_type; // pelem type (box, ellipse, etc) - double m_atten; // X-ray attenuation coefficient double m_cx, m_cy; // center of pelem double m_u, m_v; // size of pelem + double m_atten; // X-ray attenuation coefficient double m_rot; // pelem rotation angle (in radians) double *m_x, *m_y; // ptr to array of points in obj world coord int m_nPoints; // number of points in outline arrays @@ -95,6 +95,9 @@ class PhantomElement double m_rectLimits[4]; static const int POINTS_PER_CIRCLE = 360; + static const double SCALE_PELEM_EXTENT=0.005; // increase pelem limits by 0.5% + + static PhmElemType PhantomElement::convertNameToType (const char* const typeName); void makeTransformMatrices (void); @@ -104,8 +107,10 @@ class PhantomElement void calcEllipsePoints (double x[], double y[], const int pts, const double u, const double v); - int numCirclePoints (double theta) const; + static int numCirclePoints (double theta); + PhantomElement (const PhantomElement& rhs); // copy constructor + PhantomElement& operator= (const PhantomElement&); // assignment operator }; @@ -120,7 +125,30 @@ typedef enum { class Phantom { public: + typedef enum { + PHM_INVALID, + PHM_HERMAN, /* Herman head phantom */ + PHM_BHERMAN, /* Bordered Herman head phantom */ + PHM_ROWLAND, /* Rowland head phantom */ + PHM_BROWLAND, /* Bordered Rowland head phantom */ + PHM_UNITPULSE /* Unit pulse phantom */ + } PhantomID; + + static const char PHM_HERMAN_STR[]= "herman"; + static const char PHM_BHERMAN_STR[]= "bherman"; + static const char PHM_ROWLAND_STR[]= "rowland"; + static const char PHM_BROWLAND_STR[]= "browland"; + static const char PHM_UNITPULSE_STR[]= "unitpulse"; + + static const char PHM_HERMAN_TITLE_STR[]= "Herman Head"; + static const char PHM_BHERMAN_TITLE_STR[]= "Herman Head Bordered"; + static const char PHM_ROWLAND_TITLE_STR[]= "Rowland Head"; + static const char PHM_BROWLAND_TITLE_STR[]= "Rowland Head Bordered"; + static const char PHM_UNITPULSE_TITLE_STR[]= "Unit Pulse"; + Phantom (void); + Phantom (const char* const phmName); + ~Phantom (void); void setComposition (PhantomComposition composition) @@ -129,7 +157,9 @@ class Phantom const PhantomComposition getComposition (void) const { return m_composition; } - void create (const int phmid); + bool createFromPhantom (const char* const phmName); + + bool createFromPhantom (const PhantomID phmid); bool createFromFile (const char* const fname); @@ -137,18 +167,26 @@ class Phantom void addPElem (const char* const composition, const double cx, const double cy, const double u, const double v, const double rot, const double atten); - void print (void) const; + void convertToImagefile (ImageFile& im, const int in_nsample, const int trace, const int colStart, const int colCount) const; + + void convertToImagefile (ImageFile& im, const int in_nsample, const int trace) const; + + bool fail(void) const {return m_fail;} + const string& failMessage(void) const {return m_failMessage;} + const string& name(void) const {return m_name;} + const PhantomID id(void) const {return m_id;} #if HAVE_SGP void show (void) const; void draw (void) const; #endif - void std_herman (void); + void addStdHerman (void); + void addStdHermanBordered (void); + void addStdRowland (void); + void addStdRowlandBordered (void); - void std_rowland (void); - - void std_rowland_bordered (void); + void print (void) const; const double maxAxisLength (void) const {return (((m_xmax - m_xmin) > (m_ymax - m_ymin)) ? (m_xmax - m_xmin) : (m_ymax - m_ymin));} @@ -168,6 +206,18 @@ class Phantom double m_diameter; // diameter of object mutable slist m_listPElem; // pelem lists string m_name; + PhantomID m_id; + bool m_fail; + string m_failMessage; + + // Standard phantomsa + static PhantomID convertNameToPhantomID (const char* const phmName); + static const char* convertPhantomIDToName (const PhantomID phmID); + + void init(void); + + Phantom (const Phantom& rhs); // copy constructor + Phantom& operator= (const Phantom&); // assignment operator }; typedef slist::iterator PElemIterator;