Skip to content
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

Add ITK Elastix registration operator #2218

Merged
merged 2 commits into from Jan 5, 2022

Conversation

psavery
Copy link
Contributor

@psavery psavery commented Dec 7, 2021

This adds a volume registration operator that uses ITK Elastix.

To use it, ITK Elastix must be installed via pip install itk-elastix.
This was designed to work in both pip and conda environments. We will
look into adding this to the tomviz conda build.

registration_example.mp4

Previously, the enumeration data type was required to be an int.
However, there are some cases where it is better for it to be
something else, such as a string. It is very helpful for integrating
the ITK Elastix library for it to be a string, since that is what
we will actually be setting in the ITK Elastix parameters.

Thus, try to convert the data to an int if possible (otherwise, it
will always be interpreted as a float, which will cause issues with
some operators). If it's not an int, just let it be whatever type
it is (float, string, bool, None).

Signed-off-by: Patrick Avery <patrick.avery@kitware.com>
This adds a volume registration operator that uses ITK Elastix.

To use it, ITK Elastix must be installed via `pip install itk-elastix`.
This was designed to work in both pip and conda environments. We will
look into adding this to the tomviz conda build.

Signed-off-by: Patrick Avery <patrick.avery@kitware.com>
@cjh1
Copy link
Member

cjh1 commented Dec 13, 2021

@psavery Is itk-elastix enable in the version of ITK in our super build?

@psavery
Copy link
Contributor Author

psavery commented Dec 14, 2021

@psavery Is itk-elastix enable in the version of ITK in our super build?

No, I think it is separate from ITK, and that you can't enable it in ITK. We might be able to clone the repository and build it, but I'm not sure. I know that we can, however, pip install itk-elastix, which works in conda environments as well.

@cjh1
Copy link
Member

cjh1 commented Dec 14, 2021

We may want todo what we did for databroker and only enable the operator if we can import itk-elastix. Not sure how hard this would be todo for an operator.

@psavery
Copy link
Contributor Author

psavery commented Dec 14, 2021

So currently, the action lives inside the AddPythonTransformReaction here similar to what the other actions/reactions are doing.

Should we implement something so that the AddPythonTransformReaction can figure out whether to enable/disable the action? I have thought of two options:

  1. Try to import the script in python and if any errors occur, disable the action. This means at the file level, some logic could be present to determine whether the right dependencies (and right versions) are available, and if not, raise an exception.
  2. Have a list of required dependencies in the description.json file. Maybe try to import those modules in python, and if it fails, disable the module. Although things like version requirements might would be nice too.

Copy link
Member

@cjh1 cjh1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, I think for now we can punt on disabling if elastix is not available. We can look at one of the cleaner solutions in the future.

@psavery psavery merged commit 92ac7bb into OpenChemistry:master Jan 5, 2022
@psavery psavery deleted the itk-elastix-registration branch January 5, 2022 17:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants