From: jpr Date: Thu, 30 Aug 2007 14:07:33 +0000 (+0000) Subject: (try to) help debugger X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=24d67959e7dfb06e7e7f6fb420c88e124116ebc8;p=gdcm.git (try to) help debugger --- diff --git a/Testing/TestReadWriteJPEG2000ReadCompare.cxx b/Testing/TestReadWriteJPEG2000ReadCompare.cxx index 7cbc106d..2ab80b74 100755 --- a/Testing/TestReadWriteJPEG2000ReadCompare.cxx +++ b/Testing/TestReadWriteJPEG2000ReadCompare.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: TestReadWriteJPEG2000ReadCompare.cxx,v $ Language: C++ - Date: $Date: 2007/08/30 11:51:29 $ - Version: $Revision: 1.2 $ + Date: $Date: 2007/08/30 14:07:33 $ + Version: $Revision: 1.3 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -136,44 +136,44 @@ static int CompareInternalJPEG2000(std::string const &filename, std::string cons } // Test the data content - + unsigned int j =0; + unsigned int nbDiff =0; if (memcmp(imageData, imageDataWritten, dataSizeFixed) !=0) { std::string PixelType = filehelper->GetFile()->GetPixelType(); std::string ts = filehelper->GetFile()->GetTransferSyntax(); - unsigned int j =0; - for(int i1=0; i1 2) - { - j=1; - break; + for(int i1=0; i1 2) { + nbDiff++; + // break; // at debug time; keep line commented out; (uncommenting will save CPU time) } - } - - if (j!=0) - { - std::cout << std::endl << filename << " Failed" - << " pixel (" - << PixelType << " b alloc " << file->GetBitsAllocated() << " b stored " << file->GetBitsStored() + + if (nbDiff!=0) + { + std::cout << std::endl << filename << " Failed : " + << nbDiff/(file->GetBitsAllocated()/8) << " pixels -amongst " + << dataSizeFixed/(file->GetBitsAllocated()/8) << "- (" + << PixelType << " bAlloc " << file->GetBitsAllocated() << " bStored " << file->GetBitsStored() << ") differ (as expanded in memory)." << std::endl << " compression : " << GDCM_NAME_SPACE::Global::GetTS()->GetValue(ts) << std::endl; - std::cout << " list of the first " << MAX_NUMBER_OF_DIFFERENCE - << " pixels differing (pos : original - written) :" + std::cout << " list of the first " << MAX_NUMBER_OF_DIFFERENCE + << " bytes differing (pos : original - written) :" << std::endl; for(int i=0, j=0; i 2) { - std::cout << std::hex << "(" << i << " : " - << std::hex << (int)(imageData[i]) << " - " - << std::hex << (int)(imageDataWritten[i]) << ") " - << std::dec; + if (jDelete(); fileout->Delete(); reread->Delete(); - nb_of_failure2000___++; + nb_of_failure2000___++; return 1; } else { - std::cout << std::endl << filename << " : some pixels" - << " (" - << PixelType << " b alloc " << file->GetBitsAllocated() << " b stored " << file->GetBitsStored() + std::cout << std::endl << filename << " : some pixels" + << " (" + << PixelType << " bAlloc " << file->GetBitsAllocated() << " bStored " << file->GetBitsStored() << ") differ +/-1 (as expanded in memory)." << std::endl - << " compression : " + << " compression : " << GDCM_NAME_SPACE::Global::GetTS()->GetValue(ts) << std::endl; - std::cout << " list of the first " << MAX_NUMBER_OF_DIFFERENCE - << " pixels differing (pos : original - written) :" + std::cout << " list of the first " << MAX_NUMBER_OF_DIFFERENCE + << " bytes differing (pos : original - written) :" << std::endl; for(int i=0, j=0; iGetFile()->GetPixelType(); std::string ts = filehelper->GetFile()->GetTransferSyntax(); - unsigned int j =0; - for(int i1=0; i1 2) - { - j=1; - break; + for(int i1=0; i1 2) { + nbDiff++; + // break; // at debug time; keep line commented out; (uncommenting will save CPU time) } - } - - if (j!=0) - { - std::cout << std::endl << filename << " Failed" - << " pixel (" - << PixelType << " b alloc " << file->GetBitsAllocated() << " b stored " << file->GetBitsStored() + + if (nbDiff!=0) + { + std::cout << std::endl << filename << " Failed : " + << nbDiff/(file->GetBitsAllocated()/8) << " pixels -amongst " + << dataSizeFixed/(file->GetBitsAllocated()/8) << "- (" + << PixelType << " bAlloc " << file->GetBitsAllocated() << " bStored " << file->GetBitsStored() << ") differ (as expanded in memory)." << std::endl << " compression : " << GDCM_NAME_SPACE::Global::GetTS()->GetValue(ts) << std::endl; - std::cout << " list of the first " << MAX_NUMBER_OF_DIFFERENCE - << " pixels differing (pos : original - written) :" + std::cout << " list of the first " << MAX_NUMBER_OF_DIFFERENCE + << " bytes differing (pos : original - written) :" << std::endl; for(int i=0, j=0; i 2) { - std::cout << std::hex << "(" << i << " : " - << std::hex << (int)(imageData[i]) << " - " - << std::hex << (int)(imageDataWritten[i]) << ") " - << std::dec; + if (jDelete(); fileout->Delete(); reread->Delete(); - nb_of_failure___++; + nb_of_failure___++; return 1; } else { - std::cout << std::endl << filename << " : some pixels" - << " (" - << PixelType << " b alloc " << file->GetBitsAllocated() << " b stored " << file->GetBitsStored() + std::cout << std::endl << filename << " : some pixels" + << " (" + << PixelType << " bAlloc " << file->GetBitsAllocated() << " bStored " << file->GetBitsStored() << ") differ +/-1 (as expanded in memory)." << std::endl - << " compression : " + << " compression : " << GDCM_NAME_SPACE::Global::GetTS()->GetValue(ts) << std::endl; - std::cout << " list of the first " << MAX_NUMBER_OF_DIFFERENCE - << " pixels differing (pos : original - written) :" + std::cout << " list of the first " << MAX_NUMBER_OF_DIFFERENCE + << " bytes differing (pos : original - written) :" << std::endl; for(int i=0, j=0; i