-
-
Notifications
You must be signed in to change notification settings - Fork 676
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
Remove implicit conversion from a single scalar value to itk::Vector
#3255
Remove implicit conversion from a single scalar value to itk::Vector
#3255
Conversation
The addressed implicit conversions from a single value to a `Vector` appear unintended. Support for such an implicit conversion is intended to be removed in the future.
Until now, this constructor was only declared `explicit` for "future" builds (when `ITK_LEGACY_FUTURE_REMOVE` would be enabled). Follow-up to commit a890962 "ENH: Make Vector construction from scalar value explicit" by Brian Helba, January 26, 2015 Added a _deleted_ `Vector(nullptr_t)` constructor, especially to avoid erroneous user code like `VectorType v = 0`. Analog to: pull request InsightSoftwareConsortium#3237 commit 8825834 ENH: Declare converting `Point(v)` constructors `explicit`
@dzenanz Do you have any suggestion how to fix https://open.cdash.org/viewBuildError.php?buildid=7780689 ?
I can't find that cpp file (itkVectorThresholdSegmentationLevelSetImageFilterPython.cpp), how is it generated? |
That file is automatically generated by SWIG, from |
I guess that making the constructor explicit is preventing some |
The error message does seem to make sense, because ITK/Modules/Segmentation/LevelSets/include/itkVectorThresholdSegmentationLevelSetImageFilter.h Line 122 in 4f30980
Of course, we could add an extra |
Sounds reasonable. And it does not force us to find where the offending call is being made 😄 |
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.
This still fails to compile. Matt suggested to revert in #3258.
I just deleted my previous comment. |
Finding bugs exposed by the explicit constructor are a great attempt, which might work if there aren't too many of them 😄 |
As suggested by Dženan Zukić.
https://github.com/N-Dekker/ITK/blob/9ecef41cd9a44086050b5e62f5c4eb9b993cf8d7/Modules/Segmentation/LevelSets/include/itkVectorThresholdSegmentationLevelSetImageFilter.h#L128-L129 void
SetMean(const typename MeanVectorType::ValueType meanValue) to template <typename TMeanValue>
std::enable_if_t<std::is_same<TMeanValue, typename MeanVectorType::ValueType>::value, void>
SetMean(const TMeanValue meanValue) |
Appears necessary for `NumericTraits<MeasurementVectorType>::RealType`, which is used to define `MeanVectorType`, indirectly. Addresses Linux Python build errors saying: > Wrapping/Modules/ITKLevelSets/itkVectorThresholdSegmentationLevelSetImageFilterPython.cpp: > 3906:44: error: no matching function for call to > `VectorThresholdSegmentationLevelSetImageFilter<Image<float, 2>, Image<Vector<float, 2>, 2>, float>::SetMean(const double&)` At https://open.cdash.org/viewBuildError.php?buildid=7780689
9ecef41
to
563256a
Compare
Thanks @Leengit but if I understand correctly, MeanVectorType is defined at ITK/Modules/Numerics/Statistics/include/itkMahalanobisDistanceMembershipFunction.h Lines 84 to 87 in 865d0b0
My guess it now that the Fingers crossed please 🤞 |
I think this pull request is ready now 😃 The missing |
building AnisotropicDiffusionLBR now fails: /Users/johnsonhj/Dashboard/src/AnisotropicDiffusionLBR/include/itkLinearAnisotropicDiffusionLBRImageFilter.hxx:480:27: error: reference to type 'const itk::Vector<double, 3>' could not bind to an rvalue of type 'double'
m_NextImage->FillBuffer(0.);
^~ NOTE: ITK_FUTURE_LEGACY_REMOVE:BOOL=ON. Some of the remote modules probably will need some TLC . |
Thanks for the notice, @hjmjohnson
What you would need here is a zero-initialized
HTH, Niels PS FYI The specific |
Required with ITK_LEGACY_REMOVE=ON since InsightSoftwareConsortium/ITK#3255
Required with ITK_LEGACY_REMOVE=ON since InsightSoftwareConsortium/ITK#3255
Required with ITK_LEGACY_REMOVE=ON since InsightSoftwareConsortium/ITK#3255
Required with ITK_LEGACY_REMOVE=ON since InsightSoftwareConsortium/ITK#3255
The wrapping does not compile with ITK_LEGACY_REMOVE=ON since InsightSoftwareConsortium/ITK#3255
Allowing ITK_LEGACY_REMOVE=0N for ITK version >= 5.3rc04, which made those constructors `explicit`: - ITK pull request InsightSoftwareConsortium/ITK#3237 commit InsightSoftwareConsortium/ITK@8825834 "ENH: Declare converting `Point(v)` constructors `explicit`" - ITK pull request InsightSoftwareConsortium/ITK#3255 commit InsightSoftwareConsortium/ITK@abb88cc "ENH: Make Vector constructor from scalar explicit, unless LEGACY enabled"
Allowing ITK_LEGACY_REMOVE=0N for ITK version >= 5.3rc04, which made those constructors `explicit`: - ITK pull request InsightSoftwareConsortium/ITK#3237 commit InsightSoftwareConsortium/ITK@8825834 "ENH: Declare converting `Point(v)` constructors `explicit`" - ITK pull request InsightSoftwareConsortium/ITK#3255 commit InsightSoftwareConsortium/ITK@abb88cc "ENH: Make Vector constructor from scalar explicit, unless LEGACY enabled"
Allowing ITK_LEGACY_REMOVE=0N for ITK version >= 5.3rc04, which made those constructors `explicit`: - ITK pull request InsightSoftwareConsortium/ITK#3237 commit InsightSoftwareConsortium/ITK@8825834 "ENH: Declare converting `Point(v)` constructors `explicit`" - ITK pull request InsightSoftwareConsortium/ITK#3255 commit InsightSoftwareConsortium/ITK@abb88cc "ENH: Make Vector constructor from scalar explicit, unless LEGACY enabled"
Follow-up to commit a890962 "ENH: Make Vector construction from scalar value explicit" by Brian Helba (@brianhelba), January 26, 2015
Analog to: pull request #3237 commit 8825834 "ENH: Declare converting
Point(v)
constructorsexplicit
"