Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages

gdcmDictSet Class Reference

#include <gdcmDictSet.h>

List of all members.

Public Member Functions

 gdcmDictSet (void)
 The Dictionnary Set obtained with this constructor simply contains the Default Public dictionnary.

 ~gdcmDictSet (void)
 Destructor.

void Print (std::ostream &os)
 Print, in an informal fashion, the list of all the dictionaries contained is this gdcmDictSet, along with their respective content.

std::list< std::string > * GetPubDictEntryNames (void)
 Consider all the entries of the public dicom dictionnary. Build all list of all the tag names of all those entries.

std::map< std::string, std::list<
std::string > > * 
GetPubDictEntryNamesByCategory (void)
 
  • Consider all the entries of the public dicom dictionnary. Build an hashtable whose keys are the names of the groups (fourth field in each line of dictionary) and whose corresponding values are lists of all the dictionnary entries among that group. Note that apparently the Dicom standard doesn't explicitely define a name (as a string) for each group. -A typical usage of this method would be to enable a dynamic configuration of a Dicom file browser: the admin/user can select in the interface which Dicom tags should be displayed.


gdcmDictLoadDictFromFile (std::string FileName, DictKey Name)
 Loads a dictionary from a specified file, and add it to already the existing ones contained in this gdcmDictSet.

gdcmDictGetDict (DictKey DictName)
 Retrieve the specified dictionary (when existing) from this gdcmDictSet.

gdcmDictGetDefaultPubDict (void)
 Retrieve the default reference DICOM V3 public dictionary.
Returns:
The retrieved default dictionary.


gdcmDictEntryNewVirtualDictEntry (guint16 group, guint16 element, std::string vr="Unknown", std::string fourth="Unknown", std::string name="Unknown")
 Create a gdcmDictEntry which will be reference in no dictionnary.


Static Public Member Functions

std::string BuildDictPath (void)
 Obtain from the GDCM_DICT_PATH environnement variable the path to directory containing the dictionnaries. When the environnement variable is absent the path is defaulted to "../Dicts/".


Protected Member Functions

bool AppendDict (gdcmDict *NewDict, DictKey Name)

Private Attributes

DictSetHT Dicts
 Hash table of all dictionaries contained in this gdcmDictSet.

std::string DictPath
 Directory path to dictionaries.

std::map< std::string, gdcmDictEntry * > virtualEntry


Constructor & Destructor Documentation

gdcmDictSet::gdcmDictSet void   ) 
 

The Dictionnary Set obtained with this constructor simply contains the Default Public dictionnary.

Definition at line 21 of file gdcmDictSet.cxx.

References BuildDictPath(), DictPath, Dicts, PUB_DICT_FILENAME, and PUB_DICT_NAME.

00022 {
00023    DictPath = BuildDictPath();
00024    std::string PubDictFile = DictPath + PUB_DICT_FILENAME;
00025    Dicts[PUB_DICT_NAME] = new gdcmDict(PubDictFile);
00026 }

gdcmDictSet::~gdcmDictSet void   ) 
 

Destructor.

Definition at line 32 of file gdcmDictSet.cxx.

References Dicts, and virtualEntry.

00033 {
00034    // Remove dictionnaries
00035    for (DictSetHT::iterator tag = Dicts.begin(); tag != Dicts.end(); ++tag) 
00036    {
00037       gdcmDict *EntryToDelete = tag->second;
00038       if ( EntryToDelete )
00039          delete EntryToDelete;
00040       tag->second=NULL;
00041    }
00042    Dicts.clear();
00043 
00044    // Remove virtual dictionnary entries
00045    std::map<std::string,gdcmDictEntry *>::iterator it;
00046    for(it=virtualEntry.begin(); it!=virtualEntry.end(); ++it)
00047    {
00048       gdcmDictEntry *Entry = it->second;
00049       if ( Entry )
00050          delete Entry;
00051       it->second=NULL;
00052    }
00053 }


