2D similarity transform parameter map doesn't keep "CenterOfRotationPoint" parameter
See original GitHub issueHi all, thanks for putting together this package, I’m really enjoying the ease of installation.
It seems the similarity transform as wrapped in ITKElastix
doesn’t return the CenterOfRotationPoint
transform parameter (although it is written to file) when doing 2D to 2D registration.
I encountered this issue using SimpleElastix
as well so it may be in elastix
codebase itself.
import numpy as np
import itk
zero_image = np.zeros([1024,1024])
similarity_parameter_map = parameter_object.GetDefaultParameterMap("rigid")
# set method to similarity & 2D
similarity_parameter_map["Transform"] = ["SimilarityTransform"]
similarity_parameter_map["MovingImageDimension"] = ["2"]
similarity_parameter_map["FixedImageDimension"] = ["2"]
parameter_object = itk.ParameterObject.New()
parameter_object.AddParameterMap(similarity_parameter_map)
sim_result_image, sim_params = itk.elastix_registration_method(
zero_image.astype(np.float32),
zero_image.astype(np.float32),
parameter_object=parameter_object,
log_to_console=True,
output_directory="./transforms_similarity",
)
transform_cent_rot = np.array(
sim_params.GetParameter(0, "CenterOfRotationPoint")
).astype(np.float32)[::-1]
assert len(transform_cent_rot) == 2
print(sim_params)
ParameterObject (0000028751D7CE00)
RTTI typeinfo: class elastix::ParameterObject
Reference Count: 1
Modified Time: 2007229
Debug: Off
Object Name:
Observers:
none
ParameterMap 0:
(CenterOfRotationPoint)
(CompressResultImage "false")
(DefaultPixelValue 0)
(Direction 1 0 0 1)
(FinalBSplineInterpolationOrder 3)
(FixedImageDimension 2)
(FixedInternalImagePixelType "float")
(HowToCombineTransforms "Compose")
(Index 0 0)
(InitialTransformParametersFileName "NoInitialTransform")
(MovingImageDimension 2)
(MovingInternalImagePixelType "float")
(NumberOfParameters 4)
(Origin 0 0)
(ResampleInterpolator "FinalBSplineInterpolator")
(Resampler "DefaultResampler")
(ResultImageFormat "nii")
(ResultImagePixelType "float")
(Size 1024 1024)
(Spacing 1 1)
(Transform "SimilarityTransform")
(TransformParameters 1 0 0 0)
(UseDirectionCosines "true")
file on disk
(Transform "SimilarityTransform")
(NumberOfParameters 4)
(TransformParameters 1.000000 0.000000 0.000000 0.000000)
(InitialTransformParametersFileName "NoInitialTransform")
(UseBinaryFormatForTransformationParameters "false")
(HowToCombineTransforms "Compose")
// Image specific
(FixedImageDimension 2)
(MovingImageDimension 2)
(FixedInternalImagePixelType "float")
(MovingInternalImagePixelType "float")
(Size 1024 1024)
(Index 0 0)
(Spacing 1.0000000000 1.0000000000)
(Origin 0.0000000000 0.0000000000)
(Direction 1.0000000000 0.0000000000 0.0000000000 1.0000000000)
(UseDirectionCosines "true")
// SimilarityTransform specific
(CenterOfRotationPoint 511.5000000000 511.5000000000)
// ResampleInterpolator specific
(ResampleInterpolator "FinalBSplineInterpolator")
(FinalBSplineInterpolationOrder 3)
// Resampler specific
(Resampler "DefaultResampler")
(DefaultPixelValue 0.000000)
(ResultImageFormat "nii")
(ResultImagePixelType "float")
(CompressResultImage "false")
Issue Analytics
- State:
- Created 3 years ago
- Comments:9
Top Results From Across the Web
SimpleElastix 3D Rotation Application? · Issue #91 - GitHub
Yes, you can manually change the TransformParameters variable of a transform parameter map and then apply it via Transformix.
Read more >How Transform (Coverage) works—Help | ArcGIS for Desktop
The SIMILARITY transformation scales, rotates, and translates the data. It will not independently scale the axes nor introduce any skew. A similarity ......
Read more >Part II: Projective Transformations in 2D | by Daniel Lenton
A short blog post introducing projective transformations, and the hierarchy of transformation specializations. This post will be limited to ...
Read more >MATLAB imregtform - Image Registration - MathWorks
Estimate geometric transformation that aligns two 2-D or 3-D images ... The "similarity" and "affine" transformation types do not support reflection.
Read more >RIGID IMAGE REGISTRATION
Image registration is the process of estimating an ... Parameters. Optimizer. Transform ... A geometric transformation maps coordinates from one.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@NHPatterson Thanks for reporting this issue, Heath. Stefan (@stefanklein), Viktor (@ViktorvdValk) and I just discussed the issue. It appears that
elastix::SimilarityTransformElastix
should overrideCreateTransformParametersMap
, in order to fix this issue. I will try to fix it soon!@NHPatterson Hi Heath! I’m closing the issue now, as I think we got it fixed 😃 By pull request https://github.com/SuperElastix/elastix/pull/379 “Add missing parameters to transform parameter maps”, which is just merged onto the https://github.com/SuperElastix/elastix develop branch. If you have the time, please check it out! And of course, if you think the issue is not entirely fixed, please feel free to reopen the issue, or submit another one. Thanks again!