BUG: AzimuthElevationToCartesianTransform::IsLinear() returns false backpoint to release-5.4 - #6796
Conversation
|
The class derives from AffineTransform and overrides TransformPoint with a spherical to cartesian mapping, but inherited MatrixOffsetTransformBase::IsLinear(), which returns true unconditionally. Code that reduces a transform to a matrix and an offset when IsLinear() is true silently produced a wrong matrix for this class. Override IsLinear() to return false, consistent with the existing GetTransformCategory() override, and check both in the test, along with the mapping itself not scaling linearly. Closes InsightSoftwareConsortium#6791
7fccb92 to
074ec1e
Compare
|
Pushed a one-word compile fix to this branch so it isn't blocked overnight —
@thewtex @valentin-boussot — I amended rather than adding a commit so the history stays one clean commit. Valentin remains the author; the committer field changed to me as a side effect of the amend. Force-pushed with The change- scalesLinearly &=
- (itk::Math::Absolute(transformedDoubledPoint[i] - 2.0 * transformedPoint[i]) < ACCEPTABLE_ERROR);
+ scalesLinearly &= (itk::Math::abs(transformedDoubledPoint[i] - 2.0 * transformedPoint[i]) < ACCEPTABLE_ERROR);clang-format rejoined the line because Verified locally on this branchmacOS 15 arm64, Apple clang via the pixi build: 1627/1627, 0 errors
1/1 Test #2614: itkAzimuthElevationToCartesianTransformTest ... Passed
100% tests passed, 0 tests failed out of 1The test passing matters beyond compilation: it asserts the mapping does not scale linearly in either direction, which is what justifies the I also checked the rest of the diff for other APIs that postdate |
The class derives from AffineTransform and overrides TransformPoint with a spherical to cartesian mapping, but inherited
MatrixOffsetTransformBase::IsLinear(), which returns true unconditionally. Code that reduces a transform to a matrix and an offset when IsLinear() is true silently produced a wrong matrix for this class.
Override IsLinear() to return false, consistent with the existing GetTransformCategory() override, and check both in the test, along with the mapping itself not scaling linearly.
Closes #6791