Dicom ECG Converter and Viewer. Convert to PDF, PNG, JPG, SVG, ...
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.

README.md

ECG Dicom Convert

Dicom ECG Conversion

A python module and relative tool to convert Dicom ECG (waveform) files to PDF, PNG, SVG, etc. The DICOM file can also be specified as studyUID seriesUID objectUID and retrieved from your WADO server.

THE PROGRAM IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT WITHOUT ANY WARRANTY OF ANY KIND.

Try it online first!

You can use the demo site to quickly test the results before installing the software. You can convert your own DICOM files, or use preloaded sample files from different modality models.

Usage of convert.py tool

python convert.py <inputfile> [--layout=LAYOUT] [--output=FILE|--format=FMT] --minor-grid
python convert.py <stu> <ser> <obj> [--layout=LAYOUT] [--output=FILE|--format=FMT] --minor-grid
python convert.py --help

For example the file anonymous_ecg_3x4_1.png is generated by:

python convert.py sample_files/anonymous_ecg.dcm -o sample_files/anonymous_ecg_4x3_1.pdf

The input can be a file or the triplet studyUID, seriesUID, objectUID. In the latter case dicom file is downloaded via WADO.

The ouput format is deduced from the extension of the FILE, if --output is given. If the output file is not given --format must be defined. Supported output formats are: eps, jpeg, jpg, pdf, pgf, png, ps, raw, rgba, svg, svgz, tif, tiff.

By default the 5mm grid is drawn, --minor-grid add the minor grid (1mm).

The signals are filtered using a lowpass (40 Hz) butterworth filter of order 2.

LAYOUT can be one of: 3x4_1 (that is 3 rows for 4 columns plus 1 row), 3x4, 6x2, 12x1 (default: 3x4_1). New layouts can be defined adding the corresponding matrix in LAYOUT dictionary in config.py.

Install

You first have to install some system library and a fortran compiler. On a Debian machine:

sudo apt-get install libpng12-dev
sudo apt-get install libblas-dev
sudo apt-get install liblapack-dev 
sudo apt-get install gfortran

Global installation

sudo pip install -r requirements.txt
git clone git@github.com:marcodebe/dicomecg_convert.git
cd dicomecg_convert
sudo python setup.py install

Inside a virtualenv

git clone git@github.com:marcodebe/dicomecg_convert.git
cd dicomecg_convert
virtualenv .
. bin/activate
pip install -r requirements.txt
python setup.py install

Documentation

To generate documentation use epydoc packages:

cd path/to/dicomecg_convert
epydoc --html -o docs ecg.py

Read epydoc manual for other output formats and options:

epydoc -h

To install the epydoc package on:

sudo pip install epydoc

or download the installation package from Epydoc and follow the instructions.

References