-
Notifications
You must be signed in to change notification settings - Fork 116
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
Euler transform with optional upper/lower limits to each parameter #511
base: main
Are you sure you want to change the base?
Conversation
Hi, it seem the Elastix framework was refactored recently and this is causing the build to fail. The problem seems to be in the waythe output transform parameter file is to be written. We identified the following issue: In header
Parameters to write are passed in the implementation of function
There is an incentive to override the In our current implementation we want to compute an output vector, i.e. In previous Elastix version (4.9) there used to be a mechanism to override the My question is how is it possible, in the refactored elastix framework, to compute output values and write them into the transform parameters file? Was this option considered? If yes, is there a use case such that to take a look? Many thanks, |
@zigaS-fe-uni-lj Thank you for your pull request! Indeed, with a recent refactoring, the support to override
When this member function is added to Maybe it's also helpful to take a look at the current revision (develop branch, git HEAD) of elxEulerTransform.h and elxEulerTransform.hxx at https://github.com/SuperElastix/elastix/tree/develop/Components/Transforms/EulerTransform Hope this helps! Kind regards, Niels |
m_UpperLimits[i] = 3.14f; | ||
m_LowerLimits[i] = -3.14f; |
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.
If you mean π, please use vnl_math::pi
(and then do #include <vnl/vnl_math.h>
.) As an alternative, M_PI
(with #include <cmath>
) is also fine to me.
upperLimits.SetSize(6); | ||
for( unsigned int i = 0; i < 6; i++ ) | ||
{ | ||
upperLimits[ i ] = i < 3 ? 3.14f : 200.0f; |
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.
Why did you specifically choose 200.0f
here? Would std::numeric_limits<float>::max()
be fine as well, as a default? Or even std::numeric_limits<float>::infinity()
?
If you still think 200.0f
is the most appropriate default value, can you please make it a named constant? Possibly a static constexpr
member of the class?
When a user does not specify those new parameters (SharpnessOfLimits, UpperLimits, LowerLimits) would AdvancedLimitedEulerTransform behave exactly like the existing EulerTransform? I would like it like that! |
@zigaso Just for my understanding, does your proposal only support 3D, no 2D? Because I see that you wrote "itkAdvancedLimitedEuler3DTransform.h", but no corresponding 2D transform! Just want to be sure that that's your intention! 😃 |
Intro
This adds a new transform dubbed the
AdvancedLimitedEulerTransform
, which implements per axis upper and/or lower limiting. It achieves this functionality by clamping the transform gradient based on the current value of each parameter, using the Softplus function.In the parameter file, set the transformation as:
Additional parameter to set are:
Note: axis limiting is implemented for 3D images and for use with gradient based optimizers! Using 2D input images will throw an error, while using another optimizer will not effectively apply the limits.
Example application
For instance if 3D CT was translated +15 mm along the X axis, and then registered onto its original version, and with the registration limited to +/- 10 mm along the X axis like this (see
TransformParameters.tx15.txt
):The corresponding output can be found in folder
output
, ie. fromTransformParameters.0.txt
see the following line:where indeed the translation along the X axis was limited at -10 mm. The limits are also propagated into the transform parameter file:
...
(SharpnessOfLimits "200.0000000000")
(UpperLimits 0.5000000000 0.5000000000 0.5000000000 10.0000000000 10.0000000000 10.0000000000)
(LowerLimits -0.5000000000 -0.5000000000 -0.5000000000 -10.0000000000 -10.0000000000 -10.0000000000)
(LowerLimitsReached 0.0000000000 0.0000000000 0.0000000000 0.9990956587 0.0000000000 0.0000000000)
(UpperLimitsReached 0.0000000000 0.0000000000 0.0000000000 0.0000000000 0.0000000000 0.0000000000)
(LowerLimits 0.0000000000 0.0000000000 0.0000000000 0.0000000000 0.0000000000 0.0000000000)
(UpperLimits 0.0000000000 0.0000000000 0.0000000000 0.0000000000 0.0000000000 0.0000000000)