EnsureChanneld for data loaded with NumpyReader?

Hi everyone,

I am currently trying to train a segmentation model on my custom data.

I implemented a custom dataset working with the dictionary structure.
It works well to load the data with the LoadImaged pre_transform.

A loaded image has the shape (224,224,3) and the corresponding segmentation mask is of shape (10,224,224).
When I try to run the EnsureChannelFirstd pre_transform for the image and the segmentation mask:

  {
    "name": "EnsureChannelFirstd",
    "args": {
      "keys": ["image", "label"]
    }
  },

I get the following error:


Original Traceback (most recent call last):
  File "/opt/monai/monai/transforms/transform.py", line 48, in apply_transform
    return transform(data)
  File "/opt/monai/monai/transforms/utility/dictionary.py", line 252, in __call__
    d[key] = self.adjuster(d[key], d[f"{key}_{self.meta_key_postfix}"])
  File "/opt/monai/monai/transforms/utility/array.py", line 168, in __call__
    raise ValueError("meta_dict must contain `original_channel_dim` information.")
ValueError: meta_dict must contain `original_channel_dim` information.


Traceback (most recent call last):
  File "/opt/monai/monai/transforms/transform.py", line 48, in apply_transform
    return transform(data)
  File "/opt/monai/monai/transforms/compose.py", line 144, in __call__
    input_ = apply_transform(_transform, input_)
  File "/opt/monai/monai/transforms/transform.py", line 71, in apply_transform
    raise RuntimeError(f"applying transform {transform}") from e
RuntimeError: applying transform <monai.transforms.utility.dictionary.EnsureChannelFirstd object at 0x7f5d92d7b100>

I set the metadata flag to true, but it seems like it is only added by the ImageReader and not by the NumpyReader, which reads the segmentation mask. Is EnsureChannelFirstd only appropriated for loaded images?