MONAILabel icon indicating copy to clipboard operation
MONAILabel copied to clipboard

Spacingd makes label and image shape mismatch

Open sharonlee12 opened this issue 1 year ago • 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

sharonlee12 avatar May 06 '24 13:05 sharonlee12

Hi @sharonlee12,

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

diazandr3s avatar May 07 '24 20:05 diazandr3s