X-Git-Url: http://git.kpe.io/?a=blobdiff_plain;f=libctsim%2Fphantom.cpp;h=8d4ea38475d0936bd8301d30a1497a60f666f6c5;hb=27a474e0622ebb7229fd5705552021f63d8f932d;hp=7acfc3fc9ccba40168f889867ed5b404b04bd299;hpb=e4c1f7f8eb87558c3abf3bf1d20732361f425351;p=ctsim.git diff --git a/libctsim/phantom.cpp b/libctsim/phantom.cpp index 7acfc3f..8d4ea38 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.7 2000/07/15 08:36:13 kevin Exp $ +** $Id: phantom.cpp,v 1.9 2000/07/20 11:17:31 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 @@ -28,6 +28,20 @@ #include "ct.h" +const char Phantom::PHM_HERMAN_STR[]= "herman"; +const char Phantom::PHM_BHERMAN_STR[]= "bherman"; +const char Phantom::PHM_ROWLAND_STR[]= "rowland"; +const char Phantom::PHM_BROWLAND_STR[]= "browland"; +const char Phantom::PHM_UNITPULSE_STR[]= "unitpulse"; + +const char Phantom::PHM_HERMAN_TITLE_STR[]= "Herman Head"; +const char Phantom::PHM_BHERMAN_TITLE_STR[]= "Herman Head Bordered"; +const char Phantom::PHM_ROWLAND_TITLE_STR[]= "Rowland Head"; +const char Phantom::PHM_BROWLAND_TITLE_STR[]= "Rowland Head Bordered"; +const char Phantom::PHM_UNITPULSE_TITLE_STR[]= "Unit Pulse"; + + + // CLASS IDENTIFICATION // Phanton // @@ -451,19 +465,24 @@ Phantom::convertToImagefile (ImageFile& im, const int in_nsample, const int trac 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 */ @@ -822,7 +841,7 @@ PhantomElement::clipLineNormalizedCoords (double& x1, double& y1, double& x2, do // 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);