Open markus-hinsche opened 1 year ago
I think this is a bug in monai.utils.type_conversion.convert_data_type
.
If you refer to the __call__
function of MulticlassSegNrrdToOneHot
, convert_data_type
is the first and last function called.
def __call__(
self, image: NdarrayOrTensor, label: NdarrayOrTensor, label_meta_dict: dict
) -> Tuple[NdarrayOrTensor, Dict]:
"""
...
"""
label, dtype, _ = convert_data_type(label, np.ndarray)
...
one_hot, *_ = convert_data_type(one_hot, dtype)
return (one_hot, label_meta_dict)
Here dtype
is the datatype of the image (e.g. float32), which I save and then use to re-cast the one-hot image to said type.
It should stay with the same dtype it receives