Member Function Documentation

bool gdcmDictSet::AppendDict gdcmDict NewDict,
DictKey  Name
[protected]
 

Definition at line 212 of file gdcmDictSet.cxx.

References DictKey, and Dicts.

Referenced by LoadDictFromFile().

00213 {
00214    Dicts[Name] = NewDict;
00215    return(true);
00216 }

std::string gdcmDictSet::BuildDictPath void   )  [static]
 

Obtain from the GDCM_DICT_PATH environnement variable the path to directory containing the dictionnaries. When the environnement variable is absent the path is defaulted to "../Dicts/".

Returns:
path to directory containing the dictionnaries

Definition at line 192 of file gdcmDictSet.cxx.

References dbg, PUB_DICT_PATH, and gdcmDebug::Verbose().

Referenced by gdcmDicomDirElement::gdcmDicomDirElement(), gdcmDictSet(), gdcmTS::gdcmTS(), and gdcmVR::gdcmVR().

00193 {
00194    std::string ResultPath;
00195    const char *EnvPath = (char*)0;
00196    EnvPath = getenv("GDCM_DICT_PATH");
00197    if (EnvPath && (strlen(EnvPath) != 0)) 
00198    {
00199       ResultPath = EnvPath;
00200       if (ResultPath[ResultPath.length() -1] != '/' )
00201          ResultPath += '/';
00202       dbg.Verbose(1, "gdcmDictSet::BuildDictPath:",
00203                      "Dictionary path set from environnement");
00204    } 
00205    else
00206       ResultPath = PUB_DICT_PATH;
00207    return ResultPath;
00208 }

gdcmDict * gdcmDictSet::GetDefaultPubDict void   ) 
 

Retrieve the default reference DICOM V3 public dictionary.

Returns:
The retrieved default dictionary.

Definition at line 152 of file gdcmDictSet.cxx.

References GetDict(), and PUB_DICT_NAME.

Referenced by gdcmObject::GetEntryByName(), GetPubDictEntryNames(), GetPubDictEntryNamesByCategory(), and gdcmParser::Initialise().

00153 {
00154    return GetDict(PUB_DICT_NAME);
00155 }

gdcmDict * gdcmDictSet::GetDict DictKey  DictName  ) 
 

Retrieve the specified dictionary (when existing) from this gdcmDictSet.

Parameters:
DictName The symbolic name of the searched dictionary.
Returns:
The retrieved dictionary.

Definition at line 139 of file gdcmDictSet.cxx.

References DictKey, and Dicts.

Referenced by GetDefaultPubDict(), and gdcmParser::SetShaDict().

00140 {
00141    DictSetHT::iterator dict = Dicts.find(DictName);
00142    if(dict!=Dicts.end())
00143       return dict->second;
00144    return NULL;
00145 }

std::list< std::string > * gdcmDictSet::GetPubDictEntryNames void   ) 
 

Consider all the entries of the public dicom dictionnary. Build all list of all the tag names of all those entries.

See also:
gdcmDictSet::GetPubDictTagNamesByCategory
Returns:
A list of all entries of the public dicom dictionnary.

Definition at line 81 of file gdcmDictSet.cxx.

References GetDefaultPubDict(), and gdcmDict::GetDictEntryNames().

00082 {
00083    return(GetDefaultPubDict()->GetDictEntryNames());
00084 }

std::map< std::string, std::list< std::string > > * gdcmDictSet::GetPubDictEntryNamesByCategory void   ) 
 

  • Consider all the entries of the public dicom dictionnary. Build an hashtable whose keys are the names of the groups (fourth field in each line of dictionary) and whose corresponding values are lists of all the dictionnary entries among that group. Note that apparently the Dicom standard doesn't explicitely define a name (as a string) for each group. -A typical usage of this method would be to enable a dynamic configuration of a Dicom file browser: the admin/user can select in the interface which Dicom tags should be displayed.

