WIP (Not ready): Add GradientImageFilter::OverrideBoundaryCondition(std::unique_ptr<BoundaryConditionType>) - #4533
Conversation
e6fd91e to
ddf1f8d
Compare
ddf1f8d to
9843157
Compare
Follow-up to pull request InsightSoftwareConsortium#4532 commit b4f0bb8 STYLE: Replace "the the" with "the" in comments
Added a helper typedef, for `GradientImageFilter::OverrideBoundaryCondition` and its implementation.
Added `GradientImageFilter::OverrideBoundaryCondition` overload, to allows specifying the argument by a `unique_ptr`. Aims to make it more clear that the filter takes the ownership of the specified `BoundaryCondition` object. Triggered by a comment from Bradley Lowekamp at InsightSoftwareConsortium#4512 (comment) on March 13, 2024.
9843157 to
650d8ca
Compare
Aims to avoid errors from ITK.Linux.Python and ITK.macOS.Python like those from https://open.cdash.org/viewBuildError.php?buildid=9511958: > Wrapping/Modules/ITKImageGradient/itkGradientImageFilterPython.cpp:3856:70: > error: call to implicitly-deleted copy constructor of > `std::unique_ptr<itk::ImageBoundaryCondition<itk::Image<float, 2>>>` Using ITK's current SWIG revision, 2024-03-26-master.
Deprecated (`ITK_FUTURE_LEGACY_REMOVE`) the overload of `GradientImageFilter::OverrideBoundaryCondition` that has a raw pointer as parameter, in favor of the overload that has a `unique_ptr` as parameter.
650d8ca to
337e3ff
Compare
|
For the record, I started a discussion on how unique_ptr parameters are supported by SWIG, at: |
GradientImageFilter::OverrideBoundaryCondition(std::unique_ptr<BoundaryConditionType>)GradientImageFilter::OverrideBoundaryCondition(std::unique_ptr<BoundaryConditionType>)
|
@N-Dekker — I've opened #6714, which carries this idea forward. Thank you for it, and apologies it sat blocked this long: the diagnosis here was correct, and the design you proposed is the one that landed. The SWIG blocker is gone. ITK now pins SWIG 4.3.0, which ships One trap worth recording for anyone doing this elsewhere: What #6714 changes relative to this PR
I'd suggest closing this PR in favor of #6714, but that's your call — I haven't automated it, and there's no |
OverrideBoundaryCondition(T *) adopts its argument in GradientImageFilter but not in the five other classes that declare the same signature, so the name alone cannot tell a caller who frees the object. Add SetBoundaryCondition(std::unique_ptr<BoundaryConditionType>), whose parameter type states the transfer, plus GetBoundaryCondition and ResetBoundaryCondition. Deprecate the owning OverrideBoundaryCondition under ITK_FUTURE_LEGACY_REMOVE and document the remaining ones as non-owning. Supersedes InsightSoftwareConsortium#4533
Deprecated the old
GradientImageFiltermember functionOverrideBoundaryCondition(BoundaryConditionType *)in favor ofOverrideBoundaryCondition(std::unique_ptr<BoundaryConditionType>).Aims to make it more clear that the filter takes the ownership of the specified
BoundaryConditionobject.Triggered by a comment from Bradley Lowekamp (@blowekamp) at #4512 (comment)