Skip to content

Images with no color channel! #230

Open
@bhashemian

Description

@bhashemian

Describe the bug
When using cuCIM to load TIFF files that does not have color channel (a grayscale 2D image), no error is thrown and instead the values will be repeated to create an RGBA image, representing the grayscale image. This may cause confusion, like here: Project-MONAI/MONAI#3858

Steps/Code to reproduce bug

import numpy as np                                                                                                                                                                                                                           
from skimage import io    
from cucim import CuImage

image_path = "test.tif"
x = np.random.randint(low=0, high=256, size=(128,128), dtype=np.uint8)
io.imsave(image_path, x) 

img = np.array(CuImage(image_path).read_region())
print(f"{img.shape = }")
print(f"{img[0, 0, :] = }")
img.shape = (128, 128, 4)
img[0, 0, :] = array([121, 121, 121, 255], dtype=uint8)

Metadata

Metadata

Assignees

Labels

MONAIMONAI-specific requestsfeature requestNew feature or request

Type

No type

Projects

Status

No status

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions