]> Creatis software - gdcm.git/blobdiff - Example/TestReadWriteReadCompare.cxx
Name normalization
[gdcm.git] / Example / TestReadWriteReadCompare.cxx
index da97003a0d5b9533aa9fe5e7fcb4559b3f556dc8..98a3a08a620a521e16ddca0c36506de2c706537c 100644 (file)
@@ -1,10 +1,27 @@
-#include "gdcmHeader.h"
+/*=========================================================================
+                                                                                
+  Program:   gdcm
+  Module:    $RCSfile: TestReadWriteReadCompare.cxx,v $
+  Language:  C++
+  Date:      $Date: 2005/02/02 10:06:32 $
+  Version:   $Revision: 1.10 $
+                                                                                
+  Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
+  l'Image). All rights reserved. See Doc/License.txt or
+  http://www.creatis.insa-lyon.fr/Public/Gdcm/License.html for details.
+                                                                                
+     This software is distributed WITHOUT ANY WARRANTY; without even
+     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+     PURPOSE.  See the above copyright notices for more information.
+                                                                                
+=========================================================================*/
 #include "gdcmFile.h"
+#include "gdcmFileHelper.h"
 
 //Generated file:
 #include "gdcmDataImages.h"
 
-int main(int argc, charargv[]) 
+int main(int argc, char *argv[]) 
 {
    if (argc<2)
    {
@@ -16,7 +33,7 @@ int main(int argc, char* argv[])
    std::cout << "   For all images in gdcmData (and not blacklisted in "
                 "Test/CMakeLists.txt)" << std::endl;
    std::cout << "   apply the following multistep test: " << std::endl;
-   std::cout << "   step 1: parse the image (as gdcmHeader) and call"
+   std::cout << "   step 1: parse the image (as gdcmFile) and call"
              << " IsReadable(). " << std::endl;
    std::cout << "   step 2: write the corresponding image in DICOM V3 "
              << "with explicit" << std::endl
@@ -40,7 +57,7 @@ int main(int argc, char* argv[])
 
       //////////////// Step 1 (see above description): 
 
-      gdcmHeader *header = new gdcmHeader( filename );
+      gdcm::File *header = new gdcm::File( filename );
       if( !header->IsReadable() )
       {
          std::cerr << "Test::TestReadWriteReadCompare: Image not gdcm compatible:"
@@ -52,9 +69,9 @@ int main(int argc, char* argv[])
 
       //////////////// Step 2:
 
-      gdcmFile*  file = new gdcmFile( header );
+      gdcm::FileHelper *file = new gdcm::FileHelper( header );
       int dataSize    = file->GetImageDataSize();
-      void* imageData = file->GetImageData(); //EXTREMELY IMPORTANT
+      uint8_t* imageData = file->GetImageData(); //EXTREMELY IMPORTANT
              // Sure, it is : It's up to the user to decide if he wants to
              // GetImageData or if he wants to GetImageDataRaw
              // (even if we do it by setting a flag, he will have to decide) 
@@ -82,8 +99,8 @@ int main(int argc, char* argv[])
     
       //////////////// Step 3:
 
-      gdcmFile* reread = new gdcmFile( "TestReadWriteReadCompare.dcm" );
-      if( !reread->GetHeader()->IsReadable() )
+      gdcm::FileHelper *reread = new gdcm::FileHelper( "TestReadWriteReadCompare.dcm" );
+      if( !reread->GetFile()->IsReadable() )
       {
         std::cerr << "Test::TestReadWriteReadCompare: Could not reread image "
                   << "written:" << filename << std::endl;
@@ -95,7 +112,7 @@ int main(int argc, char* argv[])
       std::cout << "3...";
       // For the next step:
       int    dataSizeWritten = reread->GetImageDataSize();
-      void* imageDataWritten = reread->GetImageData();
+      uint8_t *imageDataWritten = reread->GetImageData();
 
       //////////////// Step 4:
  
@@ -104,8 +121,6 @@ int main(int argc, char* argv[])
          std::cout << std::endl
             << "        Pixel areas lengths differ: "
             << dataSize << " # " << dataSizeWritten << std::endl;
-         delete (char*)imageData;
-         delete (char*)imageDataWritten;
          delete header;
          delete file;
          delete reread;
@@ -117,8 +132,6 @@ int main(int argc, char* argv[])
          (void)res;
          std::cout << std::endl
             << "        Pixel differ (as expanded in memory)." << std::endl;
-         delete (char*)imageData;
-         delete (char*)imageDataWritten;
          delete header;
          delete file;
          delete reread;
@@ -127,8 +140,6 @@ int main(int argc, char* argv[])
       std::cout << "4...OK." << std::endl ;
 
       //////////////// Clean up:
-      delete (char*)imageData;
-      delete (char*)imageDataWritten;
       delete header;
       delete file;
       delete reread;