Replies: 2 comments 2 replies
-
Okay, playing a little bit more with it show that if the Compose pipeline changes to the following it works fine: transforms=mn.transforms.Compose([
mn.transforms.LoadImageD(keys=["image"],reader="NibabelReader"),
mn.transforms.ToMetaTensorD(keys=["image"])
mn.transforms.SpacingD(keys=["image"], pixdim=[1,1,1], padding_mode=["zeros"], mode=["bilinear"]),
mn.transforms.ToTensorD(keys=["image"], dtype=torch.float),
]) i.e., first converting to MetaTensor and then doing all the spacings. But this is not a good user experience, and I believe MetaTensor should get the affine information from previous transforms, regardless of order. |
Beta Was this translation helpful? Give feedback.
0 replies
-
Thanks, it's the ToTensorD that drops all the meta info and causes the spacing issues. I'd suggest removing all the ToTensorD in the pipeline and then retrying the runs. |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Describe the bug
Suppose that I have an image and when the image is loaded it will be converted to a high-resolution format using:
Then in another part of the pipeline, I want to convert it to a low-resolution image so I would say:
This should work fine, but the spacing is wrong and the image is very low res:
I add the
low_res_spacing
transform to the compose pipeline it works fine. As soon as MetaTensor is out of the compose, the spacing transform fails to work properly:Because the MetaTensor has the affine information, the transform should work properly. And if I don't convert it to MetaTensor, it says:
Which is not.
Expected behavior
I suppose the user should be able to apply spacing transforms after applying a composed pipeline of transforms.
Screenshots
If applicable, add screenshots to help explain your problem.
Environment
Ensuring you use the relevant python executable, please paste the output of:
Beta Was this translation helpful? Give feedback.
All reactions