1

I'm trying to understand how to read an image as an array using cucim. My image is a float64 .tiff with shape=(657, 668) from a CT-scan.

The closest function I could find was read_region (I couldn't find an imread-style function). I didn't understand all the documentation of the arguments read_region but I've followed examples that I found online.

import numpy as np
from cucim import CuImage

im_path = r'/mnt/c/Users/.../filename.tiff'
im_obj = CuImage(im_path)
count = im_obj.resolutions['level_count']
dimensions = im_obj.resolutions['level_dimensions']
region = im_obj.read_region(location=(0, 0), level=count-1, size=dimensions[count-1])
im_arr = np.asarray(region)

I got these errors and warnings:

[Warning] Loading image('/mnt/c/Users/.../filename.tiff') with a slow-path. The pixel format of the loaded image would be RGBA (4 channels) instead of RGB!`

region = m_obj.read_region(location=(0, 0), level=count-1, size=dimensions[count-1])
RuntimeError: This format (compression: 1, sample_per_pixel: 1, planar_config: 1, photometric: 1) is not supported yet!: Sorry, can not handle images with 64-bit samples

Not sure what a slow-path is, and I couldn't find anything about dtype support in the cucim docs. Am I doing something wrong or is it simply not possible to do what I'm trying to do? Should I use e.g. imageio instead to read the image and then apply cucim's other functions on that?


Specs:

Ubuntu  22.04.3 LTS on WSL2

Build cuda_12.2.r12.2/compiler.33191640_0

cucim 24.04.00 cuda12_py310_240410_ga24abfd_0 rapidsai (installed using conda)

1 Answer 1

1

RAPIDS cuCIM's data loading-related API is focused on loading digital pathology images (usually three channels (RGB) and tiled images).

This format (compression: 1, samples_per_pixel: 1, planar_config: 1, photometric: 1)

It looks like the image given is uncompressed, 1-channel, 64-bit float grayscale, which cuCIM doesn't support yet.

As you mentioned, please consider using other libraries such as imageio or cgohlke/tifffile: Read and write TIFF files for TIFF file loading and then apply cuCIM's image processing API (based on CuPy) on that. Thanks!

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.