-
-
Notifications
You must be signed in to change notification settings - Fork 661
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
ENH: Convenience overloads for ImageBase Transform member functions #868
ENH: Convenience overloads for ImageBase Transform member functions #868
Conversation
I have been annoyed by absence of these more than once! |
* Floating point index results are rounded to integers | ||
* Returns true if the resulting index is within the image, false otherwise |
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.
Minor changes request to documentation. I think it is worth explicitly noting that these functions do not verify that the resulting indices fall within the image.
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.
@hjmjohnson Please check the added note:
* \note This specific overload does not figure out whether or not |
* \note This specific overload does not figure out whether or not |
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.
+100 I too have desired these convenience methods for some time.
I have a minor comment change request.
Update: Still preparing an amend that should address the comment by @hjmjohnson and add at least a very little unit test. Hopefully tomorrow... :-) |
I approve the wording of the commit message. |
The GTest that I added compiles well on ITK.Windows, but it fails on macOS and Linux, because I should have added a template keyword on various places. For example:
Should be:
At line
I'll try to fix it (tomorrow). |
Added convenience overloads to the six `ImageBase` Transform member functions, returning the result by value, instead of having an output parameter: TransformPhysicalPointToIndex TransformPhysicalPointToContinuousIndex TransformContinuousIndexToPhysicalPoint TransformIndexToPhysicalPoint TransformLocalVectorToPhysicalVector TransformPhysicalVectorToLocalVector These overloads allow users to have a more "functional" programming style, or at least, place the transformation result in a `const` variable. So instead of: Bar bar; image->TransformFooToBar(foo, bar); It typically allows users to write: const auto bar = image->TransformFooToBar(foo); Added a unit test to itkImageBaseGTest.
I think this pull request is OK now. CDash appears stuck "in progress" for no reason. It has succeeded at Linux, Windows and macOS. |
Added `TransformPhysicalPointToIndex(point)` and `TransformPhysicalPointToContinuousIndex(point)` overloads to `PhasedArray3DSpecialCoordinatesImage`, which return the index, instead of a `bool`. Follow-up to: pull request InsightSoftwareConsortium#868 commit 65233e3 "ENH: Convenience overloads for ImageBase Transform member functions"
Added convenience overloads of four Transform member functions of `PhasedArray3DSpecialCoordinatesImage`, returning the result by value, instead of having an output parameter: TransformPhysicalPointToIndex TransformPhysicalPointToContinuousIndex TransformContinuousIndexToPhysicalPoint TransformIndexToPhysicalPoint Follow-up to: pull request InsightSoftwareConsortium#868 commit 65233e3 "ENH: Convenience overloads for ImageBase Transform member functions"
Added convenience overloads of four Transform member functions of `PhasedArray3DSpecialCoordinatesImage`, returning the result by value, instead of having an output parameter: TransformPhysicalPointToIndex TransformPhysicalPointToContinuousIndex TransformContinuousIndexToPhysicalPoint TransformIndexToPhysicalPoint Follow-up to: pull request #868 commit 65233e3 "ENH: Convenience overloads for ImageBase Transform member functions"
Follow-up to pull request InsightSoftwareConsortium#868 commit 65233e3 "ENH: Convenience overloads for ImageBase Transform member functions"
Follow-up to pull request InsightSoftwareConsortium#868 commit 65233e3 "ENH: Convenience overloads for ImageBase Transform member functions"
Added the five missing single parameter overloads of point/index/vector conversion member functions to `ImageAdaptor`, which were already there for `ImageBase` with ITK version 5.0. Included a GoogleTest unit test. Follow-up to pull request InsightSoftwareConsortium#868 commit 65233e3 "ENH: Convenience overloads for ImageBase Transform member functions"
Added the five missing single parameter overloads of point/index/vector conversion member functions to `ImageAdaptor`, which were already there for `ImageBase` with ITK version 5.0. Included a GoogleTest unit test. Follow-up to pull request InsightSoftwareConsortium#868 commit 65233e3 "ENH: Convenience overloads for ImageBase Transform member functions"
Added the five missing single parameter overloads of point/index/vector conversion member functions to `ImageAdaptor`, which were already there for `ImageBase` with ITK version 5.0. Included a GoogleTest unit test. Follow-up to pull request InsightSoftwareConsortium#868 commit 65233e3 "ENH: Convenience overloads for ImageBase Transform member functions"
Added the four missing single parameter overloads of point/index/vector conversion member functions to `ImageAdaptor`, which were already there for `ImageBase` with ITK version 5.0: TransformPhysicalPointToIndex TransformPhysicalPointToContinuousIndex TransformContinuousIndexToPhysicalPoint TransformIndexToPhysicalPoint Included a GoogleTest unit test. Follow-up to pull request InsightSoftwareConsortium#868 commit 65233e3 "ENH: Convenience overloads for ImageBase Transform member functions"
Added the four missing single parameter overloads of point/index/vector conversion member functions to `ImageAdaptor`, which were already there for `ImageBase` with ITK version 5.0: TransformPhysicalPointToIndex TransformPhysicalPointToContinuousIndex TransformContinuousIndexToPhysicalPoint TransformIndexToPhysicalPoint Included a GoogleTest unit test. Follow-up to pull request InsightSoftwareConsortium#868 commit 65233e3 "ENH: Convenience overloads for ImageBase Transform member functions" And pull request InsightSoftwareConsortium#1207 commit 55f8ac2 "BUG: Missing ImageAdapter function signatures"
Added the four missing single parameter overloads of point/index/vector conversion member functions to `ImageAdaptor`, which were already there for `ImageBase` with ITK version 5.0: TransformPhysicalPointToIndex TransformPhysicalPointToContinuousIndex TransformContinuousIndexToPhysicalPoint TransformIndexToPhysicalPoint Included a GoogleTest unit test. Follow-up to pull request InsightSoftwareConsortium#868 commit 65233e3 "ENH: Convenience overloads for ImageBase Transform member functions" And pull request InsightSoftwareConsortium#1207 commit 55f8ac2 "BUG: Missing ImageAdapter function signatures"
Added the four missing single parameter overloads of point/index/vector conversion member functions to `ImageAdaptor`, which were already there for `ImageBase` with ITK version 5.0: TransformPhysicalPointToIndex TransformPhysicalPointToContinuousIndex TransformContinuousIndexToPhysicalPoint TransformIndexToPhysicalPoint Included a GoogleTest unit test. Follow-up to pull request InsightSoftwareConsortium#868 commit 65233e3 "ENH: Convenience overloads for ImageBase Transform member functions" And pull request InsightSoftwareConsortium#1207 commit 55f8ac2 "BUG: Missing ImageAdapter function signatures"
Added the four missing single parameter overloads of point/index/vector conversion member functions to `ImageAdaptor`, which were already there for `ImageBase` with ITK version 5.0: TransformPhysicalPointToIndex TransformPhysicalPointToContinuousIndex TransformContinuousIndexToPhysicalPoint TransformIndexToPhysicalPoint Included a GoogleTest unit test. Follow-up to pull request #868 commit 65233e3 "ENH: Convenience overloads for ImageBase Transform member functions" And pull request #1207 commit 55f8ac2 "BUG: Missing ImageAdapter function signatures"
Return-by-value is easier to read than pass-by-non-const-reference, and `ContinuousIndexType` has lightweight copy semantics, so it appears preferable for `AdvancedBSplineDeformableTransformBase::TransformPointToContinuousGridIndex` to simply return the continuous index. Declared local continuous index variables `const`. Analogous to ITK pull request InsightSoftwareConsortium/ITK#868 commit InsightSoftwareConsortium/ITK@65233e3 "ENH: Convenience overloads for ImageBase Transform member functions"
Return-by-value is easier to read than pass-by-non-const-reference, and `ContinuousIndexType` has lightweight copy semantics, so it appears preferable for `AdvancedBSplineDeformableTransformBase::TransformPointToContinuousGridIndex` to simply return the continuous index. Declared local continuous index variables `const`. Analogous to ITK pull request InsightSoftwareConsortium/ITK#868 commit InsightSoftwareConsortium/ITK@65233e3 "ENH: Convenience overloads for ImageBase Transform member functions"
Added convenience overloads to the six
ImageBase
Transform memberfunctions, returning the result by value, instead of having an output
parameter:
These overloads allow users to have a more "functional" programming
style, or at least, place the transformation result in a
const
variable.So instead of:
It typically allows users to write:
Added a unit test to itkImageBaseGTest