From 9b4938c2c9c19d10faad03ad820e608999e994e5 Mon Sep 17 00:00:00 2001 From: Axel Garcia Date: Thu, 10 Sep 2026 16:52:01 +0200 Subject: [PATCH] BUG: Use max corner angle in Parker weighting warning check With source/detector offsets the fan is asymmetric, so delta must exceed the maximum corner half-beam angle, not the minimum. Also report that angle in the warning message. Fix #393 --- include/rtkParkerShortScanImageFilter.hxx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/include/rtkParkerShortScanImageFilter.hxx b/include/rtkParkerShortScanImageFilter.hxx index c263e7c22..54651f5a4 100644 --- a/include/rtkParkerShortScanImageFilter.hxx +++ b/include/rtkParkerShortScanImageFilter.hxx @@ -95,15 +95,15 @@ ParkerShortScanImageFilter::GenerateInputRequestedReg double invsid = 1. / sqrt(sid * sid + sox * sox); // Check that Parker weighting is relevant for this projection - double halfDetectorWidth1 = std::abs(m_Geometry->ToUntiltedCoordinateAtIsocenter(k, corner1[0])); - double halfDetectorWidth2 = std::abs(m_Geometry->ToUntiltedCoordinateAtIsocenter(k, corner2[0])); - double halfDetectorWidth = std::min(halfDetectorWidth1, halfDetectorWidth2); - if (m_Delta < atan(halfDetectorWidth * invsid)) + double halfBeamAngle = + std::max(std::abs(atan(m_Geometry->ToUntiltedCoordinateAtIsocenter(k, corner1[0]) * invsid)), + std::abs(atan(m_Geometry->ToUntiltedCoordinateAtIsocenter(k, corner2[0]) * invsid))); + if (m_Delta < halfBeamAngle) { itkWarningMacro(<< "You do not have enough data for proper Parker weighting (short scan)" << " according to projection #" << k << ". Delta is " << m_Delta * 180. / itk::Math::pi << " degrees and should be more than half the beam angle, i.e. " - << atan(halfDetectorWidth * invsid) * 180. / itk::Math::pi << " degrees."); + << halfBeamAngle * 180. / itk::Math::pi << " degrees."); return; } }