]> Creatis software - creaImageIO.git/blobdiff - src2/creaImageIOTreeAttributeDescriptor.cpp
Order by columns is done. For the moment it only compares as if everything were a...
[creaImageIO.git] / src2 / creaImageIOTreeAttributeDescriptor.cpp
index 13616ce47fe574973d642066e3eb508a44e4129a..799cb12cc2210b357912d40d78e805234f53f1d9 100644 (file)
@@ -43,6 +43,7 @@ namespace creaImageIO
       GimmickDebugMessage(3,"AttributeDescriptor : '"<<key
                          <<"' ["<<flags<<"]"<<std::endl);
       GimmickDebugMessage(3,"='"<<mName<<"'"<<std::endl);
+         DecodeType();
     }
 
     //=====================================================================
@@ -69,11 +70,12 @@ namespace creaImageIO
       GDCM_NAME_SPACE::DictEntry* entry =
        GDCM_NAME_SPACE::Global::GetDicts()
        ->GetDefaultPubDict()->GetEntry(mGroup,mElement);
-
+         
       if (entry)
        {
          mName = entry->GetName();
          CleanName(mName);
+         DecodeType();
          GimmickDebugMessage(3,"='"<<mName<<"'"<<std::endl);
        }
       else
@@ -83,7 +85,8 @@ namespace creaImageIO
                         <<"Considering it as a user attribute"
                         << std::endl);
          mName = "UNKNOWN";
-         mGroup = mElement = 0;
+         mGroup = mElement = mType = 0;
+         DecodeType();
        }
       
     }
@@ -104,7 +107,7 @@ namespace creaImageIO
          std::string g = key.substr(1,4);
          sscanf(key.c_str(),"D %04x _ %04x ",&group,&elem);  
          sscanf(g.c_str(),"%04x",&group);
-         GimmickMessage(5,"GetDicomGroupElementFromKey '"<<g<<"' : "
+         GimmickDebugMessage(3,"GetDicomGroupElementFromKey '"<<g<<"' : "
                         <<group<<"|"<<elem<<std::endl);
        }
       else 
@@ -115,6 +118,36 @@ namespace creaImageIO
       return;
     }
     //=====================================================================
+       ///Decodes the type of attribute into the valid groups
+       void AttributeDescriptor::DecodeType()
+       {
+               // Retrieve the name from gdcm dict
+               GDCM_NAME_SPACE::DictEntry* entry =
+               GDCM_NAME_SPACE::Global::GetDicts()
+               ->GetDefaultPubDict()->GetEntry(mGroup,mElement);
+
+               std::string type = entry->GetVR().str();
+               CleanName(type);
+               GimmickDebugMessage(3,"VR Value is "<<type<<"!"<<std::endl);
+               if(type=="AS" ||
+               type=="DA" ||
+               type=="FL" ||
+               type=="FD" ||
+               type=="IS" ||
+               type=="SL" ||
+               type=="SS" ||
+               type=="UI" ||
+               type=="US" ||
+               type=="SH")
+               {
+                       mType=1;
+               }
+               else
+               {
+                       mType=2;
+               }
+
+       }
 
   } // EO namespace tree