]> Creatis software - gdcm.git/blobdiff - Example/WriteRead.cxx
ENH: Afterall change my mind we need a common place: gdcmJpeg to define the reading...
[gdcm.git] / Example / WriteRead.cxx
index b45de305b58564658a226efbb34013bd163d0d91..54f9140a21da5c07ef7b2c0d9812cf242e4ad9fc 100644 (file)
@@ -1,17 +1,14 @@
 #include <iostream>
-#include "gdcm.h"
-#include "gdcmHeader.h"
-#include "gdcmDocument.h"
-
 #include <stdio.h>
+#include "gdcm.h"
 
 int main(int argc, char* argv[])
 {  
    std::string toto;
    char zozo[200];
 
-   gdcmHeader* e1, *e2;
-   gdcmFile  * f1, *f2;
+   gdcm::Header* e1, *e2;
+   gdcm::File  * f1, *f2;
 
    void* imageData, *imageData2;
    int dataSize, dataSize2;
@@ -26,15 +23,16 @@ int main(int argc, char* argv[])
 
 // --------------------- we read the input image
 
+   std::cout << argv[1] << std::endl;
 
-   e1 = new gdcmHeader(toto, false, true);
+   e1 = new gdcm::Header( toto );
    if (!e1->IsReadable()) {
        std::cerr << "Sorry, " << toto <<"  not a Readable DICOM / ACR File"
                  <<std::endl;
        return 0;
    }
    
-   f1 = new gdcmFile(e1);
+   f1 = new gdcm::File(e1);
    imageData= f1->GetImageData();
    dataSize = f1->GetImageDataSize();
 
@@ -46,13 +44,13 @@ int main(int argc, char* argv[])
 
 // --------------------- we read the written image
       
-   e2 = new gdcmHeader(zozo, false, true);
+   e2 = new gdcm::Header( zozo );
    if (!e2->IsReadable()) {
        std::cerr << "Sorry, " << zozo << " not a Readable DICOM / ACR File"  
                  <<std::endl;
        return 0;
    }
-   f2 = new gdcmFile(e2);
+   f2 = new gdcm::File(e2);
    imageData2= f2->GetImageData();
    dataSize2 = f2->GetImageDataSize();
 
@@ -64,7 +62,7 @@ int main(int argc, char* argv[])
           << dataSize << " # " << dataSize2
           << " for file : " << toto << std::endl;
 
-     return 1;
+     return 0;
   }
   if (int res=memcmp(imageData,imageData2,dataSize) !=0) {
      std::cout << " ----------------------------------------- " 
@@ -74,7 +72,7 @@ int main(int argc, char* argv[])
      return 1;
   }
   
-  //If we reach here everythin is fine, return 0 then:
+  //If we reach here everything is fine, return 0 then:
   return 0;
 }