1 download the code
两种方式:
github上直接download保存到本地或者直接通过命令clone
git clone https://github.com/dicompyler/dicompyler-core.git
2 install from the source
cd dicompyler-core
python setup.py install
3 result
..........
Using /usr/local/lib/python3.6/site-packages
Finished processing dependencies for dicompyler-core==0.5.3
4 run
oo@oo ~X10:~$ python
Python 2.7.6 (default, Oct 26 2016, 20:30:19)
[GCC 4.8.4] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import dicompylercore
5 使用说明
https://dicompyler-core.readthedocs.io/en/latest/usage.html
from dicompylercore import dicomparser, dvh, dvhcalc dp = dicomparser.DicomParser("rtss.dcm") # i.e. Get a dict of structure information structures = dp.GetStructures() >>> structures[5] {'color': array([255, 128, 0]), 'type': 'ORGAN', 'id': 5, 'empty': False, 'name': 'Heart'} # Access DVH data rtdose = dicomparser.DicomParser("rtdose.dcm") heartdvh = dvh.DVH.from_dicom_dvh(rtdose.ds, 5) >>> heartdvh.describe() Structure: Heart DVH Type: cumulative, abs dose: Gy, abs volume: cm3 Volume: 437.46 cm3 Max Dose: 3.10 Gy Min Dose: 0.02 Gy Mean Dose: 0.64 Gy D100: 0.00 Gy D98: 0.03 Gy D95: 0.03 Gy D2cc: 2.93 Gy # Calculate a DVH from DICOM RT data calcdvh = dvhcalc.get_dvh("rtss.dcm", "rtdose.dcm", 5) >>> calcdvh.max, calcdvh.min, calcdvh.D2cc (3.0899999999999999, 0.029999999999999999, dvh.DVHValue(2.96, 'Gy'))