From 4cbebc1767adc97322b6cbeb48177a3ccb768156 Mon Sep 17 00:00:00 2001 From: Axel Garcia Date: Mon, 20 Jul 2026 14:16:10 +0200 Subject: [PATCH] ENH: Fix Parker weighting to not discard first and last projections Extend the short scan range by half an angular step on each side so that the first and last projections receive non-zero Parker weights. Previously, these projections were at the ramp-up/ramp-down boundaries and received zero weight, effectively throwing them away. The acquisition actually starts half a step before the first projection and ends half a step after the last, so the weighting should reflect this. --- include/rtkParkerShortScanImageFilter.hxx | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/include/rtkParkerShortScanImageFilter.hxx b/include/rtkParkerShortScanImageFilter.hxx index c263e7c22..b4b918d1a 100644 --- a/include/rtkParkerShortScanImageFilter.hxx +++ b/include/rtkParkerShortScanImageFilter.hxx @@ -77,6 +77,29 @@ ParkerShortScanImageFilter::GenerateInputRequestedReg m_Delta = 0.5 * (lastAngle - m_FirstAngle - itk::Math::pi); m_Delta = m_Delta - 2 * itk::Math::pi * floor(m_Delta / (2 * itk::Math::pi)); // between -2*PI and 2*PI + // Extend the scan range by half a step so that the first and last projections get non-zero Parker weights. + if (nProj > 1) + { + // First angular step: gap from first to second projection in the short scan + auto itNext = itFirstAngle; + ++itNext; + double firstStep = itNext->first - itFirstAngle->first; + if (firstStep < 0) + firstStep += 2 * itk::Math::pi; + + // Last angular step: gap from second-to-last to last projection in the short scan + auto itPrev = itLastAngle; + --itPrev; + double lastStep = itLastAngle->first - itPrev->first; + if (lastStep < 0) + lastStep += 2 * itk::Math::pi; + + double halfFirstStep = firstStep / 2; + double halfLastStep = lastStep / 2; + m_FirstAngle -= halfFirstStep; + m_Delta += (halfFirstStep + halfLastStep) / 2; + } + // Pre-compute the two corners of the projection images typename TInputImage::IndexType id = this->GetInput()->GetLargestPossibleRegion().GetIndex(); typename TInputImage::SizeType sz = this->GetInput()->GetLargestPossibleRegion().GetSize();