Skip to content

Conversation

@MMelQin
Copy link
Collaborator

@MMelQin MMelQin commented Nov 20, 2025

This WIP pull request adds a custom pydicom decoder plugin using NVIDIA's nvImageCodec library to accelerate DICOM image decompression for various JPEG and JPEG2000 transfer syntaxes.

Key Changes:

  • Implements a new decoder plugin in decoder_nvimgcodec.py supporting 9 DICOM transfer syntaxes (JPEG Baseline, Extended, Lossless, JPEG2000, and HTJ2K variants)
  • Integrates the decoder into DICOMSeriesToVolumeOperator to automatically register the plugin during initialization
  • Exposes the decoder module through the operators package interface

Special note on testing:

The approach for testing is to compare the decoded pixel values from nvImgCodec against those from the built-in decoders, be it GDCM, libjpeg or else, essentially measuring against the known good ones.

It is observed that the decoded pixels by nvImgCodec for JPEG Baseline 8 bit 1.2.840.10008.1.2.4.50 and HTJ2K 1.2.840.10008.1.2.4.203 are different from those by Pydicom default decoders. The standards allow for some differences on decoding, and assertion is not applied to results with these transfer syntax's, even with comparison tolerances.

For the lossless ones, pixels are exactly matching between nvImgCodec and the default ones (tolerances were not really needed)

See the attached file for details results.
results_PAE_MSE.md

Signed-off-by: M Q <mingmelvinq@nvidia.com>
Signed-off-by: M Q <mingmelvinq@nvidia.com>
Signed-off-by: M Q <mingmelvinq@nvidia.com>
Signed-off-by: M Q <mingmelvinq@nvidia.com>
Signed-off-by: M Q <mingmelvinq@nvidia.com>
Signed-off-by: M Q <mingmelvinq@nvidia.com>
@MMelQin MMelQin requested a review from Copilot November 20, 2025 16:25
Copilot finished reviewing on behalf of MMelQin November 20, 2025 16:28
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds GPU-accelerated DICOM image decompression capabilities using NVIDIA's nvImageCodec library. The implementation creates a custom pydicom decoder plugin that supports 9 JPEG and JPEG2000 transfer syntaxes, automatically registering during the DICOMSeriesToVolumeOperator initialization.

  • Implements a new decoder plugin module (decoder_nvimgcodec.py) that integrates with pydicom's pixels backend
  • Automatically registers the decoder plugin when creating DICOMSeriesToVolumeOperator instances
  • Exposes the decoder module through the operators package interface

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 12 comments.

File Description
monai/deploy/operators/decoder_nvimgcodec.py New module implementing nvImageCodec-based decoder plugin with functions for availability checking, frame decoding, plugin registration, and helper utilities for module path resolution
monai/deploy/operators/dicom_series_to_volume_operator.py Integrates decoder plugin by importing the module and calling registration during operator initialization
monai/deploy/operators/__init__.py Exposes the decoder module through package imports and adds it to __all__ list

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Signed-off-by: M Q <mingmelvinq@nvidia.com>
Signed-off-by: M Q <mingmelvinq@nvidia.com>
Signed-off-by: M Q <mingmelvinq@nvidia.com>
Signed-off-by: M Q <mingmelvinq@nvidia.com>
Signed-off-by: M Q <mingmelvinq@nvidia.com>
Signed-off-by: M Q <mingmelvinq@nvidia.com>
Signed-off-by: M Q <mingmelvinq@nvidia.com>
Signed-off-by: M Q <mingmelvinq@nvidia.com>
Signed-off-by: M Q <mingmelvinq@nvidia.com>
Signed-off-by: M Q <mingmelvinq@nvidia.com>
Signed-off-by: M Q <mingmelvinq@nvidia.com>
Signed-off-by: M Q <mingmelvinq@nvidia.com>
Signed-off-by: M Q <mingmelvinq@nvidia.com>
@sonarqubecloud
Copy link

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