]> Creatis software - gdcm.git/blobdiff - Example/WriteRead.cxx
COMP: MacOSX does not respect opengroup definition of timeval which has a time_t...
[gdcm.git] / Example / WriteRead.cxx
index fab3f75dac2851d9b6746cf1b8b8688186a6ebf3..b5a5a9415f5e0f8820d7af6018a34c11b536cac2 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: WriteRead.cxx,v $
   Language:  C++
-  Date:      $Date: 2004/11/16 04:26:18 $
-  Version:   $Revision: 1.8 $
+  Date:      $Date: 2005/01/21 11:40:53 $
+  Version:   $Revision: 1.12 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
      PURPOSE.  See the above copyright notices for more information.
                                                                                 
 =========================================================================*/
+#include "gdcmFile.h"
+#include "gdcmFileHelper.h"
+
 #include <iostream>
-#include <stdio.h>
-#include "gdcm.h"
 
 int main(int argc, char* argv[])
 {  
-   std::string toto;
-   char zozo[200];
+   std::string zozo;
 
-   gdcm::Header* e1, *e2;
-   gdcm::File  * f1, *f2;
+   gdcm::File* e1, *e2;
+   gdcm::FileHelper  * f1, *f2;
 
    uint8_t* imageData, *imageData2;
    int dataSize, dataSize2;
@@ -36,38 +36,38 @@ int main(int argc, char* argv[])
     return 1;
     }
 
-   toto = argv[1];
+   std::string toto = argv[1];
 
 // --------------------- we read the input image
 
    std::cout << argv[1] << std::endl;
 
-   e1 = new gdcm::Header( toto );
+   e1 = new gdcm::File( toto );
    if (!e1->IsReadable()) {
        std::cerr << "Sorry, " << toto <<"  not a Readable DICOM / ACR File"
                  <<std::endl;
        return 0;
    }
    
-   f1 = new gdcm::File(e1);
+   f1 = new gdcm::FileHelper(e1);
    imageData= f1->GetImageData();
    dataSize = f1->GetImageDataSize();
 
 // --------------------- we write it as an Explicit VR DICOM file
 
-      sprintf(zozo, "temp.XDCM" );
+      zozo = "temp.XDCM";
       std::cout << "WriteDCM Explicit VR" << std::endl;
       f1->WriteDcmExplVR(zozo);
 
 // --------------------- we read the written image
       
-   e2 = new gdcm::Header( zozo );
+   e2 = new gdcm::File( zozo );
    if (!e2->IsReadable()) {
        std::cerr << "Sorry, " << zozo << " not a Readable DICOM / ACR File"  
                  <<std::endl;
        return 0;
    }
-   f2 = new gdcm::File(e2);
+   f2 = new gdcm::FileHelper(e2);
    imageData2= f2->GetImageData();
    dataSize2 = f2->GetImageDataSize();