Project-MONAI/MONAILabel

Spacingd makes label and image shape mismatch

sharonlee12 opened this issue · 1 comments

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

Hi @sharonlee12,

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