Giter Club home page Giter Club logo

Comments (2)

gigony avatar gigony commented on June 15, 2024 1

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).

  • For the main (largest resolution): subfiletype == 0
  • For reduced images: subfiletype == 1

https://github.com/rapidsai/cucim/blob/branch-21.08/python/cucim/src/cucim/clara/converter/tiff.py#L160

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

https://github.com/rapidsai/cucim/blob/branch-21.08/python/cucim/src/cucim/clara/converter/tiff.py#L165

                    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:

Convert .svs file to .tif file

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 (#35)

from cucim.

aan1173 avatar aan1173 commented on June 15, 2024

uploaded the Image File(1M09_1.tif) to Google Drive.
https://drive.google.com/file/d/1AZlocYpdRZd9jC0s-JsOtWuxCTZJwdgf/view?usp=sharing

from cucim.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.