X-Git-Url: http://git.kpe.io/?p=ctsim.git;a=blobdiff_plain;f=libctsim%2Fphantom.cpp;h=9125e36be718af7ea36959b42bf5461cd673f0ab;hp=6058ce77e947c6789bb8919088d54b1b8d25474a;hb=f7d2b7144f32a7bd157b7689022e62944b82fcc1;hpb=01ee1e0085970643368d65c38b09008927e24cd5 diff --git a/libctsim/phantom.cpp b/libctsim/phantom.cpp index 6058ce7..9125e36 100644 --- a/libctsim/phantom.cpp +++ b/libctsim/phantom.cpp @@ -9,7 +9,7 @@ ** This is part of the CTSim program ** Copyright (C) 1983-2000 Kevin Rosenberg ** -** $Id: phantom.cpp,v 1.20 2000/12/04 05:36:57 kevin Exp $ +** $Id: phantom.cpp,v 1.23 2000/12/21 03:40:58 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 @@ -27,8 +27,8 @@ #include "ct.h" -const int Phantom::POINTS_PER_CIRCLE = 360; -const double Phantom::SCALE_PELEM_EXTENT=0.005; // increase pelem limits by 0.5% +const int PhantomElement::POINTS_PER_CIRCLE = 360; +const double PhantomElement::SCALE_PELEM_EXTENT=0.005; // increase pelem limits by 0.5% const int Phantom::PHM_INVALID = -1; const int Phantom::PHM_HERMAN = 0; @@ -311,7 +311,7 @@ Phantom::show () const show (sgp); - cout << "Press return to continue"; + std::cout << "Press return to continue"; cio_kb_getc(); } @@ -482,7 +482,7 @@ Phantom::convertToImagefile (ImageFile& im, const int in_nsample, const int trac for (int iy = 0; iy < ny; iy++) { int iColStore = ix; if (bStoreAtColumnPos) - iColStore += colStart; + iColStore += colStart; v[iColStore][iy] = 0; } @@ -499,7 +499,7 @@ Phantom::convertToImagefile (ImageFile& im, const int in_nsample, const int trac 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[iColStore][iy] += rPElem.atten(); + v[iColStore][iy] += rPElem.atten(); } // for kx } /* for iy */ } /* for ix */ @@ -507,11 +507,16 @@ Phantom::convertToImagefile (ImageFile& im, const int in_nsample, const int trac if (nsample > 1) { - double factor = 1.0 / (nsample * nsample); - - for (int ix = 0; ix < colCount; ix++) - for (int iy = 0; iy < ny; iy++) - v[ix][iy] *= factor; + double factor = 1.0 / static_cast(nsample * nsample); + + + for (int ix = 0; ix < colCount; ix++) { + int iColStore = ix; + if (bStoreAtColumnPos) + iColStore += colStart; + for (int iy = 0; iy < ny; iy++) + v[iColStore][iy] *= factor; + } } }