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

ants.apply_transforms(..., compose=...) cannot write hdf5 displacement field. Only nii.gz possible #475

Closed
MSco opened this issue Jun 14, 2023 · 3 comments

Comments

@MSco
Copy link

MSco commented Jun 14, 2023

Is your feature request related to a problem? Please describe.
.nii.gz is a format, that cannot deal with very large data. It would be nice to be able to write hdf5 displacement fields instead of nii.gz. antsApplyTransforms itself makes this possble, but the python wrapper function ants.apply_transforms can only write .nii.gz. It is quite easy to let the developer decide, which kind of displacement field format he would like to create.

Describe the solution you'd like
In ants.apply_transforms, just replace the line

tfn = '%scomptx.nii.gz' % compose if compose is not None else 'NA'

with

if compose:
    tfn = '%scomptx.nii.gz' % compose if not compose.endswith('.h5') else compose
else:
    tfn = 'NA'

Using this solution. The developer can use ants.apply_transforms(..., compose="path/to/my/dispfield.h5") to create an hdf5 displacement field. Using the old code instead, this would just create the following displacement field: "path/to/my/dispfield.h5comptx.nii.gz", which is a .nii.gz.

@stnava
Copy link
Member

stnava commented Jun 14, 2023

can you try this , test it and make a pull request?

@MSco
Copy link
Author

MSco commented Jun 14, 2023

Tested it successfully and created pull request #476

@cookpa
Copy link
Member

cookpa commented Jul 11, 2023

Fixed by #476?

@cookpa cookpa closed this as completed Mar 21, 2024
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

3 participants