|
GettingStarted
Introductionpydicom is a pure python package for parsing DICOM files (generally medical image files but also non-image files such as radiotherapy information). It is not meant as an image viewer (there are many of those) but is targeted to getting the DICOM data elements as python variables and altering them if desired, and being able to do so in your own code. pydicom has a license based on the MIT license. InstallingTo use pydicom 0.9.7, python 2.4 through 2.7 is required -- work is being done to move towards python 3.0, but it will appear in the pydicom 1.0 release. Note: in addition to the instructions below, pydicom can also be installed through the Python(x,y) distribution, which can install python and a number of packages (including pydicom) at once. Other packages you might be interested in include IPython (an indispensable interactive shell with auto-completion, history etc), Numpy (optionally used by pydicom for pixel data), and ITK/VTK or PIL (image processing and visualization). Installing using Windows binary release:
Installing using easy_install (all platforms):
easy_install pydicom
Installing from source (all platforms):
Installing on Mac
Using pydicomOnce installed, the package can be imported at a python command line or used in your own python program with import dicom (note the package name is dicom, not pydicom when used in code. See the examples directory for both kinds of uses. Also see the PydicomUserGuide for more details of how to use the package. DocumentationDocumentation for pydicom can be found at:
>>> import dicom
>>> ds = dicom.read_file("CT_small.dcm")
>>> help(ds)
Help on Dataset in module dicom.dataset object:
class Dataset(__builtin__.dict)
| A Dataset is a collection (dictionary) of Dicom DataElement instances.
|
| Example of two ways to retrieve or set values:
| (1) dataset[0x10, 0x10].value --> patient's name
| (2) dataset.PatientName --> patient's name
|
...SupportPlease join the pydicom discussion group to ask questions, give feedback, post example code for others -- in other words for any discussion about the pydicom code. New versions, major bug fixes, etc. will also be announced through the group. Next StepTo start learning how to use pydicom, see the PydicomUserGuide. |
Easy to install, easy to use !!
Most of other python packages for DICOM file reading are merely wrappers of C++ code, you should first install. But this one allows you in 30 min read a DICOM file from scratch.
A medical physicist's dream come true. Kudos to Darcy Mason!!!
This looks extremely useful. install went without problems on Ubuntu Hardy
Seems like this is exactly what I was looking for - just as proportional said.
Thank you very much!
I've added a portfile (py25-pydicom) for MacPorts? users: http://trac.macports.org/changeset/45855/trunk/dports
Very impressed. At last I can consider giving up Matlab, The DICOM utilities where one of the few (possibly the only) advantages it had over Python.
any news on compatibility for python 3.0?
> Comment by tak.rliu, > any news on compatibility for python 3.0?
I'd like to start looking at this at some point after the next release. It's on the issues list (#13). Any comments/advice/contributions are welcome to be added to that issue.
http://trac.macports.org/browser/trunk/dports/python/py27-pydicom and http://trac.macports.org/browser/trunk/dports/python/py26-pydicom have been updated to 0.9.5.
Hi, does anybody knows if I can convert video (AVI, MPEG2 or similar) to DICOM files with this library??