TPCCLIB
Loading...
Searching...
No Matches
dcmdictionary.c File Reference

DICOM dictionary for TPCCLIB. More...

#include "tpcclibConfig.h"
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <time.h>
#include <string.h>
#include "tpcextensions.h"
#include "tpcdcm.h"

Go to the source code of this file.

Functions

unsigned int dcmDictSize ()
 
int dcmDictIndexTag (unsigned int i, unsigned short int *group, unsigned short int *element)
 
char * dcmDictIndexVR (unsigned int i)
 
char * dcmDictIndexDescr (unsigned int i)
 
char * dcmDictIndexType (unsigned int i)
 
unsigned int dcmDictFindTag (DCMTAG *tag)
 

Detailed Description

DICOM dictionary for TPCCLIB.

Definition in file dcmdictionary.c.

Function Documentation

◆ dcmDictFindTag()

unsigned int dcmDictFindTag ( DCMTAG * tag)

Get the dictionary index for given tag.

Returns
If tag is found, returns its dictionary index; otherwise returns the length of the dictionary.
See also
dcmDictSize, dcmDictIndexTag, dcmDictIndexVR, dcmDictIndexType, dcmDictIndexDescr
Parameters
tagPointer to DICOM tag.

Definition at line 2820 of file dcmdictionary.c.

2823 {
2824 unsigned int i, n=dcmDictSize();
2825 if(tag==NULL) return(n);
2826 for(i=0; i<n; i++)
2827 if(tag->group==dcmdict[i].group && tag->element==dcmdict[i].element) break;
2828 return(i);
2829}
unsigned int dcmDictSize()
unsigned short int element
Definition tpcdcm.h:44
unsigned short int group
Definition tpcdcm.h:42

Referenced by dcmFileReadNextElement().

◆ dcmDictIndexDescr()

char * dcmDictIndexDescr ( unsigned int i)

Get the DICOM tag description, based on given dictionary index.

Returns
Returns pointer to description string, which is 'Unknown' if index equals dictionary length, or NULL in case of an error.
See also
dcmDictSize, dcmDictIndexTag, dcmDictFindTag
Parameters
iDictionary index [0..n-1].

Definition at line 2780 of file dcmdictionary.c.

2783 {
2784 if(i>dcmDictSize()) return(char*)NULL;
2785 else return(dcmdict[i].descr);
2786}

Referenced by dcmFileReadNextElement().

◆ dcmDictIndexTag()

int dcmDictIndexTag ( unsigned int i,
unsigned short int * group,
unsigned short int * element )

Get the DICOM tag group and element, based on given dictionary index.

Returns
Returns 0 when successful, 1 if invalid index.
See also
dcmDictSize, dcmDictIndexVR, dcmDictIndexType, dcmDictIndexDescr, dcmDictFindTag
Parameters
iDictionary index [0..n-1].
groupPointer to tag group; enter NULL if not needed.
elementPointer to tag element; enter NULL if not needed.

Definition at line 2744 of file dcmdictionary.c.

2751 {
2752 if(group!=NULL) *group=0;
2753 if(element!=NULL) *element=0;
2754 if(i>=dcmDictSize()) return(1);
2755 if(group!=NULL) *group=dcmdict[i].group;
2756 if(element!=NULL) *element=dcmdict[i].element;
2757 return(0);
2758}

◆ dcmDictIndexType()

char * dcmDictIndexType ( unsigned int i)

Get the DICOM Tag Type, based on given dictionary index.

Tag Type is a NULL terminated string.

  • 1: mandatory.
  • 1C: mandatory only under certain conditions.
  • 2: required to exist, but can have a null value.
  • 2C: required to exist only under certain conditions.
  • 3: optional.

Reference: DICOM PS3.3

Returns
Returns pointer to the tag type string, or NULL in case of an error.
See also
dcmDictSize, dcmDictIndexTag, dcmDictFindTag
Parameters
iDictionary index [0..n-1].

Definition at line 2804 of file dcmdictionary.c.

2807 {
2808 if(i>=dcmDictSize()) return(char*)NULL;
2809 else return(dcmdict[i].type);
2810}

◆ dcmDictIndexVR()

char * dcmDictIndexVR ( unsigned int i)

Get the DICOM tag VR string, based on given dictionary index.

Returns
Returns pointer to VR string, or NULL in case of an error.
See also
dcmDictSize, dcmDictIndexTag, dcmDictFindTag

Definition at line 2766 of file dcmdictionary.c.

2768 {
2769 if(i>=dcmDictSize()) return(char*)NULL;
2770 else return(dcmdict[i].vr);
2771}

Referenced by dcmFileReadNextElement().

◆ dcmDictSize()

unsigned int dcmDictSize ( )

Get the size of DICOM dictionary.

Returns
Returns the size of the dictionary.

Definition at line 2730 of file dcmdictionary.c.

2731{
2732 unsigned int n=1;
2733 while(dcmdict[n].group<0xFFFF && dcmdict[n].element<0xFFFF) n++;
2734 return(n);
2735}

Referenced by dcmDictFindTag(), dcmDictIndexDescr(), dcmDictIndexTag(), dcmDictIndexType(), and dcmDictIndexVR().