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

registration with mask does not work #127

Closed
jslalu opened this issue Jun 11, 2021 · 4 comments · Fixed by #215
Closed

registration with mask does not work #127

jslalu opened this issue Jun 11, 2021 · 4 comments · Fixed by #215

Comments

@jslalu
Copy link

jslalu commented Jun 11, 2021

I tried to use a binary mask as the fixed mask to guide the registration, but the log said fMask was unspecified. What Should I do to make the mask work?

@ViktorvdValk
Copy link
Collaborator

Did you have a look at the example notebooks yet?
In case of masks, example 3 might be helpful.

@jslalu
Copy link
Author

jslalu commented Jun 12, 2021

Did you have a look at the example notebooks yet?
In case of masks, example 3 might be helpful.

I did refer to example 3, but the log still said both fMask and mMask were unspecified. Here's my code.

elastix_object = itk.ElastixRegistrationMethod.New(fixed_image, moving_image)
elastix_object.SetFixedMask(mask)
elastix_object.SetMovingMask(mask)
elastix_object.SetParameterObject(parameter_object)
elastix_object.SetLogToConsole(True)
elastix_object.UpdateLargestPossibleRegion()
result_image = elastix_object.GetOutput()
result_transform_parameters = elastix_object.GetTransformParameterObject()

@ViktorvdValk
Copy link
Collaborator

Can you also show the part of the code that loads the mask?
And why would you want to use the same mask for both the fixed and the moving mask?

thewtex added a commit that referenced this issue Apr 5, 2022
result_image's BufferedRegion is empty.

Masked registration issue also noted in #127
@ntatsisk
Copy link
Collaborator

The empty BufferedRegion seems to be caused by not setting WriteResultImage to True (as reported in #157).

However, I am not sure if the masks are not read. Indeed, the log indicates:

ELASTIX version: 5.1.0
Command line options from ElastixBase:
-fMask unspecified, so no fixed mask used
-mMask unspecified, so no moving mask used

but later it also reports:

Setting the fixed masks took: 0 ms.
Setting the moving masks took: 1 ms.

So, I assume the masks are being used.. cc. @N-Dekker

N-Dekker added a commit to SuperElastix/elastix that referenced this issue May 22, 2023
Avoided confusing log messages saying "-fMask    unspecified, so no fixed mask used" and "-mMask    unspecified, so no moving mask used" for library users (including ITKElastix).

Relates to issue InsightSoftwareConsortium/ITKElastix#127 "registration with mask does not work", reported by jslalu, June 11, 2021.
N-Dekker added a commit to SuperElastix/elastix that referenced this issue May 24, 2023
Avoided confusing log messages saying "-fMask    unspecified, so no fixed mask used" and "-mMask    unspecified, so no moving mask used" for library users (including ITKElastix).

Relates to issue InsightSoftwareConsortium/ITKElastix#127 "registration with mask does not work", reported by jslalu, June 11, 2021.
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 a pull request may close this issue.

3 participants