Skip to content

Commit fac3f64

Browse files
author
Simon Rit
committed
ENH: Make tolerances on angle verification parametrizable
1 parent cfcf604 commit fac3f64

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

include/rtkThreeDCircularProjectionGeometry.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -364,6 +364,13 @@ class RTK_EXPORT ThreeDCircularProjectionGeometry : public ProjectionGeometry<3>
364364
itkGetConstMacro(RadiusCylindricalDetector, double);
365365
itkSetMacro(RadiusCylindricalDetector, double);
366366

367+
/** Accessor for the internal tolerance on angles. */
368+
itkGetConstMacro(VerifyAnglesTolerance, double);
369+
itkSetMacro(VerifyAnglesTolerance, double);
370+
371+
itkGetConstMacro(FixAnglesTolerance, double);
372+
itkSetMacro(FixAnglesTolerance, double);
373+
367374
protected:
368375
ThreeDCircularProjectionGeometry();
369376
~ThreeDCircularProjectionGeometry() override = default;
@@ -476,6 +483,10 @@ class RTK_EXPORT ThreeDCircularProjectionGeometry : public ProjectionGeometry<3>
476483
std::vector<Superclass::MatrixType> m_MagnificationMatrices;
477484
std::vector<ThreeDHomogeneousMatrixType> m_RotationMatrices;
478485
std::vector<ThreeDHomogeneousMatrixType> m_SourceTranslationMatrices;
486+
487+
/** Internal tolerance parameters. */
488+
double m_VerifyAnglesTolerance{ 1e-4 };
489+
double m_FixAnglesTolerance{ 1e-6 };
479490
};
480491
} // namespace rtk
481492

src/rtkThreeDCircularProjectionGeometry.cxx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -676,7 +676,6 @@ rtk::ThreeDCircularProjectionGeometry::VerifyAngles(const double outOfP
676676
using EulerType = itk::Euler3DTransform<double>;
677677

678678
const Matrix3x3Type & rm = referenceMatrix; // shortcut
679-
const double EPSILON = 1e-4; // internal tolerance for comparison
680679

681680
EulerType::Pointer euler = EulerType::New();
682681
euler->SetComputeZYX(false); // ZXY order
@@ -685,7 +684,7 @@ rtk::ThreeDCircularProjectionGeometry::VerifyAngles(const double outOfP
685684

686685
for (int i = 0; i < 3; i++) // check whether matrices match
687686
for (int j = 0; j < 3; j++)
688-
if (itk::Math::abs(rm[i][j] - m[i][j]) > EPSILON)
687+
if (itk::Math::abs(rm[i][j] - m[i][j]) > m_VerifyAnglesTolerance)
689688
return false;
690689

691690
return true;
@@ -698,9 +697,8 @@ rtk::ThreeDCircularProjectionGeometry::FixAngles(double & outOfPlan
698697
const Matrix3x3Type & referenceMatrix) const
699698
{
700699
const Matrix3x3Type & rm = referenceMatrix; // shortcut
701-
const double EPSILON = 1e-6; // internal tolerance for comparison
702700

703-
if (itk::Math::abs(itk::Math::abs(rm[2][1]) - 1.) > EPSILON)
701+
if (itk::Math::abs(itk::Math::abs(rm[2][1]) - 1.) > m_FixAnglesTolerance)
704702
{
705703
double oa = NAN, ga = NAN, ia = NAN;
706704

0 commit comments

Comments
 (0)