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

Spacingd makes label and image shape mismatch #1684

Open
sharonlee12 opened this issue May 6, 2024 · 1 comment
Open

Spacingd makes label and image shape mismatch #1684

sharonlee12 opened this issue May 6, 2024 · 1 comment

Comments

@sharonlee12
Copy link

Please use MONAILabel's Discussions tab
For questions relating to MONAILabel usage, please do not create an issue.

Instead, use MONAI's GitHub Discussions tab. This can be found next to Issues and Pull Requests along the top of our repository.
load_transforms = monai.transforms.Compose([
monai.transforms.LoadImaged(keys=["image", "label_path"]),
monai.transforms.AddChanneld(keys=["image", "label_path"]),
monai.transforms.Orientationd(keys=["image", "label_path"], axcodes="RAS"),

    ])

and out put is untransformed is (1, 512, 512, 254),(1, 512, 512, 254)

while:
spacing_transforms = monai.transforms.Compose([
monai.transforms.LoadImaged(keys=["image", "label_path"]),
monai.transforms.AddChanneld(keys=["image", "label_path"]),
monai.transforms.Orientationd(keys=["image", "label_path"], axcodes="RAS"),
monai.transforms.Spacingd(keys=["image", "label_path"],
pixdim=(args.space_x, args.space_y, args.space_z),
mode=("bilinear", "nearest")),

    ])

and output is transformed is (1, 326, 326, 423),(1, 342, 342, 170)
and my version is monai 1.1.0,there is a warning——pixdim[0] (qfac) should be 1 (default) or -1; setting qfac to

@diazandr3s
Copy link
Collaborator

Hi @sharonlee12,

Are both the image and label of the same size when loading them? I suspect that may be the issue.

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

2 participants