** This is part of the CTSim program
** Copyright (C) 1983-2000 Kevin Rosenberg
**
-** $Id: phantom.cpp,v 1.7 2000/07/15 08:36:13 kevin Exp $
+** $Id: phantom.cpp,v 1.8 2000/07/18 03:14:35 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
ImageFileArray v = im.getArray();
+ for (int ix = 0; ix < colCount; ix++)
+ for (int iy = 0; iy < ny; iy++)
+ v[ix][iy] = 0;
+
double x_start = xmin + (colStart * xinc);
for (PElemConstIterator pelem = m_listPElem.begin(); pelem != m_listPElem.end(); pelem++) {
- double x, y, xi, yi;
- int ix, iy, kx, ky;
- for (ix = 0, x = x_start; ix < colCount; ix++, x += xinc) {
- for (iy = 0, y = ymin; iy < ny; iy++, y += yinc) {
- for (kx = 0, xi = x + kxofs; kx < nsample; kx++, xi += kxinc) {
- for (ky = 0, yi = y + kyofs; ky < nsample; ky++, yi += kyinc)
- if ((*pelem)->isPointInside (xi, yi, PHM_COORD) == TRUE)
- v[ix][iy] += (*pelem)->atten();
- } // for kx
- } /* for iy */
- } /* for ix */
+ const PhantomElement& rPElem = **pelem;
+ double x, y, xi, yi;
+ int ix, iy, kx, ky;
+ for (ix = 0, x = x_start; ix < colCount; ix++, x += xinc) {
+ for (iy = 0, y = ymin; iy < ny; iy++, y += yinc) {
+ for (kx = 0, xi = x + kxofs; kx < nsample; kx++, xi += kxinc) {
+ for (ky = 0, yi = y + kyofs; ky < nsample; ky++, yi += kyinc)
+ if (rPElem.isPointInside (xi, yi, PHM_COORD) == TRUE)
+ v[ix][iy] += rPElem.atten();
+ } // for kx
+ } /* for iy */
+ } /* for ix */
} /* for pelem */
// false if point lies outside of pelem
bool
-PhantomElement::isPointInside (double x, double y, const CoordType coord_type)
+PhantomElement::isPointInside (double x, double y, const CoordType coord_type) const
{
if (coord_type == PHM_COORD) {
xform_mtx2 (m_xformPhmToObj, x, y);