Project-MONAI / MONAILabel

MONAI Label is an intelligent open source image labeling and learning tool.
https://docs.monai.io/projects/label
Apache License 2.0
595 stars 191 forks source link

Spacingd makes label and image shape mismatch #1684

Open sharonlee12 opened 4 months ago

sharonlee12 commented 4 months ago

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 commented 4 months ago

Hi @sharonlee12,

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