question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

LoadImage support for TIFF files

See original GitHub issue

Is your feature request related to a problem? Please describe. Currently due to the extra consideration needed for TIFF files of histopathology WSI images in Camelyon dataset (huge images), we were using PatchWSIData to load these images. However, with other datasets like PANDA dataset for prostate cancer, the size of images allow for loading the entire image into memory. Thus, it might be beneficial to load such images by just using LoadImage transform similar to radiology use cases.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:26 (18 by maintainers)

github_iconTop GitHub Comments

4reactions
cgohlkecommented, Nov 4, 2021

tifffile uses multithreads (# of cpus) internally while reading whole image(but it doesn’t support partial image reading)

Tifffile provides zarr store interfaces, which support partial image reading through zarr or dask. Unfortunately the overhead by zarr can be detrimental depending on how the image data in the TIFF is chunked. Tifffile also allows to iterate over segments and to memory map contiguous image data to numpy arrays if possible (e.g. ImageJ hyperstacks).

If multithreads are used in cuCIM, cuCIM is faster than tifffile.

It’s not unusual that C++/GPU implementations outperform Python implementations by 10 to 1000 and scale almost infinitely better with threads. It’s more surprising that tifffile is often in the same order of magnitude when compared to libtiff, Bio-Formats etc. Anyway, the main purpose of tifffile is to get access (from Python) to image and metadata in TIFF-like (non-conformant) files used in bioimaging.

2reactions
drbehcommented, Nov 3, 2021

@gigony, I confirm that tifffile is 3X faster than cuCIM. Is it something expected? That shapes are not the same but it seems that tifffile is not padding.

t0 = perf_counter()
img_cucim = CuImage(filename).read_region(level=1)
t_cucim = perf_counter() - t0
print(f"CuCIM   : shape = {img_cucim.shape}, time = {t_cucim:.3f}")

t0 = perf_counter()
img_tiff = tifffile.imread(filename, key=1)
t_tiff = perf_counter() - t0
print(f"Tifffile: shape = {img_tiff.shape}, time = {t_tiff:.3f}")
CuCIM   : shape = [110592, 48896, 3], time = 29.703
Tifffile: shape = (110226, 48734, 3), time =  8.446
Read more comments on GitHub >

github_iconTop Results From Across the Web

LoadImage — R3DS Wrap documentation
Loads an image from file. Images with bigger than 32-bit depth per channel are not allowed. The following formats are supported: jpg, png,...
Read more >
LoadImage - Aurora Vision Documentation
Currently the filter supports the following formats: BMP (*.bmp),; JPEG (*.jpg, *jpeg), ... Load image supports only BMP, PNG, PNM, JPG and TIFF...
Read more >
Load-Image function does not load TIFF files in OpenEdge ...
Loading the TIFF format files using the Load-Image function has always worked without any problems in (OE versions 9, 10, or 11).
Read more >
Work with TIFF Images | Documents for Imaging .NET Edition
GcImaging supports only lossless compression for TIFF frames. PNG format usually offers slightly better compression ratio, but it is limited to one image...
Read more >
Importing Images - MATLAB & Simulink - MathWorks
While you can use imread to import image data and metadata from TIFF files, the function does have some limitations. For example, a...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found