Warning:
  • Dicom *doesn't* define any name for any 'categorie' (the dictionnary fourth field was formerly NIH defined -and no longer he is- and will be removed when Dicom provides us a text file with the 'official' Dictionnary, that would be more friendly than asking us to perform a line by line check of the dictionnary at the beginning of each year to -try to- guess the changes)
  • Therefore : please NEVER use that fourth field :-( *
Returns:
An hashtable: whose keys are the names of the groups and whose corresponding values are lists of all the dictionnary entries among that group.

Definition at line 111 of file gdcmDictSet.cxx.

References GetDefaultPubDict(), and gdcmDict::GetDictEntryNamesByCategory().

00112 {
00113    return(GetDefaultPubDict()->GetDictEntryNamesByCategory());
00114 }

gdcmDict * gdcmDictSet::LoadDictFromFile std::string  FileName,
DictKey  Name
 

Loads a dictionary from a specified file, and add it to already the existing ones contained in this gdcmDictSet.

Parameters:
FileName Absolute or relative filename containing the dictionary to load.
Name Symbolic name that be used as identifier of the newly created dictionary.

Definition at line 125 of file gdcmDictSet.cxx.

References AppendDict(), and DictKey.

00126 {
00127    gdcmDict *NewDict = new gdcmDict(FileName);
00128    AppendDict(NewDict,Name);
00129    return(NewDict);
00130 }

gdcmDictEntry * gdcmDictSet::NewVirtualDictEntry guint16  group,
guint16  element,
std::string  vr = "Unknown",
std::string  fourth = "Unknown",
std::string  name = "Unknown"
 

Create a gdcmDictEntry which will be reference in no dictionnary.

Returns:
virtual entry

Definition at line 163 of file gdcmDictSet.cxx.

References gdcmDictEntry::TranslateToKey(), and virtualEntry.

Referenced by gdcmParser::NewVirtualDictEntry().

00166 {
00167    gdcmDictEntry *entry;
00168    std::string tag=gdcmDictEntry::TranslateToKey(group,element)+"#"+vr+"#"+fourth+"#"+name;
00169    std::map<std::string,gdcmDictEntry *>::iterator it;
00170    
00171    it=virtualEntry.find(tag);
00172    if(it!=virtualEntry.end())
00173    {
00174       entry=it->second;
00175    }
00176    else
00177    {
00178       entry=new gdcmDictEntry(group,element,vr,fourth,name);
00179       virtualEntry[tag]=entry;
00180    }
00181    return(entry);
00182 }

void gdcmDictSet::Print std::ostream &  os  ) 
 

Print, in an informal fashion, the list of all the dictionaries contained is this gdcmDictSet, along with their respective content.

Parameters:
os Output stream used for printing.

Definition at line 63 of file gdcmDictSet.cxx.

References Dicts.

00064 {
00065    for (DictSetHT::iterator dict = Dicts.begin(); dict != Dicts.end(); ++dict)
00066    {
00067       os << "Printing dictionary " << dict->first << std::endl;
00068       dict->second->Print(os);
00069    }
00070 }


Member Data Documentation

std::string gdcmDictSet::DictPath [private]
 

Directory path to dictionaries.

Definition at line 59 of file gdcmDictSet.h.

Referenced by gdcmDictSet().

DictSetHT gdcmDictSet::Dicts [private]
 

Hash table of all dictionaries contained in this gdcmDictSet.

Definition at line 57 of file gdcmDictSet.h.

Referenced by AppendDict(), gdcmDictSet(), GetDict(), Print(), and ~gdcmDictSet().

std::map<std::string,gdcmDictEntry *> gdcmDictSet::virtualEntry [private]
 

Definition at line 61 of file gdcmDictSet.h.

Referenced by NewVirtualDictEntry(), and ~gdcmDictSet().


The documentation for this class was generated from the following files:
Generated on Mon Feb 14 16:13:37 2005 for gdcm by doxygen 1.3.6