I tried to change the default value for channel_dim in CuCIMWSIReader and found that the outputs were not correct. Therefore, I checked the source code and identified the buggy part:
|
if mode in "RGB": |
|
if patch.shape[self.channel_dim] not in [3, 4]: |
|
raise ValueError( |
|
f"The image is expected to have three or four color channels in '{mode}' mode but has " |
|
f"{patch.shape[self.channel_dim]}. " |
|
) |
|
patch = patch[:3] |
Suppose I set
channel_dim=-1, and then
patch = patch[:3] is not modifying the channel part at all, instead, it changes the image dimension!
Same problem for TiffFileWSIReader:
|
# Check if the color channel is 3 (RGB) or 4 (RGBA) |
|
if mode in "RGB": |
|
if patch.shape[self.channel_dim] not in [3, 4]: |
|
raise ValueError( |
|
f"The image is expected to have three or four color channels in '{mode}' mode but has " |
|
f"{patch.shape[self.channel_dim]}. " |
|
) |
|
patch = patch[:3] |
I tried to change the default value for
channel_diminCuCIMWSIReaderand found that the outputs were not correct. Therefore, I checked the source code and identified the buggy part:MONAI/monai/data/wsi_reader.py
Lines 821 to 827 in e5cf74a
Suppose I set
channel_dim=-1, and thenpatch = patch[:3]is not modifying the channel part at all, instead, it changes the image dimension!Same problem for
TiffFileWSIReader:MONAI/monai/data/wsi_reader.py
Lines 1179 to 1186 in e5cf74a