X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=Testing%2FTestReadWriteReadCompare.cxx;h=cc48edb7bd94bdf1bf46d7df9c7218e8d0c7b859;hb=5a0d183707a94e875a595036f64d0bd506faf618;hp=1559a6d11028ecfa457b7e688d79994817e7c421;hpb=5ce83ba7ad93f458923e5f3b7aa406651db90637;p=gdcm.git diff --git a/Testing/TestReadWriteReadCompare.cxx b/Testing/TestReadWriteReadCompare.cxx index 1559a6d1..cc48edb7 100644 --- a/Testing/TestReadWriteReadCompare.cxx +++ b/Testing/TestReadWriteReadCompare.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: TestReadWriteReadCompare.cxx,v $ Language: C++ - Date: $Date: 2004/11/16 04:28:20 $ - Version: $Revision: 1.13 $ + Date: $Date: 2004/11/30 14:17:52 $ + Version: $Revision: 1.17 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -35,7 +35,7 @@ int CompareInternal(std::string const & filename, std::string const & output) delete header; return 1; } - std::cout << " step 1 ..."; + std::cout << " step 1..."; //////////////// Step 2: @@ -64,6 +64,7 @@ int CompareInternal(std::string const & filename, std::string const & output) file->SetImageData(imageData, dataSize); + file->SetWriteModeToRGB(); file->WriteDcmExplVR( output ); std::cout << "2..."; @@ -72,7 +73,8 @@ int CompareInternal(std::string const & filename, std::string const & output) 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; @@ -85,10 +87,29 @@ int CompareInternal(std::string const & filename, std::string const & output) uint8_t* imageDataWritten = reread->GetImageData(); //////////////// Step 4: + // Test the image size + if (header->GetXSize() != reread->GetHeader()->GetXSize() || + header->GetYSize() != reread->GetHeader()->GetYSize() || + header->GetZSize() != reread->GetHeader()->GetZSize()) + { + std::cout << "Failed" << std::endl + << " X Size differs: " + << "X: " << header->GetXSize() << " # " + << reread->GetHeader()->GetXSize() << " | " + << "Y: " << header->GetYSize() << " # " + << reread->GetHeader()->GetYSize() << " | " + << "Z: " << header->GetZSize() << " # " + << reread->GetHeader()->GetZSize() << std::endl; + delete header; + delete file; + delete reread; + return 1; + } + // Test the data size if (dataSize != dataSizeWritten) { - std::cout << std::endl + std::cout << "Failed" << std::endl << " Pixel areas lengths differ: " << dataSize << " # " << dataSizeWritten << std::endl; delete header; @@ -97,10 +118,11 @@ int CompareInternal(std::string const & filename, std::string const & output) return 1; } + // Test the data's content 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 header; delete file;