r117: *** empty log message ***
[ctsim.git] / include / phantom.h
index 32eedf6e9f933ee8e617e19eeef89b50266c5ba9..b3765c687970562ce7a44e365f9ebf5ceb0707b1 100644 (file)
@@ -9,7 +9,7 @@
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2000 Kevin Rosenberg
 **
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2000 Kevin Rosenberg
 **
-**  $Id: phantom.h,v 1.2 2000/06/19 20:08:09 kevin Exp $
+**  $Id: phantom.h,v 1.3 2000/06/22 10:17:28 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
 **
 **  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
@@ -95,6 +95,9 @@ class PhantomElement
     double  m_rectLimits[4];
 
     static const int POINTS_PER_CIRCLE = 360;
     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);
 
 
     void makeTransformMatrices (void);
 
@@ -104,7 +107,7 @@ class PhantomElement
 
     void calcEllipsePoints (double x[], double y[], const int pts, const double u, const double v);
 
 
     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);
 
 };
 
 
 };
 
@@ -120,7 +123,19 @@ typedef enum {
 class Phantom
 {
  public:
 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;
+
+
     Phantom (void);
     Phantom (void);
+    Phantom (const char* const phmName);
+
     ~Phantom (void);
 
     void setComposition (PhantomComposition composition)
     ~Phantom (void);
 
     void setComposition (PhantomComposition composition)
@@ -129,7 +144,9 @@ class Phantom
     const PhantomComposition getComposition (void) const
        { return m_composition; }
 
     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);
 
 
     bool createFromFile (const char* const fname);
 
@@ -141,12 +158,22 @@ class Phantom
 
     void convertToImagefile (ImageFile& im, const int in_nsample, const int trace) const;
 
 
     void convertToImagefile (ImageFile& im, const int in_nsample, const int trace) const;
 
+    bool fail(void) const 
+      {return m_fail;}
+
+    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 addStdHerman (void);
 #if HAVE_SGP
     void show (void) const;
     void draw (void) const;
 #endif
     
     void addStdHerman (void);
+    void addStdHermanBordered (void);
     void addStdRowland (void);
     void addStdRowlandBordered (void);
 
     void addStdRowland (void);
     void addStdRowlandBordered (void);
 
@@ -170,6 +197,19 @@ class Phantom
     double m_diameter;                        // diameter of object
     mutable slist<PhantomElement*> m_listPElem;      // pelem lists
     string m_name;
     double m_diameter;                        // diameter of object
     mutable slist<PhantomElement*> m_listPElem;      // pelem lists
     string m_name;
+    PhantomID m_id;
+    bool m_fail;
+
+    // Standard phantomsa
+    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 PhantomID convertNameToPhantomID (const char* const phmName);
+    static const char* convertPhantomIDToName (const PhantomID phmID);
+
+    void init(void);
 };
 
 typedef slist<PhantomElement*>::iterator PElemIterator;
 };
 
 typedef slist<PhantomElement*>::iterator PElemIterator;