]> Creatis software - gdcm.git/blobdiff - Example/TestReadWriteReadCompare.cxx
BUG: Remove tons of mem leaks. There are still plenty that explains why gdcm is dog...
[gdcm.git] / Example / TestReadWriteReadCompare.cxx
index 5ea15b8ca7c9775cf2e0baf8dae63e6677c39a29..cf4840347f6c993db99e8b8a54b06f624ec90be3 100644 (file)
@@ -6,10 +6,10 @@
 
 int main(int argc, char* argv[]) 
 {
-   if (argc)
+   if (argc<2)
    {
       std::cerr << "Test::TestReadWriteReadCompare: Usage: " << argv[0]
-                << " (no arguments needed)." << std::endl;
+                << " fileToCheck.dcm " << std::endl;
    }
    
    std::cout<< "Test::TestReadWriteReadCompare: description " << std::endl;
@@ -28,18 +28,19 @@ int main(int argc, char* argv[])
              << "images " << std::endl
              << "           match (as expanded by gdcm)." << std::endl;
 
-   int i = 0;
-   while( gdcmDataImages[i] != 0 )
+   //int i = 0;
+   //while( gdcmDataImages[i] != 0 ) 
    {
       std::string filename = GDCM_DATA_ROOT;
       filename += "/";
-      filename += gdcmDataImages[i++];
+      //filename += gdcmDataImages[i++];
+     filename +=argv[1];
    
       std::cout << "   Testing: " << filename << std::endl;
 
-      //////////////// Step 1 (see above description):
+      //////////////// Step 1 (see above description): 
 
-      gdcmHeader *header = new gdcmHeader( filename );
+      gdcm::Header *header = new gdcm::Header( filename );
       if( !header->IsReadable() )
       {
          std::cerr << "Test::TestReadWriteReadCompare: Image not gdcm compatible:"
@@ -51,9 +52,9 @@ int main(int argc, char* argv[])
 
       //////////////// Step 2:
 
-      gdcmFile*  file = new gdcmFile( header );
+      gdcm::File*  file = new gdcm::File( 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) 
@@ -81,7 +82,7 @@ int main(int argc, char* argv[])
     
       //////////////// Step 3:
 
-      gdcmFile* reread = new gdcmFile( "TestReadWriteReadCompare.dcm" );
+      gdcm::File* reread = new gdcm::File( "TestReadWriteReadCompare.dcm" );
       if( !reread->GetHeader()->IsReadable() )
       {
         std::cerr << "Test::TestReadWriteReadCompare: Could not reread image "