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

Groupwise registration of 4D objects and registration with mask #276

Open
Darius888 opened this issue Mar 16, 2024 · 0 comments
Open

Groupwise registration of 4D objects and registration with mask #276

Darius888 opened this issue Mar 16, 2024 · 0 comments

Comments

@Darius888
Copy link

Darius888 commented Mar 16, 2024

Hello,

First I would like to thank you for this library, it's incredibly helpful!

I would like to ask for some guidance on groupwise registration for 4D objects.

Context: I have a 4D-CT of 10 breathing phases and each volume is of shape 128,128,128 (height, width, depth). Since this 4D-CT represent respiratory motion of a patient with a marked ROI of tumor (there is a separate structure of the same shape), groupwise registration would help a lot, by removing the need to select a reference frame.

End goal: After successfully registering this 4D object, I would like to use it to get the deformation fields for each of the phases (10) and apply linear interpolation to them (deformation fields) in-between phases and then warp the original images based on the deformation fields to get more fluid motion of the chest (basically much more breathing phases).

Code: This is what I have tried out:

image_itk_4D_ct = itk.image_view_from_array(ct_data)
image_itk_4D_tumor = itk.image_view_from_array(tumor_data)

parameter_object = itk.ParameterObject.New()
groupwise_parameter_map = parameter_object.GetDefaultParameterMap('groupwise')
parameter_object.AddParameterMap(groupwise_parameter_map)

result_image_ct, result_transform_parameters_ct = itk.elastix_registration_method(
    image_itk_4D_ct,
    image_itk_4D_ct,  
    parameter_object=parameter_object,
    log_to_console=True)

result_image_tumor, result_transform_parameters_tumor = itk.elastix_registration_method(
tumor_data, tumor_data,
parameter_object=parameter_object,
log_to_console=False)

fixed_image_itk_ct = itk.image_from_array(ct_data[0])
fixed_image_itk_tumor = itk.image_from_array(tumor_data[0])

deformation_field_ct = itk.transformix_deformation_field(fixed_image_itk_ct, result_transform_parameters_ct)
deformation_field_tumor = itk.transformix_deformation_field(fixed_image_itk_tumor, result_transform_parameters_tumor)

The problem is that I get Description: itk::ERROR: Image(000001B34E052610): Bad direction, determinant is 0. Direction is 1 0
0 0
in this line: deformation_field_ct = itk.transformix_deformation_field(fixed_image_itk_ct, result_transform_parameters_ct).

Both ct_data and tumor_data are 4D numpy arrays of shape (10,128,128,128).

Maybe you could tell me how could I avoid this situation ?

Additional question: is it possible to somehow stick the mask (tumor_data) together with the chest (ct) ? To get more fluid and correlated deformation fields between the two ?

As a reference, I'm adding a GIF of what I have and what I'm trying to register. Basically I would like to get a much smoother (with more frames/breathing phases) version of this GIF.
original_ct_data_final

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

No branches or pull requests

1 participant