X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;ds=sidebyside;f=Testing%2FTestAllReadCompareDicom.cxx;h=4a461f2cda64f008110a78a8ceb278bfd151e4f9;hb=af698856153f426a4d852b6645e238f669d42276;hp=2eb4cf604b9844aee238f8d91ae5a4eaba91e2eb;hpb=e8439d97c8441809e9a5236e729bae1a25ffb418;p=gdcm.git diff --git a/Testing/TestAllReadCompareDicom.cxx b/Testing/TestAllReadCompareDicom.cxx index 2eb4cf60..4a461f2c 100644 --- a/Testing/TestAllReadCompareDicom.cxx +++ b/Testing/TestAllReadCompareDicom.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: TestAllReadCompareDicom.cxx,v $ Language: C++ - Date: $Date: 2004/11/16 14:48:19 $ - Version: $Revision: 1.15 $ + Date: $Date: 2004/11/25 10:24:33 $ + Version: $Revision: 1.19 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -27,52 +27,54 @@ int InternalTest(std::string const & filename, { std::cout << " Testing: " << filename << std::endl; + ////// Step 1: + std::cout << " 1..."; gdcm::File* tested = new gdcm::File( filename ); if( !tested->GetHeader()->IsReadable() ) { - std::cout << " Image not gdcm compatible:" + std::cout << " Failed" << std::endl + << " Image not gdcm compatible:" << filename << std::endl; delete tested; return 1; } ////// Step 2: - ////// Check for existence of reference baseline dicom file: + std::cout << "2..."; FILE* testFILE = fopen( referenceFileName.c_str(), "r" ); if (! testFILE ) { - ////// Step 3a: uint8_t* testedImageData = tested->GetImageData(); // Kludge + (void)testedImageData; + + tested->SetWriteModeToRGB(); tested->WriteDcmExplVR( referenceFileName ); - std::cerr << " Creating reference baseline file :" << std::endl - << " " << referenceFileName - << std::endl; - delete tested; - //delete (char*)testedImageData; - return 0; } else { fclose( testFILE ); } + ////// Step 3a: ////// When reference file is not gdcm readable test is failed: - + std::cout << "3a..."; + gdcm::File* reference = new gdcm::File( referenceFileName ); if( !reference->GetHeader()->IsReadable() ) { - std::cout << " Failed: reference image " << std::endl - << " " << referenceFileName <GetImageDataSize(); uint8_t* testedImageData = tested->GetImageData(); @@ -81,7 +83,8 @@ int InternalTest(std::string const & filename, if (testedDataSize != referenceDataSize) { - std::cout << " Failed: pixel areas lengths differ: " + std::cout << " Failed" << std::endl + << " pixel areas lengths differ: " << testedDataSize << " # " << referenceDataSize << std::endl; delete tested; @@ -93,7 +96,8 @@ int InternalTest(std::string const & filename, testedDataSize) != 0 ) { (void)res; - std::cout << " Failed: pixel differ (as expanded in memory)." + std::cout << " Failed" << std::endl + << " pixel differ (as expanded in memory)." << std::endl; delete tested; delete reference; @@ -104,7 +108,7 @@ int InternalTest(std::string const & filename, delete tested; delete reference; - std::cout << " Passed..." << std::endl; + std::cout << "OK." << std::endl; return 0; }