Skip to content

Conversation

@Steven-N-Hart
Copy link

Motivation and Context

Currently, the TRIDENT library excels at processing whole-slide images from local file formats (like SVS, TIFF) but lacks native support for cloud-hosted DICOMs. As modern digital pathology workflows increasingly rely on cloud infrastructure and standardized formats, this limits TRIDENT's direct applicability in these environments. Accessing slides via DICOMweb is a critical feature for scalability and interoperability.

This pull request introduces the DICOMWebWSI class, a new WSI object that enables TRIDENT to directly read and process whole-slide images from any DICOMweb-compliant server, such as the Google Cloud Healthcare API or Orthanc. This eliminates the need for manual downloads, allowing for seamless integration with cloud-based pathology archives.

Description

This PR adds the following key components:

  1. DICOMWebWSI Class (trident/wsi_objects/DICOMWebWSI.py): A new WSI reader that inherits from the base WSI class. It connects to a DICOMweb server via a study/series URL and handles the complexities of the DICOM format for whole-slide imaging.

  2. WSIFactory Update (trident/wsi_objects/WSIFactory.py): The factory has been updated to recognize http:// or https:// URLs and automatically instantiate the DICOMWebWSI class.

Key Features of DICOMWebWSI:

  • Metadata Parsing: Automatically fetches and parses metadata for all instances in a DICOM series to determine dimensions, tile sizes, and pyramid levels.

  • Pyramid Construction: Organizes DICOM instances into a logical pyramid, sorting them from highest to lowest resolution.

  • *Flexible Frame Handling: Supports both tiled (multi-frame) and non-tiled (single-frame) DICOM instances, which is crucial for handling vendor variability in how lower-resolution pyramid levels are stored.

  • Authentication: Includes logic to handle authentication for Google Cloud Healthcare API, with the ability to use gcloud credentials.

  • Efficient Tiling: Implements a read_region method that calculates the correct frame numbers to fetch, composites the tiles into the requested region, and includes an in-memory cache for fetched frames to improve performance.

How Has This Been Tested?

The DICOMWebWSI class was tested extensively using the run_single_slide.py script against a whole-slide image hosted on a Google Cloud Healthcare API DICOMweb server.

image

@guillaumejaume
Copy link
Contributor

Hi @Steven-N-Hart, many thanks for this PR.

DICOM web is quite specific. Some of the files/changes that you included would be best in a dedicated tutorial that people can check if they have a similar use case.

for instance,

  • .env.example should be set per user (ok if in a dedicated tuto example)
  • all additional dependencies should be optional for dicom web
  • the code:
from dotenv import load_dotenv
load_dotenv()

should be set at inference time for users that need it.

Let me know if you have time to make these changes, thanks

@Steven-N-Hart
Copy link
Author

Steven-N-Hart commented Oct 19, 2025 via email

@Steven-N-Hart
Copy link
Author

Tutorial added.

@Steven-N-Hart
Copy link
Author

Any other changes?

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.

2 participants