- std::cout << "Failed" << std::endl
- << " Pixel differ (as expanded in memory)." << std::endl;
- delete file;
- delete filehelper;
- delete reread;
- return 1;
- }
- std::cout << "4...OK." << std::endl ;
+ std::string PixelType = filehelper->GetFile()->GetPixelType();
+ std::string ts = filehelper->GetFile()->GetTransferSyntax();
+
+ for(int i1=0; i1<dataSizeFixed; i1++)
+ if (abs ((int)imageData[i1]-(int)imageDataWritten[i1]) > 2) {
+ nbDiff++;
+ // break; // at debug time, keep line commented out; (uncommenting will save CPU time)
+ }
+
+ 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
+ << " bytes differing (pos : original - written) :"
+ << std::endl;
+
+ for(int i=0, j1=0; i<dataSizeFixed && j1<MAX_NUMBER_OF_DIFFERENCE; i++)
+ {
+ if (abs ((int)imageData[i]-(int)imageDataWritten[i]) > 2)
+ {
+ if (j1<MAX_NUMBER_OF_DIFFERENCE)
+ std::cout << std::dec << "(" << i << " : "
+ << std::hex
+ << (int)(imageData[i]) << " - "
+ << (int)(imageDataWritten[i]) << ") "
+ << std::dec;
+ ++j1;
+ }
+ }
+ std::cout << std::endl;