X-Git-Url: http://git.kpe.io/?p=ctsim.git;a=blobdiff_plain;f=libctsim%2Fphantom.cpp;fp=libctsim%2Fphantom.cpp;h=bf1165499445375848e475861060d00a8762c443;hp=f02877775729f2f1a4781e78eec84ad2d9f1ef56;hb=b6b7a4c68b20d0f86c8fb1095a166d4b93c3feba;hpb=61ee047b746c8fa2bd2de6b6ed5486596d7689aa diff --git a/libctsim/phantom.cpp b/libctsim/phantom.cpp index f028777..bf11654 100644 --- a/libctsim/phantom.cpp +++ b/libctsim/phantom.cpp @@ -516,13 +516,14 @@ Phantom::convertToImagefile (ImageFile& im, const int iTotalRasterCols, const do double x = x_start + ix * xinc; int iColStore = ix + iStorageOffset; ImageFileColumn vCol = v[iColStore]; - for (int iy = 0; iy < ny; iy++) { - double y = ymin + iy * yinc; + + double y = ymin; + for (int iy = 0; iy < ny; iy++, y += yinc) { double dAtten = 0; - for (int kx = 0; kx < nsample; kx++) { - double xi = x + kxofs + kxinc * kx; - for (int ky = 0; ky < nsample; ky++) { - double yi = y + kyofs + ky * kyinc; + double xi = x + kxofs; + for (int kx = 0; kx < nsample; kx++, xi += kxinc) { + double yi = y + kyofs; + for (int ky = 0; ky < nsample; ky++, yi += kyinc) { if (rPElem.isPointInside (xi, yi, PHM_COORD)) dAtten += rPElem.atten(); } // ky @@ -531,9 +532,9 @@ Phantom::convertToImagefile (ImageFile& im, const int iTotalRasterCols, const do } /* iy */ } /* ix */ } /* pelem */ - + #else - + double x_start = xmin + (colStart * xinc); for (PElemConstIterator pelem = m_listPElem.begin(); pelem != m_listPElem.end(); pelem++) { const PhantomElement& rPElem = **pelem; @@ -559,7 +560,7 @@ Phantom::convertToImagefile (ImageFile& im, const int iTotalRasterCols, const do double factor = 1.0 / static_cast(nsample * nsample); #if HAVE_OPENMP #pragma omp parallel for -#endif +#endif for (int ix = 0; ix < colCount; ix++) { int iColStore = ix + iStorageOffset; ImageFileColumn vCol = v[iColStore];