Skip to content

Does it need to be a CenteredAffineTransform or could it be a AffineTransform? #87

Description

@dyollb

Thanks for making your package available. Great stuff.

I recently noticed that I cannot invert the transform using SimpleITK, because you use itk::CenteredAffineTransform. This variant is not exposed in SimpleITK, and SimpleITK is not able to downcast it. Would it be possible to switch to an itk::AffineTransform instead? Is the center needed?

https://github.com/uncbiag/ICON/blob/b70537fda43f58d2374a2eea51b532841d3977f0/src/icon_registration/itk_wrapper.py#L302C29-L302C52

I get the following error when loading the transform file:

 File "d:\lloyd\dev\scripts\regify\src\regify\transform_utils.py", line 184, in invert_transform
    tx = transform.GetNthTransform(i)

  File "D:\lloyd\dev\scripts\register_skull\.venv\lib\site-packages\SimpleITK\SimpleITK.py", line 7435, in GetNthTransform
    val = val.Downcast()

  File "D:\lloyd\dev\scripts\register_skull\.venv\lib\site-packages\SimpleITK\SimpleITK.py", line 5447, in Downcast
    return downcast_type(self)

  File "D:\lloyd\dev\scripts\register_skull\.venv\lib\site-packages\SimpleITK\SimpleITK.py", line 5779, in __init__
    _SimpleITK.AffineTransform_swiginit(self, _SimpleITK.new_AffineTransform(*args))

RuntimeError: Exception thrown in SimpleITK new_AffineTransform: D:\a\SimpleITK\SimpleITK\Code\Common\src\sitkAffineTransform.cxx:187:
sitk::ERROR: Transform is not of type AffineTransform!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions