|
DICOMSDL
0.79.20110728
DICOMSoftwareDevelopmentLibrary
|
If you are not familiar with DICOM, read this before you go on. There are several good webpages that introduce on DICOM.
((( TBD )))
This short example loads a DICOM formatted file and extract some informations and image.
Let's see what above codes do line by line.
A dicom::dicomfile is an implementation of DICOM file object.
dicom::open_dicomfile() reads, parses the file and returns a DICOM file object.
Note) Returned DICOM file object need to be deleted by user.
A DICOM file consists of several items contain informations about the DICOM file. Each item in a DICOM file called 'data element' and you get a data element using get_dataelement. Item's value can be retrieved with functions like to_string, to_int, to_double_values, according to the data type of item. You may shorten code in second form.
DICOM file object provide functions to extract image in the DICOM file. get_image_info takes informations related to image's geometry, and get_pixeldata_a extract image.
Note) The suffix '_a' in the function name get_pixeldata_a means that function return a pointer that should be free() by user, provided that the pointer is valid.
If an error is occured during reading/parsing a DICOM file, dicom::open_dicomfile() return NULL and you may get the error message using dicom::get_error_message(). After calling several functions that return NULL on error, dicom::get_error_message() provide informations about the error.
This is a python program does exact same thing.
1.8.6