Skip to content

Conversation

jantonguirao
Copy link

@jantonguirao jantonguirao commented Oct 17, 2025

Add HTJ2K DICOM support and upgrade to pydicom 3.0

Key Changes:

  • Upgrade to pydicom 3.0.0 for HTJ2K support
  • Replace pydicom-seg with highdicom (pydicom-seg unmaintained)
  • Add NvDicomReader for GPU-accelerated DICOM decoding with nvidia-nvimgcodec-cu{XX}
  • Add transcode_dicom_to_htj2k function to convert utils, to batch transcode a directory of DICOMs to Hight Throughput JPEG2000 (lossless)

NvDicomReader Features:

  • HTJ2K transfer syntax support (1.2.840.10008.1.2.4.{201, 202, 203}
  • Batch decoding for DICOM series
  • Proper spatial slice ordering and affine matrix calculation
  • Configurable layouts (NumPy-like D,H,W or ITK-like W,H,D)
  • Fallback to pydicom/SimpleITK when nvimgcodec unavailable

DICOM SEG Improvements:

  • Migrate to highdicom for DICOM SEG creation
  • Preserve ITK/dcmqi fallback path

Optional Dependencies:

  • nvidia-nvimgcodec and dcmqi are optional
  • Runtime checks with clear installation instructions

Testing:

  • Comprehensive NvDicomReader tests (HTJ2K decoding, consistency, metadata)
  • DICOM ↔ NIfTI conversion tests for original and HTJ2K files
  • Automatic HTJ2K test data generation

@jantonguirao jantonguirao changed the title [Draft] Refactor DICOM/NIfTI conversion with highdicom and optional dependencies [Draft] Add HTJ2K DICOM support and upgrade to pydicom 3.0 Oct 17, 2025
@jantonguirao jantonguirao changed the title [Draft] Add HTJ2K DICOM support and upgrade to pydicom 3.0 [Draft] Add HTJ2K DICOM support Oct 17, 2025
@jantonguirao jantonguirao force-pushed the htj2k_support branch 7 times, most recently from abd51e4 to a3a54b3 Compare October 17, 2025 15:40
Key Changes:
- Upgrade to pydicom 3.0.0 for HTJ2K support
- Replace pydicom-seg with highdicom (pydicom-seg unmaintained)
- Add NvDicomReader for GPU-accelerated DICOM decoding with nvidia-nvimgcodec

NvDicomReader Features:
- HTJ2K transfer syntax support (1.2.840.10008.1.2.4.201/202/203)
- Batch decoding optimization for HTJ2K series
- Proper spatial slice ordering and affine matrix calculation
- Configurable layouts (NumPy D,H,W or ITK W,H,D)
- Fallback to pydicom/SimpleITK when nvimgcodec unavailable

DICOM SEG Improvements:
- Migrate to highdicom for DICOM SEG creation
- Memory-efficient processing with stop_before_pixels
- Support up to 65,535 segments (uint16)
- Preserve ITK/dcmqi fallback path

Optional Dependencies:
- nvidia-nvimgcodec and dcmqi are now optional
- Runtime checks with clear installation instructions

Testing:
- Comprehensive NvDicomReader tests (HTJ2K decoding, consistency, metadata)
- DICOM ↔ NIfTI conversion tests for original and HTJ2K files
- Automatic HTJ2K test data generation

Signed-off-by: Joaquin Anton Guirao <[email protected]>
@jantonguirao jantonguirao force-pushed the htj2k_support branch 2 times, most recently from 3736a2b to 119f000 Compare October 17, 2025 17:01
@SachidanandAlle
Copy link
Collaborator

Looks good to me.. however better if all E2E is tested and verified for existing use cases to make sure new changes does break.

Thank you for trying to improve monai label.

Signed-off-by: Joaquin Anton Guirao <[email protected]>
…ch processing for large directories

Signed-off-by: Joaquin Anton Guirao <[email protected]>
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