opengate icon indicating copy to clipboard operation
opengate copied to clipboard

Switch to simpleitk

Open nkrah opened this issue 1 year ago • 4 comments

First steps to try the switch from itk to SimpleITK which is much faster to import.

The general idea is to implement wrapper functions in opengate.image, e.g. itk_get_image_origin(image), which internally call the library specific functions to get the return value. Anything in opengate outside of the image module should exclusively call functions implemented in the image module, and NOT itk or SimpleITK directly. In this way, we can switch from one image library to another quite easily.

The PR is a draft for now, but I am filing it as PR so everyone can have a look.

nkrah avatar Dec 07 '23 13:12 nkrah

Update

  • yes indeed, ok for such wrapper functions
  • SimpleITK may not be required: it seems that it may be linked to torch + itk together
  • alternative idea: compile our own itk module with only the limited set of ImageType

dsarrut avatar Dec 11 '23 14:12 dsarrut

Thanks. Let's keep the PR simmering for now and discuss how to move on.

On Dec 11 2023, at 3:38 pm, David Sarrut @.***> wrote:

Update

yes indeed, ok for such wrapper functions

SimpleITK may not be required: it seems that it may be linked to torch + itk together

alternative idea: compile our own itk module with only the limited set of ImageType

Reply to this email directly, view it on GitHub (https://github.com/OpenGATE/opengate/pull/316#issuecomment-1850208828), or unsubscribe (https://github.com/notifications/unsubscribe-auth/AIFQFYOJVUBXBME7T3FSCKLYI4LFDAVCNFSM6AAAAABALBHIUCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNJQGIYDQOBSHA).

You are receiving this because you authored the thread.

nkrah avatar Dec 11 '23 14:12 nkrah

See

  • https://discourse.itk.org/t/torch-import-time/6354/3
  • https://github.com/InsightSoftwareConsortium/ITK/pull/4369

dsarrut avatar Dec 19 '23 13:12 dsarrut

Awesome, Thomas! So we can just keep the itk package then.

I will go through this PR here and see which of the functions I have implemented might still be useful. For example, getting the size of an ITK image requires multiple lines and it is nice to provide the GATE user with a shortcut function.

I keep the PR in Draft for now until I brush it up.

nkrah avatar Dec 19 '23 15:12 nkrah