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

composition of Pad and Crop lead to a nifti header change #351

Closed
romainVala opened this issue Nov 5, 2020 · 4 comments
Closed

composition of Pad and Crop lead to a nifti header change #351

romainVala opened this issue Nov 5, 2020 · 4 comments
Labels
bug Something isn't working

Comments

@romainVala
Copy link
Contributor

🐛Bug

Not sure if it is a bug, sorry if I miss something: I want to do a padding (before model prediction) and then a crop on the prediction, but I notice a change in the nifti header, which make it as if there was a translation (if I save the output in a nifti file )

To reproduce

# Your code here
import torchio as tio
sub = tio.datasets.Colin27()

t = tio.Compose([tio.Pad(padding=10), tio.Crop(bounds_parameters=10)])
new_sub = t(sub)

print(new_sub.t1.affine)
print(sub.t1.affine)
# Your errors here

Expected behavior
the transformed image should have the save affine no ?

Actual behavior

TorchIO version

@romainVala romainVala added the bug Something isn't working label Nov 5, 2020
@fepegar
Copy link
Owner

fepegar commented Nov 5, 2020

Yes. It looks like a bug! I'll take a look.

@fepegar
Copy link
Owner

fepegar commented Nov 5, 2020

The problem seems to be in Crop.

@fepegar fepegar closed this as completed in ba31a18 Nov 5, 2020
@fepegar
Copy link
Owner

fepegar commented Nov 5, 2020

Fixed in v0.17.53. Thanks for reporting!

@romainVala
Copy link
Contributor Author

thanks for correcting !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants