]> Creatis software - gdcm.git/blobdiff - Testing/TestWriteSimple.cxx
update ChangeLog
[gdcm.git] / Testing / TestWriteSimple.cxx
index 33294911939c563c5153e74a71cc5bfc88dc2dbb..51b3f4d9bfb2eec72b6894a36d8c492c39fbb665 100644 (file)
@@ -10,17 +10,18 @@ int TestWriteSimple(int argc, char* argv[])
     {
     std::cerr << "Usage :" << std::endl << argv[0] << 
       " InputHeader OutputDicom" << std::endl;
-    return 0;  
+    return 0;
     }
 
-  const char *header = argv[1];
+  std::string header = argv[1];
   const char *output = argv[2];
 
-  dbg.SetDebug(4);
   gdcmHeader *f1 = new gdcmHeader( header );
   gdcmFile   *f2 = new gdcmFile( f1 );
-       
-  f2->GetImageData(); //EXTREMELY IMPORTANT
+
+  // If the following call is important, then the API sucks. Why is it
+  // required to allocate PixelData when we are not using it !?
+  void* PixelData = f2->GetImageData(); //EXTREMELY IMPORTANT
   //Otherwise ReadPixel == -1 -> the dicom writing fails completely
   
   int dataSize    = f2->GetImageDataSize();
@@ -33,6 +34,10 @@ int TestWriteSimple(int argc, char* argv[])
   f2->WriteDcmExplVR( output );
   
   delete[] imageData;
+  delete f1;
+  delete f2;
+  //delete PixelData; //Does GetImageData return the same pointer ?
+  (void)PixelData;
 
   return 0;
 }