]> Creatis software - gdcm.git/blobdiff - Example/PrintFile.cxx
ENH: Adding 'gdcm' namespace. Be nice with me this was a ~13000 lines patch. Also...
[gdcm.git] / Example / PrintFile.cxx
index 810712a490e634a21f211b7663062f0fa0dff0cf..48bc00a031d62b0068615334ddef4d6b1a956042 100644 (file)
@@ -1,27 +1,11 @@
 #include <iostream>
+#include "gdcm.h"
 
-#include "gdcmException.h"
-#include "gdcmCommon.h"
-
-#include "gdcmDictEntry.h"
-#include "gdcmDict.h"
-#include "gdcmDictSet.h"
-#include "gdcmHeader.h"
-#include "gdcmUtil.h"
-#include "gdcmBinEntry.h"  
-#include "gdcmDocEntry.h" 
-#include "gdcmDocEntrySet.h"           
-#include "gdcmDocument.h"          
-#include "gdcmElementSet.h"        
-#include "gdcmSeqEntry.h" 
-#include "gdcmSQItem.h" 
-#include "gdcmValEntry.h" 
-#include "gdcmFile.h" 
 int main(int argc, char* argv[])
 {
  
-   gdcmHeader *e1;
-   gdcmFile   *f1;
+   gdcm::Header *e1;
+   gdcm::File   *f1;
    std::string fileName;   
    if (argc != 2) {
       std::cout << " usage : PrintDocument fileName" << std::endl;
@@ -34,10 +18,9 @@ int main(int argc, char* argv[])
       fileName += "/test.acr";
    }
    
-   e1= new gdcmHeader 
-          (fileName.c_str(),false, true);
+   e1= new gdcm::Header( fileName.c_str() );
 
-   f1 = new gdcmFile(e1);
+   f1 = new gdcm::File(e1);
 
    e1->SetPrintLevel(2);
    
@@ -69,6 +52,14 @@ int main(int argc, char* argv[])
    int numberOfScalarComponents=e1->GetNumberOfScalarComponents();
    std::cout << " NumberOfScalarComponents " << numberOfScalarComponents <<std::endl;
 
+  
+  if ( e1->GetEntryByNumber(0x0002,0x0010) == GDCM_NOTLOADED ) {
+     std::cout << "Transfert Syntax not loaded. " << std::endl
+               << "Better you increase MAX_SIZE_LOAD_ELEMENT_VALUE"
+               << std::endl;
+      return 0;
+  }
+  
    std::string transferSyntaxName = e1->GetTransfertSyntaxName();
    std::cout << " TransferSyntaxName= [" << transferSyntaxName << "]" << std::endl;
    
@@ -80,7 +71,7 @@ int main(int argc, char* argv[])
   {
       std::cout << std::endl << "==========================================="
                   << std::endl; 
-         f1->ParsePixelData();  // gdcmFile Method :-(
+         f1->ParsePixelData();
       std::cout << std::endl << "==========================================="
                   << std::endl; 
    }