Radiverse is a Python tool for loading, processing, and visualizing medical DICOM (Digital Imaging and Communications in Medicine) image data with windowing, conversion to Hounsfield units, and saving capabilities.
pip install radiverse -i https://pypi.org/simple
from radiverse.windowing import Dicom
# Single image
dcm = Dicom("ct_files/00000001.dcm")
# Folder
dcm = Dicom("ct_files")
output:
PatientName: Anonymous
PatientID: 20240527-224912
PatientSex: M
StudyID: 1706
Rows: 512
Columns: 512
SliceThickness: 1.250000
PixelSpacing: [0.703125, 0.703125]
WindowCenter: 60
WindowWidth: 350
RescaleIntercept: -1024
RescaleSlope: 1
Common (window width, window center) examples:
- Lung: (1500, -400)
- Head: (80, 40)
- Mediastinum: (400, 60)
- Bone: (1500, 300)
dcm.set_window(400, 60)
- Original image
dcm.show(9, cmap="o")
- HU image
dcm.show(9, cmap="h")
- Both original and HU images
dcm.show(9, cmap="oh")
- Save single HU image
dcm.save_hu_image(index=0, save_path="output")
- Save all HU images
dcm.save_all_hu_images(save_path="output")
Special thanks to 3097530495yi for providing reference.