]> Creatis software - creaImageIO.git/commitdiff
Dicom Dump with gdcm2
authorFrederic Cervenansky <Frederic.Cervenansky@creatis.insa-lyon.fr>
Mon, 26 Apr 2010 11:57:44 +0000 (11:57 +0000)
committerFrederic Cervenansky <Frederic.Cervenansky@creatis.insa-lyon.fr>
Mon, 26 Apr 2010 11:57:44 +0000 (11:57 +0000)
src/creaImageIODicomImageReader2.cpp
src/creaImageIODicomScanner.cpp
src/creaImageIOWxDumpPanel.cpp

index c736e16ee7d9d22ea6024e30a96586d2d0b32488..7361034b5e50c032797e7b7dbf4a9bf880eb5249 100644 (file)
@@ -131,7 +131,7 @@ namespace creaImageIO
                tree::AttributeDescriptor::GetDicomGroupElementFromKey(i->first,gr,el);
                if ( ( gr!=0 ) && ( el!=0 ) )
                  {
-                          gdcm::DataElement de( gdcm::Tag(gr,el) );
+                        
                           std::string val = GetStringValueFromTag(reader.GetFile().GetDataSet().GetDataElement(gdcm::Tag(gr,el)));
                    i->second = irclean(val);
                  }
index 43706c156436c2edbf83bf1a27b74859ec3dffaa..88fe948b33081c735ce0176717a8137090434461 100644 (file)
@@ -133,20 +133,9 @@ void DicomImageScanner::ReadAttributes(const std::string& filename,
                  gdcm::Scanner::TagToValue::const_iterator it = mapping.begin();
 
                  std::map<std::string, std::string>::iterator i;
-                 int j= 0;
-
-                 
                  
                  for (;it != mapping.end(); ++it)
-                 {
-                                       /*std::stringstream val;
-                                       val <<  "D";
-                                       val << std::hex << it->first.GetGroup() ;
-                                       val << "_";;
-                                       val << std::hex <<  it->first.GetElement();
-                                       var >> key*/
-                                char key[12] ;
-                                 
+                 {              char key[12] ;
                                  sprintf(key,"D%04x_%04x", it->first.GetGroup(), it->first.GetElement());
                                  attr[key] = irclean(it->second);
                  }
index 843db487dd5a3485e7cbe02576e1e6c765e6d5a5..05b2da963c6649d8aa6bfb3ba59d922c3b89722e 100644 (file)
@@ -8,6 +8,14 @@
 #include "gdcmDocument.h"
 #include "gdcmFileHelper.h"
 #endif
+
+#if defined(USE_GDCM2)
+#include "gdcmGlobal.h"
+#include "gdcmFile.h"
+#include "gdcmDictPrinter.h"
+#include "gdcmPrinter.h"
+#include "gdcmReader.h"
+#endif
 #include "icons/save.xpm"
 
 namespace creaImageIO
@@ -36,9 +44,12 @@ namespace creaImageIO
        void WxDumpPanel::Print()
        {
           std::stringstream os;
+          std::string result = "";
           if ( !filename.empty()) // ====== Deal with a single file ======
           {
-       /*         GDCM_NAME_SPACE::File *f = GDCM_NAME_SPACE::File::New();
+
+#if defined(USE_GDCM)
+                  GDCM_NAME_SPACE::File *f = GDCM_NAME_SPACE::File::New();
                   f->SetLoadMode(GDCM_NAME_SPACE::LD_ALL);
                   f->SetFileName( filename );
                   f->SetMaxSizeLoadEntry(0xffff);
@@ -47,22 +58,30 @@ namespace creaImageIO
                      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 +=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();*/
+                  
+
+#endif
+#if defined(USE_GDCM2)
+                 gdcm::Reader reader;
+                 reader.SetFileName( filename.c_str() );
+                 if (reader.Read())
+                 {
+                         gdcm::Printer printer;
+                         printer.SetFile ( reader.GetFile() );
+                         printer.SetColor( 0 );
+                         printer.Print( os );
+                         result = os.str();
+                 }
+#endif
+                 DumpText->SetValue(crea::std2wx(result));                
+
                }
        }