X-Git-Url: http://git.kpe.io/?p=ctsim.git;a=blobdiff_plain;f=libctsim%2Fphantom.cpp;h=9125e36be718af7ea36959b42bf5461cd673f0ab;hp=6e3537dbe4757fd1e787e94d8ad08e697e0fcfdd;hb=f7d2b7144f32a7bd157b7689022e62944b82fcc1;hpb=ee0105d74fec9d6bfd236e22e9e1d315e46c568e diff --git a/libctsim/phantom.cpp b/libctsim/phantom.cpp index 6e3537d..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.21 2000/12/06 01:46:43 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 @@ -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; + } } }