Skip to content

feat: Add radiology and medical-imaging classes - #4

Merged
evangress merged 1 commit into
mainfrom
feat/radiology-classes
Nov 6, 2026
Merged

evangress merged 1 commit into
mainfrom
feat/radiology-classes

Conversation

@evangress

Copy link
Copy Markdown
Collaborator

Summary

Adds a set of classes for medical radiology students. They follow the project's conventions: keyword-only arguments, docstrings that state units, and comments that explain the why.

Class Covers
Radiation Inverse square law, attenuation (half-/tenth-value layers, shielding thickness), photon wavelength, radioactive and effective half-life, equivalent/effective dose (ICRP 103 weighting factors)
Radiography mAs, 15% kVp rule, mAs correction for a new SID, grid conversion, heat units, magnification, geometric unsharpness, detector Nyquist limit, deviation index
CT Hounsfield units, DICOM rescale, window width/level with presets (vectorized over a whole slice), rough HU tissue lookup, DLP and effective-dose estimate
MRI Larmor frequency, T1 recovery, T2 decay, spin-echo signal, T1/T2/PD weighting from TR/TE
Ultrasound Wavelength, echo depth, impedance and reflection, attenuation, axial resolution, PRF depth limit, Doppler shift and velocity
Dicom pydicom read, technical header summary (no patient fields), pixels in HU, pixel spacing, basic de-identification, PNG export

Also included:

  • radiology_demo.py: one worked example per modality, plus a sample CT slice shown in abdomen, lung, and bone windows.
  • pydicom dependency: its bundled anonymous sample images are used by the demo and tests.
  • gui.py: the console starts with an instance of each new class.
  • README: a radiology section, a table of medical-imaging packages (SimpleITK, nibabel, scikit-image, highdicom, pynetdicom, MONAI, TotalSegmentator, pyradiomics), and learning resources.

For reviewers

  • Some reference values differ between textbooks: the heat-unit factor for high-frequency generators, CT window presets, MRI T1/T2 times at 1.5 T, and DLP-to-effective-dose coefficients. Comments note the sources and spread. Please have an instructor or medical physicist look these over.
  • The README and docstrings mark these as teaching calculations only. Dicom.anonymize removes common identifiers, which is not full de-identification under DICOM PS3.15 or HIPAA.

Test plan

  • uv run pytest: 109 passed (48 new in tests/test_radiology.py, checked against textbook answers)
  • uv run radiology_demo.py runs and writes radiology.png

🤖 Generated with Claude Code

Add Radiation, Radiography, CT, MRI, Ultrasound, and Dicom classes for
radiology students, a radiology_demo.py tour, pydicom dependency, tests,
and README docs including a medical-imaging package table.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@evangress
evangress merged commit 3f718ff into main Nov 6, 2026
1 check passed
@evangress
evangress deleted the feat/radiology-classes branch November 6, 2026 16:46
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