The DICOM library

 

This library provide functions to read/write DICOM tags.

 

We will only cover a few of the supported functions, since only these should be useful to you. 

 

Due to the recursive nature of DICOM structures, you need a "reference" structure.  The "root" structure must always be "reset" before you start digging in the DICOM tags.

 

DICOM_Root local_root ;

DICOM_Attribute_Sequence_Reset( hwnd, &local_root ) ;

 

 

Function to fetch tag from a list of tags

DICOM_Attribute_Get()

 

 

Functions to read the value stored in DICOM tags structures (DICOM_List *)

NEMA_Value_Date() for dates (VR=DA and DT)

NEMA_Value_Time() for times (VR=TM and DT)

NEMA_Value_Name() for names (VR=PN)

NEMA_Value_Str() for character strings (VR=AE, CS, LO, SH, UI, AS, LT, ST, UT, OB and UN)

NEMA_Value_Hex() for hexadecimal values (VR=OB, OW, OX and UN)

NEMA_Value_Int() for integer values (VR=DS, IS, SS, SL, US, UH, AT, UL and OW)

NEMA_Value_Float() for floating point values (VR=IS, DS, FL and FD)

 

 

Date & Time manipulation functions

Get_Tomo_Date

Get_Tomo_Time

Time_2_DICOM

Time_2_Str

 

Name manipulation functions

Name_2_DICOM

Name_2_Str

 

 

The associated structures

 

typedef struct DICOM_List {

          unsigned char          mode ;          // transfer mode (Little/Big Endian, Explicit/Implicit VR)

          unsigned char          level ;          // recursion level of this tag

          unsigned char          append ;          // flag used to append at the end of the item list

          unsigned short          flag ;          // DICOM/Tomovision/forced/default

          unsigned short          group ;

          unsigned short          element ;

          unsigned short          explicit_vr ;          // from the DICOM tags

          unsigned short          implicit_vr ;          // from data or from NEMA definition

          unsigned short          type ;          // 1, 1C, 2, 2C or 3

          unsigned int          vm ;          // value multiplicity

          unsigned int          offset_def ;          // pos of this tag in the attribute tables

          unsigned int          offset_tag ;          // pos of this tag in the file

          unsigned int          offset_data ;          // pos of this tag's data in the file

          int          size ;          // size of the "data" in bytes

          char          *data ;          // data in LITTLE endian syntax

          char          *description ;          // if db not present

          TAG_db_Elems          *db ;          // point. to the tag def. from DICOM data dict.

          int          nb_item ;

          struct DICOM_List **item ;          // for sequence of items, each item is a link list.

          struct DICOM_List *next ;          // link list

          struct DICOM_List *tail ;          // pointer to the last element of the list

} DICOM_List ;

 

 

typedef struct TomoVision_Date {

          unsigned char          flag ;          // 1 if defined, 2 if str & template

          unsigned short          year ;          // 1980 to 2000+

          unsigned char          month ;          // 1-12

          unsigned char          day ;          // 1-31

          char          *date_str ;

          char          *date_template ;

} TomoVision_Date ;

 

typedef struct TomoVision_Time {

          unsigned char          flag ;          // 1 if defined, 2 if str & template

          unsigned char          hrs ;          // 0-23

          unsigned char          min ;          // 0-59

          float          sec ;          // 0.0-59.999

          char          *time_str ;

          char          *time_template ;

} TomoVision_Time ;

 

// family name, given name, middle name, name prefix, name suffix.

typedef struct TomoVision_Name {

          unsigned char          flag ;          // 1 if defined

          char          *family ;          // family name complex

          char          *given ;          // given name complex

          char          *middle ;          // middle name

          char          *prefix ;          // name prefix

          char          *suffix ;          // name suffix

} TomoVision_Name ;