]> Creatis software - creaImageIO.git/blobdiff - src2/creaImageIOWxDumpPanel.cpp
Set GDCM2 library as available DICOM Reader
[creaImageIO.git] / src2 / creaImageIOWxDumpPanel.cpp
index 1d1a3765c037dca77de9dfdc6f813b7065cc3f62..843db487dd5a3485e7cbe02576e1e6c765e6d5a5 100644 (file)
@@ -1,11 +1,13 @@
 #include <creaImageIOWxDumpPanel.h>
 #include <creaImageIOSystem.h>
 #include <creaImageIOGimmick.h>
+#if defined(USE_GDCM)
 #include <gdcmGlobal.h>
 #include <gdcmDictSet.h>
 #include "gdcmFile.h"
 #include "gdcmDocument.h"
 #include "gdcmFileHelper.h"
+#endif
 #include "icons/save.xpm"
 
 namespace creaImageIO
@@ -36,25 +38,64 @@ namespace creaImageIO
           std::stringstream os;
           if ( !filename.empty()) // ====== Deal with a single file ======
           {
-                  GDCM_NAME_SPACE::File *f = GDCM_NAME_SPACE::File::New();
+       /*         GDCM_NAME_SPACE::File *f = GDCM_NAME_SPACE::File::New();
                   f->SetLoadMode(GDCM_NAME_SPACE::LD_ALL);
                   f->SetFileName( filename );
                   f->SetMaxSizeLoadEntry(0xffff);
                   f->Load();
                   GDCM_NAME_SPACE::FileHelper *fh = GDCM_NAME_SPACE::FileHelper::New(f);
+                     f->SetLoadMode(GDCM_NAME_SPACE::LD_NOSEQ |GDCM_NAME_SPACE::LD_NOSHADOW); 
                   fh->SetPrintLevel( 0 );
                   fh->Print(os);
                   std::string result;
                   std::string line;
                   while(std::getline(os, line))
                   {
-                         result +=line;
+                         result +=clean(line.c_str());
                          result += "\n";
                   }
                   DumpText->SetValue(crea::std2wx(result));
+               
+                  std::string pixelType =f->GetPixelType();
+                       int nX,nY,nZ,nT,sPP,planarConfig;
+    
+      nX=f->GetXSize();
+      nY=f->GetYSize();
+      nZ=f->GetZSize();
+      nT=f->GetTSize();*/
                }
        }
 
+
+       const std::string WxDumpPanel::clean(const std::string &i_line)
+       {
+               
+                 if (i_line.substr(4,1) == "|")
+                          {
+                                  std::string tag;
+                                  std::string line;
+                                  std:string signification;
+                                  std::string value;
+                                  std::string resultat;
+
+                                  tag = "(" + i_line.substr(0,9) + ")";
+                                  line = i_line.substr(14,i_line.size()-10);
+                                  int pos1 = line.find_first_of("[");
+                                  int pos2 = line.find_first_of("]");
+                                  signification = line.substr(pos1+1, pos2-pos1-1);
+                                  line = line.substr(pos2+1);
+                                   pos1 = line.find_first_of("[");
+                                   pos2 = line.find_first_of("]");
+                                  value = line.substr(pos1+1, pos2-pos1-1);
+                                  resultat = tag + " " + signification + ": " +value;
+                                 return resultat;
+                          }
+                  else
+                  {
+                          return i_line;
+                  }
+       }
+
 ///////////////////////////////////////////////////    
 /// wxEvent to save Dicom Tags in a text file   //
 ///////////////////////////////////////////////////