X-Git-Url: http://git.kpe.io/?a=blobdiff_plain;f=libctsim%2Fbackprojectors.cpp;h=bab1dc7b18fc75e349cc961c43165f884545ed87;hb=52f2fdc3424cd6b5b77ad1497243e1e06739ffe6;hp=ebfe2a4358326b16aafafb2b30ef8fe84b3240f9;hpb=9776c9a12ba53419d34563a5ec57c90e3d6798f4;p=ctsim.git diff --git a/libctsim/backprojectors.cpp b/libctsim/backprojectors.cpp index ebfe2a4..bab1dc7 100644 --- a/libctsim/backprojectors.cpp +++ b/libctsim/backprojectors.cpp @@ -8,7 +8,7 @@ ** This is part of the CTSim program ** Copyright (c) 1983-2001 Kevin Rosenberg ** -** $Id: backprojectors.cpp,v 1.27 2001/02/22 18:22:40 kevin Exp $ +** $Id: backprojectors.cpp,v 1.29 2001/03/01 07:30:49 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 @@ -113,6 +113,13 @@ Backprojector::BackprojectView (const double* const viewData, const double viewA m_pBackprojectImplem->BackprojectView (viewData, viewAngle); } +void +Backprojector::PostProcessing() +{ + if (m_pBackprojectImplem != NULL) + m_pBackprojectImplem->PostProcessing(); +} + Backprojector::~Backprojector () { delete m_pBackprojectImplem; @@ -254,7 +261,7 @@ Backprojector::convertInterpIDToTitle (const int interpID) // Pure virtual base class for all backprojectors. Backproject::Backproject (const Projections& proj, ImageFile& im, int interpType, const int interpFactor) -: proj(proj), im(im), interpType(interpType), m_interpFactor(interpFactor) +: proj(proj), im(im), interpType(interpType), m_interpFactor(interpFactor), m_bPostProcessingDone(false) { detInc = proj.detInc(); nDet = proj.nDet(); @@ -282,11 +289,18 @@ Backproject::Backproject (const Projections& proj, ImageFile& im, int interpType yInc = (yMax - yMin) / ny; m_dFocalLength = proj.focalLength(); + m_dSourceDetectorLength = proj.sourceDetectorLength(); } Backproject::~Backproject () {} +void +Backproject::PostProcessing() +{ + m_bPostProcessingDone = true; +} + void Backproject::ScaleImageByRotIncrement () { @@ -389,7 +403,15 @@ BackprojectTable::BackprojectTable (const Projections& proj, ImageFile& im, int BackprojectTable::~BackprojectTable () { - ScaleImageByRotIncrement(); +} + +void +BackprojectTable::PostProcessing() +{ + if (! m_bPostProcessingDone) { + ScaleImageByRotIncrement(); + m_bPostProcessingDone = true; + } } void @@ -451,11 +473,18 @@ BackprojectDiff::BackprojectDiff (const Projections& proj, ImageFile& im, int in im.arrayDataClear(); } -BackprojectDiff::~BackprojectDiff() +BackprojectDiff::~BackprojectDiff () { - ScaleImageByRotIncrement(); } +void +BackprojectDiff::PostProcessing() +{ + if (! m_bPostProcessingDone) { + ScaleImageByRotIncrement(); + m_bPostProcessingDone = true; + } +} void BackprojectDiff::BackprojectView (const double* const filteredProj, const double view_angle) @@ -636,10 +665,8 @@ BackprojectEquilinear::BackprojectView (const double* const filteredProj, const double dU = (m_dFocalLength + rsin_t) / m_dFocalLength; double dDetPos = rcos_t / dU; - // double to scale for imaginary detector that passes through origin - // of phantom, see Kak-Slaney Figure 3.22. This assumes that the detector is also - // located focal-length away from the origin. - dDetPos *= 2; + // Scale for imaginary detector that passes through origin of phantom, see Kak-Slaney Figure 3.22. + dDetPos *= m_dSourceDetectorLength / m_dFocalLength; double dPos = dDetPos / detInc; // position along detector array if (interpType == Backprojector::INTERP_NEAREST) {