Open aan1173 opened 3 years ago
uploaded the Image File(1M09_1.tif) to Google Drive. https://drive.google.com/file/d/1AZlocYpdRZd9jC0s-JsOtWuxCTZJwdgf/view?usp=sharing
Thanks @aan1173 for the report and sorry for the late response.
For Generic tiled tiff file to be loaded by cuCIM, subfile
type of TIFF is correctly set (only one image with subfile type 0 which is the largest image should be available).
SUBFILETYPE_NONE = 0
SUBFILETYPE_REDUCEDIMAGE = 1
if level: # if this image is reduced image
subfiletype = SUBFILETYPE_REDUCEDIMAGE
else: # if this is the original image (largest image)
subfiletype = SUBFILETYPE_NONE
tif.save(
src_arr,
software="Glencoe/Faas pyramid",
metadata={"axes": "YXC"},
tile=(tile_size, tile_size),
photometric="RGB",
planarconfig="CONTIG",
resolution=(
x_resolution // 2 ** level,
y_resolution // 2 ** level,
resolution_unit,
),
compress=("jpeg", 95), # requires imagecodecs
subfiletype=subfiletype,
)
To convert .svs file to Generic TIFF format, you can use cucim's cli command:
This package has the CLI tool to convert image in other formats (such as .svs) to TIFF (JPEG-compressed) image by using tifffile library. You can exploit the tool until cuCIM natively supports Aperio SVS format.
Please install openslide-python
, opencv-python
and tifffile
package and follow the instruction here:
$ cucim convert --help
Usage: cucim convert [OPTIONS] SRC_FILE [DEST_FOLDER]
Convert file format
Options:
--tile-size INTEGER
--overlap INTEGER
--num-workers INTEGER
--output-filename TEXT
--help Show this message and exit.
$ cucim convert input/TUPAC-TR-467.svs --output-filename TUPAC-TR-467.tif --tile-size 512
INFO:cucim.clara.converter.tiff:Parameters
INFO:cucim.clara.converter.tiff: input file: input/TUPAC-TR-467.svs
INFO:cucim.clara.converter.tiff: output folder: .
INFO:cucim.clara.converter.tiff: tile size: 512
INFO:cucim.clara.converter.tiff: overlap: 0
INFO:cucim.clara.converter.tiff: num_workers: 12
INFO:cucim.clara.converter.tiff: output filename: TUPAC-TR-467.tif
INFO:cucim.clara.converter.tiff: Created level0.mmap (26420, 19920, 3)
INFO:cucim.clara.converter.tiff: Created level1.mmap (13210, 9960, 3)
INFO:cucim.clara.converter.tiff: Created level2.mmap (6605, 4980, 3)
INFO:cucim.clara.converter.tiff: Created level3.mmap (3302, 2490, 3)
INFO:cucim.clara.converter.tiff: Created level4.mmap (1651, 1245, 3)
INFO:cucim.clara.converter.tiff: Created level5.mmap (826, 622, 3)
INFO:cucim.clara.converter.tiff:Processing tiles...
INFO:cucim.clara.converter.tiff:Storing low resolution images...
INFO:cucim.clara.converter.tiff: Level 1: (13210, 9960, 3)
INFO:cucim.clara.converter.tiff: Level 2: (6605, 4980, 3)
INFO:cucim.clara.converter.tiff: Level 3: (3302, 2490, 3)
INFO:cucim.clara.converter.tiff: Level 4: (1651, 1245, 3)
INFO:cucim.clara.converter.tiff: Level 5: (826, 622, 3)
INFO:cucim.clara.converter.tiff:Saving Level 0 image (19920 x 26420)...
INFO:cucim.clara.converter.tiff:Saving Level 1 image (9960 x 13210)...
INFO:cucim.clara.converter.tiff:Saving Level 2 image (4980 x 6605)...
INFO:cucim.clara.converter.tiff:Saving Level 3 image (2490 x 3302)...
INFO:cucim.clara.converter.tiff:Saving Level 4 image (1245 x 1651)...
INFO:cucim.clara.converter.tiff:Saving Level 5 image (622 x 826)...
INFO:cucim.clara.converter.tiff:Done.
INFO:cucim.clara.converter.tiff:Removing memmapped files...
code for the converter is available in https://github.com/rapidsai/cucim/blob/branch-21.08/python/cucim/src/cucim/clara/converter/tiff.py and it uses this CLI (https://github.com/rapidsai/cucim/blob/branch-21.08/python/cucim/src/cucim/clara/cli.py).
FYI, we are planning to support .svs format for v21.10.01 (https://github.com/rapidsai/cucim/issues/35)
HI cuCIM staff
My company is doing image processing stuff, and the image format provided is '.svs'. Since we are interesting in this tool kit, we convert the .svs to .tif format by tifffile package.
I got this error message when I ran code below. " input_file = "1M09_1.tif" slide = cucim.CuImage(input_file) " OS: Ubuntu 18.04
The point is I really don't know how to fix this error.
BTW, I did try with another image(get from online) in this step. And it works as normal. So, I guess my cuCIm installed correctly.