-
-
Notifications
You must be signed in to change notification settings - Fork 686
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
BUG: added 2 missing lines #4698
Conversation
I remember there was some discussion about this not long ago. @N-Dekker @hjmjohnson |
This is the PR where that somewhat related discussion happened: #4485. |
@seanm per #3037 , those lines are meant to go at the start of
|
And it may not be correct following the discussion around: |
So shall I just close/discard this? |
Ideally, Hans and/or Niels will review this 😄 |
OK, thanks @dzenanz I'll have a look! (I'm back 😃!) |
I'm still looking for an actual relevant use case for the Update: It appears that this specific constructor has no code coverage at all: Anyway, I guess your pull request would fix a (hypothetical?) crash, when a transform would be constructed by this specific constructor, and then ITK/Modules/Core/Transform/include/itkMatrixOffsetTransformBase.hxx Lines 492 to 497 in 07f8459
So the proposed fix looks OK to me, although it should still have a unit test. And I still wonder if it's very useful to keep maintaining this constructor, if it is unused. |
I think the unit test with this PR might be as follows: TEST(MatrixOffsetTransformBase, CreateWithMatrixAndOffset)
{
class DerivedTransform : public itk::MatrixOffsetTransformBase<>
{
public:
ITK_DISALLOW_COPY_AND_MOVE(DerivedTransform);
static auto
Create()
{
// Indirectly call the `MatrixOffsetTransformBase(const MatrixType &, const OutputVectorType &)` constructor.
const itk::SmartPointer<DerivedTransform> ptr = new DerivedTransform(MatrixType(), OutputVectorType());
ptr->UnRegister();
return ptr;
}
private:
// Inherit the constructors of MatrixOffsetTransformBase:
using itk::MatrixOffsetTransformBase<>::MatrixOffsetTransformBase;
};
const auto transform = DerivedTransform::Create();
const DerivedTransform::FixedParametersType expectedFixedParameters(DerivedTransform::InputSpaceDimension, 0);
EXPECT_EQ(transform->GetFixedParameters(), expectedFixedParameters);
}
The last line is the essential one here: |
1e626aa
to
b510209
Compare
@N-Dekker Added test that you suggested. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🙌 💯
@seanm @N-Dekker @hjmjohnson awesome teamwork!
Would be good is someone could reword my commit message to explain what this change actually is. :) |
Honestly, if this specific |
\azp ITK.Linux |
/azp ITK.Linux |
4e8ed79
to
acb499d
Compare
@hjmjohnson There are a few similar unused constructors in derived classes (11!) that should also be deprecated, when
These 11 constructors all directly or indirectly call |
acb499d
to
98260ba
Compare
@N-Dekker Thanks. I have implemented your additional suggestions. |
98260ba
to
15260ca
Compare
/azp ITK.macOS |
/azp ITK.macOS.Python |
These constructor signatures are not used, and are not necessary to implement the behavior. The derived unused constructors in derived classes (11) are also be deprecated, when MatrixOffsetTransformBase(const MatrixType &, const OutputVectorType &) is deprecated: AffineTransform(const MatrixType & matrix, const OutputVectorType & offset); ComposeScaleSkewVersor3DTransform(const MatrixType & matrix, const OutputVectorType & offset); FixedCenterOfRotationAffineTransform(const MatrixType & matrix, const OutputVectorType & offset); QuaternionRigidTransform(const MatrixType & matrix, const OutputVectorType & offset); Rigid3DTransform(const MatrixType & matrix, const OutputVectorType & offset); ScalableAffineTransform(const MatrixType & matrix, const OutputVectorType & offset); ScaleSkewVersor3DTransform(const MatrixType & matrix, const OutputVectorType & offset); ScaleVersor3DTransform(const MatrixType & matrix, const OutputVectorType & offset); Similarity3DTransform(const MatrixType & matrix, const OutputVectorType & offset); VersorRigid3DTransform(const MatrixType & matrix, const OutputVectorType & offset); VersorTransform(const MatrixType & matrix, const OutputVectorType & offset); These 11 constructors all directly or indirectly call MatrixOffsetTransformBase(const MatrixType &, const OutputVectorType &). But none of them are tested, it appears that they aren't even compiled!!! At least not at the CI. And they are all protected, so they can not be used in the public API. Disabled GTest that used now deprecated interface.
15260ca
to
3b82edc
Compare
@hjmjohnson I see you fixed the warnings by removing the |
No description provided.