torchio
torchio copied to clipboard
Unexpected transformation when using RandomAffine/RandomElasticDeformation
Is there an existing issue for this?
- [X] I have searched the existing issues
Problem summary
Hi, thank you for your work!
I got a problem and hope you can help. My model has 2 input images and two corresponding masks for the segmentation task. I want two images transformed the same (and also masks). The image and mask inputs shape are all (1, 8, 224,224). I tried to use other transformation such as Flip, Noise, Blur, Motion,... and they worked. However, whenever I tried to use RandomAffine or RandomElasticDeformation, the image are transformed unexpectedly (I used 3Dslicer to visualize), and their output shapes are still correct. Do you have any idea for this?
This is before transformation:
And this is after transformation:
Code for reproduction
subject = tio.Subject(
image1=tio.ScalarImage(tensor=torch.from_numpy(images[..., 0]).unsqueeze(0)), # First image
mask1=tio.LabelMap(tensor=torch.from_numpy(masks[..., 0]).unsqueeze(0)), # Corresponding mask for image1
image2=tio.ScalarImage(tensor=torch.from_numpy(images[..., 1]).unsqueeze(0)), # Second image
mask2=tio.LabelMap(tensor=torch.from_numpy(masks[..., 1]).unsqueeze(0)), # Corresponding mask for image2
diagnosis='negative',
)
Actual outcome
nothing
Error messages
No response
Expected outcome
nothing
System info
No response