ENH: Convenience overloads for ImageBase Transform member functions#868
ENH: Convenience overloads for ImageBase Transform member functions#868dzenanz merged 1 commit intoInsightSoftwareConsortium:masterfrom N-Dekker:ImageBase-Transform-overloads
Conversation
|
I have been annoyed by absence of these more than once! |
| /** Get the index (discrete) of a voxel from a physical point. | ||
| /** Returns the index (discrete) of a voxel from a physical point. | ||
| * 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.
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.
@hjmjohnson Please check the added note:
(copied from the previous note, but adapted code snippets)
hjmjohnson
left a comment
There was a problem hiding this comment.
+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 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 0669b74
"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 0669b74
"ENH: Convenience overloads for ImageBase Transform member functions"
And pull request InsightSoftwareConsortium#1207
commit 31bfd18
"BUG: Missing ImageAdapter function signatures"
Added convenience overloads to the six
ImageBaseTransform 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
constvariable.So instead of:
It typically allows users to write:
Added a unit test to itkImageBaseGTest