Skip to content

briannaflynn/dxaconv

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

45 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

dxaconv

Convert DICOM files from DXA scans to other image formats, and parse the corresponding metadata files

Originally intended for DXA scans, but can also be used on any other DICOM formatted image as well (i.e. MRI).

Convert .dcm files to .jpg (or .png), preview images via matplotlib, and convert each file's corresponding metadata to a .txt file. Organize the output by anatomy (built in extensions compatible with dicom files from the United Kingdom National Health Service). Example dicom files used in this repo can be found here as "eg_20158_dxa.zip".

This code builds upon the pydicom library and OpenCV libraries. Please refer here and here for additional information on dependencies, the pydicom and opencv documentation.

Command line examples

Convert DICOM files to JPG format

# while in a directory that contains all dicom images, use this command to convert them to JPGs in a new directory

python dxaconv.py dicom_directory jpg_directory

If one of the files could not be converted for some reason, the following message will be displayed 'An exception occurred and a dcm file of this directory did not successfully convert:' preceding the error message.

Organize by files of a particular anatomy

# specify the path to a directory with dicom images, and the anatomy to filter by
 
python organizer.py dicom_directory spine

# it will output a text file containing all filenames for images of the spine

Anatomy arguments for organizer.py

hip1, hip2, knee1, knee2, spine, thoracic, full_body_opaque, full_body_transparent

TODO

  • Add DICOM to NIFTI conversion tool

About

Convert DICOM files from DXA scans to other image formats, and parse the corresponding metadata files

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages