]> Creatis software - creaImageIO.git/blob - src/creaImageIOTreeLevelDescriptor.cpp
531b7151ef97228bcb20b45a77dacd4f934a31a1
[creaImageIO.git] / src / creaImageIOTreeLevelDescriptor.cpp
1 #include <creaImageIOTreeLevelDescriptor.h>
2 #include <creaImageIOSystem.h>
3
4
5 namespace creaImageIO
6 {
7   namespace tree
8   {
9     /// Adds the AttributeDescriptor to the list
10     void LevelDescriptor::Add(const AttributeDescriptor& a)
11     {
12       GimmickMessage(5,"Adding Attribute Descriptor '"<<a.GetKey()
13                      <<"' to LevelDescriptor"
14                      <<std::endl);
15       mAttributeDescriptorList.push_back(a);
16       if ( a.GetFlags() & AttributeDescriptor::IDENTIFIER )
17         {
18           GimmickMessage(6,"Is an IDENTIFIER"<<std::endl);
19           mIdentifierList.push_back(a.GetKey());
20         }
21       if ( a.GetFlags() & AttributeDescriptor::LABEL )
22         {
23           GimmickMessage(6,"Is a LABEL"<<std::endl);
24           mLabelList.push_back(a.GetKey());
25         }
26     }
27
28         // Copy the descriptor List without ID and PATIENT_ID attributes
29         void LevelDescriptor::CopyAttributeDescriptorList() 
30       { 
31                   mAttributeDescriptorListWID = mAttributeDescriptorList; 
32                   for(AttributeDescriptorListType::iterator it = mAttributeDescriptorListWID.begin();
33                           it != mAttributeDescriptorListWID.end(); it++)
34                   {
35                           if((*it).GetKey() == "ID")
36                           {
37                                         mAttributeDescriptorListWID.erase(it);
38                                         break;
39                           }
40                   }
41
42                   for(AttributeDescriptorListType::iterator it = mAttributeDescriptorListWID.begin();
43                           it != mAttributeDescriptorListWID.end(); it++)
44                   {
45                           if((*it).GetKey() == "PARENT_ID")
46                           {
47                                         mAttributeDescriptorListWID.erase(it);
48                                         break;
49                           }
50                   }
51          }
52
53   }
54 }
55