]> Creatis software - creaImageIO.git/blob - src2/creaImageIOTreeAttributeDescriptor.cpp
Starting version 2
[creaImageIO.git] / src2 / creaImageIOTreeAttributeDescriptor.cpp
1 #include <creaImageIOTreeAttributeDescriptor.h>
2
3 #include <gdcmGlobal.h>
4 #include <gdcmDictSet.h>
5
6 namespace creaImageIO
7 {
8
9   namespace tree
10   {
11
12
13     // Ctor with name and flags
14     // If the name is of the form "1056|8948" (a pipe at 5th position)
15     // it is interpreted as a Dicom Tag 
16     // The user name is retreived from dicom dictionnary
17     // and the group and elem are filled
18     AttributeDescriptor::AttributeDescriptor(const std::string& key,
19                                              unsigned int flags)
20       : mKey(key), mGroup(0), mElement(0), mFlags(flags)
21     {
22       // Is the key a Dicom tag ?
23       if ((key.size()==9)&&(key[4]=='|'))
24         {
25           // Decode group & elem
26           sscanf(key.c_str(),"%04x|%04x",&mGroup,&mElement);
27           // Retrieve the name from gdcm dict
28           GDCM_NAME_SPACE::DictEntry* entry =
29             GDCM_NAME_SPACE::Global::GetDicts()
30             ->GetDefaultPubDict()->GetEntry(mGroup,mElement);
31           mName = entry->GetName();
32         }
33       else
34         {
35           mName = mKey;
36         }
37     }
38
39
40
41   } // EO namespace tree
42
43 } // EO namespace creaImageIO