-
Notifications
You must be signed in to change notification settings - Fork 264
NormalizeLabelsInDatasetd to lost Meta Information #921
Copy link
Copy link
Closed
Description
Describe the bug
During handling a discussion problem with a user, I found the transformation NormalizeLabelsInDatasetd in deepedit has some issues to be compatible with MetaTensor. It seems the meta information after NormalizeLabelsInDatasetd will be lost.
Version: latest MONAI and MONAILABEL release.
To Reproduce
from monai.transforms import (
EnsureChannelFirstd,
LoadImaged,
SaveImaged,
Compose,
Orientationd
)
from monai.apps.deepedit.transforms import (
NormalizeLabelsInDatasetd,
)
_labels = {'cancer': 1, 'transfer': 2, 'background': 0}
train_transforms = Compose(
[
LoadImaged(keys=("label"), reader="ITKReader"),
NormalizeLabelsInDatasetd(keys=("label"), label_names=_labels),
EnsureChannelFirstd(keys=("label")),
Orientationd(keys=("label"), axcodes="RAS"),
#========================================================================
SaveImaged(keys="label", output_dir = './', mode='bilinear', output_postfix='label2')
]
)
image_path = [{'label': '/home/yuchengt/yuchengt/2022/MONAI/monailabel_projectYT/MONAILabel-main/test_data/HNC/labels/original/NPC_AI_Detectionl_01.nii.gz'}]
train_transforms(image_path)
Behavior
isinstance(img, MetaTensor) will be True, but img.meta will lost meta information.
KeyError: 'filename_or_obj'
The tested data can be downloaded via the link that the user provided:
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels