X-Git-Url: http://git.kpe.io/?a=blobdiff_plain;f=libctsim%2Fphantom.cpp;h=a0ddc408937b8f8f382c36ae95bbc320a522ace0;hb=ca7c001fce978b680543f8338a404b8c0701a935;hp=467c8e90d5f4eab03f48533433240384ebda42f2;hpb=c00c639073653fac7463a88f2b000f263236550d;p=ctsim.git diff --git a/libctsim/phantom.cpp b/libctsim/phantom.cpp index 467c8e9..a0ddc40 100644 --- a/libctsim/phantom.cpp +++ b/libctsim/phantom.cpp @@ -7,9 +7,9 @@ ** Date Started: Aug 1984 ** ** This is part of the CTSim program -** Copyright (C) 1983-2000 Kevin Rosenberg +** Copyright (c) 1983-2001 Kevin Rosenberg ** -** $Id: phantom.cpp,v 1.26 2001/01/02 16:02:13 kevin Exp $ +** $Id: phantom.cpp,v 1.29 2001/02/09 14:34:16 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 @@ -32,26 +32,20 @@ const double PhantomElement::SCALE_PELEM_EXTENT=0.005; // increase pelem limits const int Phantom::PHM_INVALID = -1; const int Phantom::PHM_HERMAN = 0; -const int Phantom::PHM_B_HERMAN = 1; -const int Phantom::PHM_SHEPP_LOGAN = 2; -const int Phantom::PHM_B_SHEPP_LOGAN = 3; -const int Phantom::PHM_UNITPULSE = 4; +const int Phantom::PHM_SHEPP_LOGAN = 1; +const int Phantom::PHM_UNITPULSE = 2; const char* Phantom::s_aszPhantomName[] = { {"herman"}, - {"herman-b"}, {"shepp-logan"}, - {"shepp-logan-b"}, - {"unitpulse"}, + {"unit-pulse"}, }; const char* Phantom::s_aszPhantomTitle[] = { {"Herman Head"}, - {"Herman Head (Bordered)"}, {"Shepp-Logan"}, - {"Shepp-Logan (Bordered)"}, {"Unit Pulse"}, }; @@ -82,7 +76,6 @@ Phantom::init () m_xmax = -1E30; m_ymin = 1E30; m_ymax = -1E30; - m_diameter = 0; m_composition = P_PELEMS; m_fail = false; m_id = PHM_INVALID; @@ -157,15 +150,9 @@ Phantom::createFromPhantom (const int phmid) case PHM_HERMAN: addStdHerman(); break; - case PHM_B_HERMAN: - addStdHermanBordered(); - break; case PHM_SHEPP_LOGAN: addStdSheppLogan(); break; - case PHM_B_SHEPP_LOGAN: - addStdSheppLoganBordered(); - break; case PHM_UNITPULSE: m_composition = P_UNIT_PULSE; addPElem ("rectangle", 0., 0., 100., 100., 0., 0.); // outline @@ -261,11 +248,6 @@ Phantom::addPElem (const char *type, const double cx, const double cy, const dou if (m_ymin > pelem->ymin()) m_ymin = pelem->ymin(); if (m_ymax < pelem->ymax()) m_ymax = pelem->ymax(); - if (m_diameter < pelem->diameter()) - m_diameter = pelem->diameter(); - - // m_diameter = lineLength(m_xmin, m_ymin, m_xmax, m_ymax); - m_nPElem++; } @@ -417,12 +399,6 @@ Phantom::addStdSheppLogan () addPElem ("ellipse", 0.5538, -0.3858, 0.0330, 0.2060, -18.0, 0.03); } -void -Phantom::addStdSheppLoganBordered () -{ - addStdSheppLogan (); - addPElem ("rectangle", 0.000, 0.0000, 0.8600, 1.150, 0.0, 0.00); -} /* NAME * addStdHerman Standard head phantom of G. T. Herman @@ -452,12 +428,6 @@ Phantom::addStdHerman () addPElem ("ellipse", 0.000, 0.00, 7.875, 5.7187, 90.00, -0.206); } -void -Phantom::addStdHermanBordered () -{ - addStdHerman(); - addPElem ("rectangle", 0.000, 0.00, 10.780, 8.110, 90.00, 0.000); -} /* NAME @@ -472,13 +442,13 @@ Phantom::addStdHermanBordered () */ void -Phantom::convertToImagefile (ImageFile& im, const int in_nsample, const int trace) const +Phantom::convertToImagefile (ImageFile& im, double dViewRatio, const int in_nsample, const int trace) const { - convertToImagefile (im, in_nsample, trace, 0, im.nx(), true); + convertToImagefile (im, dViewRatio, in_nsample, trace, 0, im.nx(), true); } void -Phantom::convertToImagefile (ImageFile& im, const int in_nsample, const int trace, const int colStart, const int colCount, bool bStoreAtColumnPos) const +Phantom::convertToImagefile (ImageFile& im, const double dViewRatio, const int in_nsample, const int trace, const int colStart, const int colCount, bool bStoreAtColumnPos) const { int nx = im.nx(); int ny = im.ny(); @@ -493,14 +463,12 @@ Phantom::convertToImagefile (ImageFile& im, const int in_nsample, const int trac double dy = m_ymax - m_ymin; double xcent = m_xmin + dx / 2; double ycent = m_ymin + dy / 2; - double phmlen = (dx > dy ? dx : dy); + double dHalflen = dViewRatio * (getDiameterBoundaryCircle() / SQRT2 / 2); - double phmradius = phmlen / 2; - - double xmin = xcent - phmradius; - double xmax = xcent + phmradius; - double ymin = ycent - phmradius; - double ymax = ycent + phmradius; + double xmin = xcent - dHalflen; + double xmax = xcent + dHalflen; + double ymin = ycent - dHalflen; + double ymax = ycent + dHalflen; // Each pixel holds the average of the intensity of the cell with (ix,iy) at the center of the pixel // Set major increments so that the last cell v[nx-1][ny-1] will start at xmax - xinc, ymax - yinc). @@ -581,15 +549,6 @@ PhantomElement::PhantomElement (const char *type, const double cx, const double makeTransformMatrices (); // calc transform matrices between phantom and normalized phantomelement makeVectorOutline (); // calculate vector outline of pelem - // Find maximum diameter of Object - double r2Max = 0; - for (int i = 0; i < m_nPoints; i++) { - double r2 = (m_xOutline[i] * m_xOutline[i]) + (m_yOutline[i] * m_yOutline[i]); - if (r2 > r2Max) - r2Max = r2; - } - m_diameter = 2 * sqrt( r2Max ); - m_rectLimits[0] = m_xmin; m_rectLimits[1] = m_ymin; m_rectLimits[2] = m_xmax; m_rectLimits[3] = m_ymax; }