Skip to content

feat: Add DICOM (.dcm) file upload support with patient metadata extraction#120

Open
ironman1947 wants to merge 1 commit into
Brijeshthummar02:masterfrom
ironman1947:feat/dicom-support
Open

feat: Add DICOM (.dcm) file upload support with patient metadata extraction#120
ironman1947 wants to merge 1 commit into
Brijeshthummar02:masterfrom
ironman1947:feat/dicom-support

Conversation

@ironman1947

Copy link
Copy Markdown

Summary

This PR adds native DICOM (.dcm) file upload support to NeuroVision,
enabling clinicians to upload MRI scans directly from scanner output
without manual conversion.

Key Features

✅ Parse DICOM headers (patient age, gender, modality, field strength, etc.)
✅ Normalize 16-bit pixel arrays to 8-bit for model inference
✅ Display extracted metadata in diagnostic report
✅ Lossless support for raw clinical MRI scanner output
✅ Backward compatible with PNG/JPG/TIFF uploads

Why DICOM Matters

DICOM is the universal standard format from all clinical MRI vendors
(Siemens, GE, Philips). Without DICOM support, NeuroVision cannot
integrate into real clinical workflows.

Changes

  • Backend: pydicom integration, DICOM header parsing, 16-bit → 8-bit normalization
  • Frontend: .dcm file type support, metadata card in diagnostic report
  • Tests: 38/38 passing unit tests

Testing

pip install -r requirements-web.txt
pytest tests/
# All 38 tests pass

Contributing to GSSoC 2026. Ready for review!

…ta extraction

- Add pydicom>=2.4.0 dependency for DICOM file parsing
- Implement process_dicom_file() helper to extract patient headers (age,
  gender, modality, field strength, scan sequence, manufacturer, study
  date) and normalize 16-bit pixel arrays to BGR for model ingestion
- Extend ALLOWED_EXTENSIONS and /api/predict route to handle .dcm uploads
- Display extracted DICOM metadata in a new 'Patient & Scan Metadata'
  report card (light + dark theme support)
- Add DCM format badge and promote DICOM chip to Active in upload UI
- Render inline SVG scanner placeholder for .dcm previews (browsers
  cannot natively display raw DICOM binary data in <img> tags)
- Add cache-busting version params (?v=1.0.1) to style.css and script.js
- Add unit tests for DICOM processing (test_dicom.py) — 38 tests pass

Clinical motivation:
  DICOM is the universal standard format output by MRI/CT scanners.
  Supporting .dcm removes the manual PNG/JPG conversion step from
  clinical workflows and preserves the full 16-bit dynamic range of
  scan intensity values, avoiding diagnostic data loss from compression.
@ironman1947

Copy link
Copy Markdown
Author

Hi @Brijeshthummar02,

This PR is for GSSoC 2026. DICOM support enables real clinical MRI scanner integration.

Please review when you have a chance!

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.

1 participant