background preloader

Image processing

Facebook Twitter

Region-of-interest drawing tool for image analysis (in python) PydicomUserGuide - pydicom - pydicom guide -- object model, description of classes, examples - Read, modify and write DICOM files with python code. Dataset is the base object in pydicom's object model. The relationship between Dataset and other objects is: Dataset (derived from python's dict) ---> contains DataElement instances --> the value of the data element can be one of: a regular value like a number, string, etc. a list of regular values (e.g. a 3-D coordinate) a Sequence instance --> a Sequence is a list of Datasets (and so we come full circle) Dataset is the main object you will work with directly. A dataset could be created directly, but you will usually get one by reading an existing DICOM file: >>> import dicom>>> ds = dicom.read_file("rtplan.dcm") # (rtplan.dcm is in the testfiles directory) You can display the entire dataset by simply printing its string (str or repr) value: You can also view DICOM files in a collapsible tree using the example program

A brief aside: pydicom no longer includes the file meta information (group 2) in the main dataset (they are in fact two separate datasets in the DICOM standard). Wiki Pages - pydicom - Read, modify and write DICOM files with python code. Python Imaging Library Handbook.