X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=Testing%2FTestWriteSimple.cxx;h=51b3f4d9bfb2eec72b6894a36d8c492c39fbb665;hb=5d7b7ebb9dbbe72c1c3b5d14194cdf8c8f7d082f;hp=33294911939c563c5153e74a71cc5bfc88dc2dbb;hpb=8e1fe98f7659cec85bcbce8551e28f8e45971370;p=gdcm.git diff --git a/Testing/TestWriteSimple.cxx b/Testing/TestWriteSimple.cxx index 33294911..51b3f4d9 100644 --- a/Testing/TestWriteSimple.cxx +++ b/Testing/TestWriteSimple.cxx @@ -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; }