DICOM -> JPG/PNG/BMP
Project description
dicom2jpg
Converts DICOM to JPG/PNG/BMP/TIFF
and numpy.ndarray
import dicom2jpg
dicom_img_01 = "/Users/user/Desktop/img01.dcm"
dicom_dir = "/Users/user/Desktop/Patient_01"
export_location = "/Users/user/Desktop/BMP_files"
# convert single DICOM file to numpy.ndarray for further use
img_data = dicom2jpg.dicom2img(dicom_img_01)
# convert single DICOM file to jpg format
dicom2jpg.dicom2jpg(dicom_img_01)
# convert all DICOM files in dicom_dir folder to png format
dicom2jpg.dicom2png(dicom_dir)
# convert all DICOM files in dicom_dir folder to bmp, to a specified location
dicom2jpg.dicom2bmp(dicom_dir, target_root=export_location)
dicom2jpg
converts DICOM images to JPG/PNG/BMP/TIFF
formats and to numpy.ndarray
.
It applies window center(level) and window width adjustment, or VOI LUT function to the images, which makes output files looks like what we see on standard DICOM viewers.
dicom2jpg.dicom2jpg(origin, target_root=None)
dicom2jpg.dicom2png(origin, target_root=None)
dicom2jpg.dicom2bmp(origin, target_root=None)
dicom2jpg.dicom2tiff(origin, target_root=None)
dicom2jpg.dicom2img(origin)
-
origin can be a single DICOM file or folder contains DICOM files
-
target_root is would be the same root folder of the origin if not specified
-
exported files will be in
target_root/Today/PatientID_filetype/StudyDate_StudyTime_Modality_AccNum/Ser_Img.filetype
Image examples
CT | MR | CXR |
---|---|---|
Installation
pip install dicom2jpg
Todo
- Multiprocessing for speeding up
- Support multi-frame images
- More naming choices, including anomynous file names
- Image compression
- Support overlays
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for dicom2jpg-0.0.8-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f9147a2ab87773bf4e8a3c36903ba4ee2dd9d0f7077f3650b8bf69d257bfcc5e |
|
MD5 | 669378a477959413d443e416519ea269 |
|
BLAKE2b-256 | 2b3a4d093d1a3d253581c45acae7f05d0c78bddb804e4bdf324158b5d32bda87 |