Skip to content

Add universal image loader #234

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

minhtien-trinh
Copy link

Features include:

  • Dask array conversion for flexible chunking
  • VRAM check to ensure memory sufficiency
  • Zarr-backed optimization check for efficient handling of large images

This PR is part of the issue from spatialdata.

Note: This is a work in progress; initial testing is complete, but further validation is needed.

Features include:
- Dask array conversion for flexible chunking
- VRAM check to ensure memory sufficiency
- Zarr-backed optimization check for efficient handling of large images

Note: This is a work in progress; initial testing is complete, but further validation is needed.
@codecov-commenter
Copy link

codecov-commenter commented Nov 5, 2024

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 35.87%. Comparing base (47d651d) to head (00d360e).
⚠️ Report is 231 commits behind head on main.

❗ There is a different number of reports uploaded between BASE (47d651d) and HEAD (00d360e). Click for more details.

HEAD has 1 upload less than BASE
Flag BASE (47d651d) HEAD (00d360e)
2 1
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #234      +/-   ##
==========================================
- Coverage   43.76%   35.87%   -7.90%     
==========================================
  Files          23       22       -1     
  Lines        2367     2149     -218     
==========================================
- Hits         1036      771     -265     
- Misses       1331     1378      +47     

see 6 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@lucas-diedrich
Copy link

Hi! This PR and its related issue were referenced here.

We also work with large imaging datasets that exceed memory capacity, particularly CZI and whole-slide imaging files. A strategy that has worked well for us is:

  1. Lazily loading data in small chunks using a custom image reader wrapped with dask.delayed,
  2. Passing the chunks to dask.array (via dask.array.from_delayed), which is memory-mapped and avoids memory overflow,
  3. Reassembling the chunks into a dask.array or Image2DModel.

You can find our implementation here.

For TIFF files, tifffile.memmap could potentially be used for lazy loading, as it returns a memory-mapped NumPy array. This approach does not extend to jpeg and png files. Would love to hear your thoughts!

@LucaMarconato LucaMarconato marked this pull request as draft February 10, 2025 14:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants