LoadImaged for 2D/3D grayscale tiff files
See original GitHub issueUsing 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
Issue Analytics
- State:
- Created 2 years ago
- Comments:12 (8 by maintainers)
Top Results From Across the Web
Vaa3D and Vaa3D-Neuron: help - NITRC
The istitch plugin we've developed for stitching 2D/3D/4D images with ... The same happens if I try to use TIFF (tiled, 2D) and...
Read more >Apropos image - FreeBSD
TIF it needs libpng resp. libtiff; jbigtopnm(1): JBIG to PNM image file converter ... for Digital Images; pgm(5): Netpbm grayscale image format description ......
Read more >Changelog — Ensenso SDK 3.4.715 documentation
Add: NxLib: Support for tiff file format with float and short data types in LoadImage and SaveImage (e.g. for reading/writing DisparityMap or PointMap...
Read more >CImg_reference.pdf - The CImg Library
on which image slice and vector channel the loop must apply (usually both 0 for grayscale 2D images). Finally, I is.
Read more >Pylimph Node V2.0.6 - Khan Academy
Most modern media software can view SVG files, including Adobe * products, ... ALPHA_MASK); } // Grayscale and alpha if (curColorMode === PConstants....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@wyli, that depends on the backends and each of them handles this differently, so we don’t know it before loading the image. It should be addressed in
cuCIM
, so I made an issue on their repo.@perlmutter, I believe we already support functionality via ITK. You should be able to use
ITKReader
for your use case. For your example above you can change it to: