** Date Started: Aug 1984
**
** This is part of the CTSim program
-** Copyright (C) 1983-2000 Kevin Rosenberg
+** Copyright (c) 1983-2001 Kevin Rosenberg
**
-** $Id: phantom.cpp,v 1.26 2001/01/02 16:02:13 kevin Exp $
+** $Id: phantom.cpp,v 1.29 2001/02/09 14:34:16 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
const int Phantom::PHM_INVALID = -1;
const int Phantom::PHM_HERMAN = 0;
-const int Phantom::PHM_B_HERMAN = 1;
-const int Phantom::PHM_SHEPP_LOGAN = 2;
-const int Phantom::PHM_B_SHEPP_LOGAN = 3;
-const int Phantom::PHM_UNITPULSE = 4;
+const int Phantom::PHM_SHEPP_LOGAN = 1;
+const int Phantom::PHM_UNITPULSE = 2;
const char* Phantom::s_aszPhantomName[] =
{
{"herman"},
- {"herman-b"},
{"shepp-logan"},
- {"shepp-logan-b"},
- {"unitpulse"},
+ {"unit-pulse"},
};
const char* Phantom::s_aszPhantomTitle[] =
{
{"Herman Head"},
- {"Herman Head (Bordered)"},
{"Shepp-Logan"},
- {"Shepp-Logan (Bordered)"},
{"Unit Pulse"},
};
m_xmax = -1E30;
m_ymin = 1E30;
m_ymax = -1E30;
- m_diameter = 0;
m_composition = P_PELEMS;
m_fail = false;
m_id = PHM_INVALID;
case PHM_HERMAN:
addStdHerman();
break;
- case PHM_B_HERMAN:
- addStdHermanBordered();
- break;
case PHM_SHEPP_LOGAN:
addStdSheppLogan();
break;
- case PHM_B_SHEPP_LOGAN:
- addStdSheppLoganBordered();
- break;
case PHM_UNITPULSE:
m_composition = P_UNIT_PULSE;
addPElem ("rectangle", 0., 0., 100., 100., 0., 0.); // outline
if (m_ymin > pelem->ymin()) m_ymin = pelem->ymin();
if (m_ymax < pelem->ymax()) m_ymax = pelem->ymax();
- if (m_diameter < pelem->diameter())
- m_diameter = pelem->diameter();
-
- // m_diameter = lineLength(m_xmin, m_ymin, m_xmax, m_ymax);
-
m_nPElem++;
}
addPElem ("ellipse", 0.5538, -0.3858, 0.0330, 0.2060, -18.0, 0.03);
}
-void
-Phantom::addStdSheppLoganBordered ()
-{
- addStdSheppLogan ();
- addPElem ("rectangle", 0.000, 0.0000, 0.8600, 1.150, 0.0, 0.00);
-}
/* NAME
* addStdHerman Standard head phantom of G. T. Herman
addPElem ("ellipse", 0.000, 0.00, 7.875, 5.7187, 90.00, -0.206);
}
-void
-Phantom::addStdHermanBordered ()
-{
- addStdHerman();
- addPElem ("rectangle", 0.000, 0.00, 10.780, 8.110, 90.00, 0.000);
-}
/* NAME
*/
void
-Phantom::convertToImagefile (ImageFile& im, const int in_nsample, const int trace) const
+Phantom::convertToImagefile (ImageFile& im, double dViewRatio, const int in_nsample, const int trace) const
{
- convertToImagefile (im, in_nsample, trace, 0, im.nx(), true);
+ convertToImagefile (im, dViewRatio, in_nsample, trace, 0, im.nx(), true);
}
void
-Phantom::convertToImagefile (ImageFile& im, const int in_nsample, const int trace, const int colStart, const int colCount, bool bStoreAtColumnPos) const
+Phantom::convertToImagefile (ImageFile& im, const double dViewRatio, const int in_nsample, const int trace, const int colStart, const int colCount, bool bStoreAtColumnPos) const
{
int nx = im.nx();
int ny = im.ny();
double dy = m_ymax - m_ymin;
double xcent = m_xmin + dx / 2;
double ycent = m_ymin + dy / 2;
- double phmlen = (dx > dy ? dx : dy);
+ double dHalflen = dViewRatio * (getDiameterBoundaryCircle() / SQRT2 / 2);
- double phmradius = phmlen / 2;
-
- double xmin = xcent - phmradius;
- double xmax = xcent + phmradius;
- double ymin = ycent - phmradius;
- double ymax = ycent + phmradius;
+ double xmin = xcent - dHalflen;
+ double xmax = xcent + dHalflen;
+ double ymin = ycent - dHalflen;
+ double ymax = ycent + dHalflen;
// Each pixel holds the average of the intensity of the cell with (ix,iy) at the center of the pixel
// Set major increments so that the last cell v[nx-1][ny-1] will start at xmax - xinc, ymax - yinc).
makeTransformMatrices (); // calc transform matrices between phantom and normalized phantomelement
makeVectorOutline (); // calculate vector outline of pelem
- // Find maximum diameter of Object
- double r2Max = 0;
- for (int i = 0; i < m_nPoints; i++) {
- double r2 = (m_xOutline[i] * m_xOutline[i]) + (m_yOutline[i] * m_yOutline[i]);
- if (r2 > r2Max)
- r2Max = r2;
- }
- m_diameter = 2 * sqrt( r2Max );
-
m_rectLimits[0] = m_xmin; m_rectLimits[1] = m_ymin;
m_rectLimits[2] = m_xmax; m_rectLimits[3] = m_ymax;
}