+/*=========================================================================
+
+ Program: gdcm
+ Module: $RCSfile: TestReadWriteReadCompare.cxx,v $
+ Language: C++
+ Date: $Date: 2004/11/24 10:23:46 $
+ Version: $Revision: 1.14 $
+
+ 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 "gdcmHeader.h"
#include "gdcmFile.h"
delete header;
return 1;
}
- std::cout << " step 1 ...";
+ std::cout << " step 1...";
//////////////// Step 2:
file->SetImageData(imageData, dataSize);
+ file->SetWriteModeToRGB();
file->WriteDcmExplVR( output );
std::cout << "2...";
gdcm::File* reread = new gdcm::File( output );
if( !reread->GetHeader()->IsReadable() )
{
- std::cerr << "Test::TestReadWriteReadCompare: Could not reread image "
+ std::cerr << "Failed" << std::endl
+ << "Test::TestReadWriteReadCompare: Could not reread image "
<< "written:" << filename << std::endl;
delete header;
delete file;
std::cout << "3...";
// For the next step:
int dataSizeWritten = reread->GetImageDataSize();
- void* imageDataWritten = reread->GetImageData();
+ uint8_t* imageDataWritten = reread->GetImageData();
//////////////// Step 4:
if (dataSize != dataSizeWritten)
{
- std::cout << std::endl
+ std::cout << "Failed" << std::endl
<< " Pixel areas lengths differ: "
<< dataSize << " # " << dataSizeWritten << std::endl;
- delete (char*)imageData;
- delete (char*)imageDataWritten;
delete header;
delete file;
delete reread;
if (int res = memcmp(imageData, imageDataWritten, dataSize) !=0)
{
(void)res;
- std::cout << std::endl
+ std::cout << "Failed" << std::endl
<< " Pixel differ (as expanded in memory)." << std::endl;
- delete (char*)imageData;
- delete (char*)imageDataWritten;
delete header;
delete file;
delete reread;
std::cout << "4...OK." << std::endl ;
//////////////// Clean up:
- delete (char*)imageData;
- delete (char*)imageDataWritten;
delete header;
delete file;
delete reread;