-
Notifications
You must be signed in to change notification settings - Fork 1.5k
LoadImaged for 2D/3D grayscale tiff files #3858
Copy link
Copy link
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Using LoadImaged on a 2D grayscale tiff file with WSIReader and backend=cucim returns an array with 3 "color" channels, which are all identical.
For example,
data_dict = {"image": "test.tif"}
x = np.random.randint(low=0,high=256,size=(128,128),dtype=np.uint8)
io.imsave(data_dict["image"],x)
print("cucim: shape = " + str(cucim.CuImage(data_dict["image"]).shape))
transform = LoadImaged(keys=["image"], reader=WSIReader, backend='cuCIM')
print("LoadImaged-cucim: shape = " + str(transform(data_dict)["image"].shape))
returns,
cucim: shape = [128, 128, 1]
LoadImaged-cucim: shape = (3, 128, 128)
When using backend=tifffile the files are misread entirely
print("tifffule: shape = " + str(tifffile.imread(data_dict["image"]).shape))
transform = LoadImaged(keys=["image"], reader=WSIReader, backend='tifffile')
print("LoadImaged-tifffile: shape = " + str(transform(data_dict)["image"].shape))
returns,
tifffule: shape = (128, 128)
LoadImaged-tifffile: shape = (3, 128)
Is this the expected behavior? Is there a better way to read 2D grayscale tiff files into monai? How about 3D grayscale tiffs?
Thanks,
David
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working