** This is part of the CTSim program
** Copyright (c) 1983-2001 Kevin Rosenberg
**
-** $Id: phantom.cpp,v 1.27 2001/01/28 19:10:18 kevin Exp $
+** $Id: phantom.cpp,v 1.28 2001/02/08 06:25:07 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
m_xmax = -1E30;
m_ymin = 1E30;
m_ymax = -1E30;
- m_diameter = 0;
m_composition = P_PELEMS;
m_fail = false;
m_id = PHM_INVALID;
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++;
}
*/
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 phmradius = phmlen / 2;
+ double dHalflen = dViewRatio * (getDiameterBoundaryCircle() / SQRT2 / 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;
}