]> Creatis software - creaImageIO.git/blobdiff - src2/creaImageIOWxDescriptorPanel.cpp
move directory
[creaImageIO.git] / src2 / creaImageIOWxDescriptorPanel.cpp
index 266eabe55dd6e2acea6e375620d590e54d7cdf11..d50de1fecfaae7803d68b00bec5fd8540b633312 100644 (file)
@@ -1,7 +1,16 @@
 #include "creaImageIOWxDescriptorPanel.h"
 #include <creaImageIOSystem.h>
+#if defined(USE_GDCM)
 #include <gdcmGlobal.h>
 #include <gdcmDictSet.h>
+#endif
+
+#if defined(USE_GDCM2)
+#include <gdcmGlobal.h>
+#include <gdcmDicts.h>
+#include <gdcmDict.h>
+#endif
+#include <boost/algorithm/string.hpp>
 
 namespace creaImageIO
 {
@@ -145,7 +154,7 @@ namespace creaImageIO
                        else
                        {
                                ResultCtrl->SetInsertionPoint(InsertPt);
-                                for (int i = 1; i<=lv;i++)
+                for (int i = 1; i<=lv;i++)
                                { 
                                   ResultCtrl->WriteText(_T("   "));
                                }
@@ -240,7 +249,7 @@ namespace creaImageIO
                  val.clear();
                  val <<   std::dec << el ;
                  val >> std::hex >> element;
-                       
+#if defined(USE_GDCM)  
                 // Retrieve the name from gdcm dict
                  GDCM_NAME_SPACE::DictEntry* entry = GDCM_NAME_SPACE::Global::GetDicts()->GetDefaultPubDict()->GetEntry(group, element);
                 // AttributeCombo->Clear();
@@ -254,6 +263,7 @@ namespace creaImageIO
                          AttributeCombo->Delete(0);
                          AttributeCombo->Insert(_T("Unknown Attribute"),0);
                  }
+#endif
                          AttributeCombo->SetSelection(0);
                
          }
@@ -643,7 +653,7 @@ namespace creaImageIO
                   std::map<int, std::string >::iterator it_lv_nb = lvlist.begin();
                   std::map<int, std::string >::iterator it_lv = lvlist.begin();
                   it_lv_nb++;
-                  for (;it_lv != lvlist.end(); it_lv++, it_lv_nb++)
+                  for (;it_lv != lvlist.end(); it_lv++)
               {
                           outDscp +="<level>";
                       outDscp += "\n";
@@ -655,6 +665,7 @@ namespace creaImageIO
                                   outDscp += it_lv_nb->second.c_str();
                                   outDscp += "s";
                                   outDscp += "\n";
+                                  it_lv_nb++;
                           }
                           std::vector<std::string>::iterator it_branch = DscpTree[it_lv->second.c_str()].begin();      
                      for(;it_branch != DscpTree[it_lv->second.c_str()].end(); it_branch++)
@@ -693,9 +704,16 @@ namespace creaImageIO
    {
           std::ifstream i_file(i_name.c_str());
           std::stringstream buffer;
-               buffer << i_file.rdbuf();
-               std::string line;
-               std::string level;
+          buffer << i_file.rdbuf();
+          std::string line;
+          std::string level;
+
+#if defined(USE_GDCM2)
+          const gdcm::Global& g = gdcm::Global::GetInstance(); // sum of all knowledge !
+          const gdcm::Dicts &dicts = g.GetDicts();
+          const gdcm::Dict &dict = dicts.GetPublicDict(); // Part 6
+#endif
+         
 
                bool bname;
                int ilevel = -1;
@@ -755,11 +773,27 @@ namespace creaImageIO
                                        compose +=  descriptors[1];
                                        compose += "_";
                                        compose +=  descriptors[2];
+#if defined(USE_GDCM)
                                        GDCM_NAME_SPACE::DictEntry* entry = GDCM_NAME_SPACE::Global::GetDicts()->GetDefaultPubDict()->GetEntry(group, element);
                                        if(ilevel>0)
                                        {
                                                onAddAttribute( entry->GetName(),compose, level);
                                        }
+#endif
+
+#if defined(USE_GDCM2)
+                                       gdcm::DictEntry dictentry =  dict.GetDictEntry(gdcm::Tag(group, element));
+                                       if(ilevel>0)
+                                       {
+                                               onAddAttribute( dictentry.GetName(),compose, level);
+                                       }
+       
+
+#endif
+                               }
+                               else if(descriptors[0].find("#") != -1)
+                               {
+                                       // commented line continue to next line
                                }
                                else // "O" means if user's own tag.
                                {