X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;ds=sidebyside;f=Testing%2FTestAllReadCompareDicom.cxx;h=4a461f2cda64f008110a78a8ceb278bfd151e4f9;hb=af698856153f426a4d852b6645e238f669d42276;hp=21aba424208705a08ec24e223ab2096adaa9f1b2;hpb=3afc179392ebebe610f7685bc8895b690c2a66aa;p=gdcm.git diff --git a/Testing/TestAllReadCompareDicom.cxx b/Testing/TestAllReadCompareDicom.cxx index 21aba424..4a461f2c 100644 --- a/Testing/TestAllReadCompareDicom.cxx +++ b/Testing/TestAllReadCompareDicom.cxx @@ -1,3 +1,20 @@ +/*========================================================================= + + Program: gdcm + Module: $RCSfile: TestAllReadCompareDicom.cxx,v $ + Language: C++ + 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 + 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" #include @@ -10,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 << " Reference image " << std::endl - << " " << referenceFileName <GetImageDataSize(); uint8_t* testedImageData = tested->GetImageData(); @@ -64,7 +83,8 @@ int InternalTest(std::string const & filename, if (testedDataSize != referenceDataSize) { - std::cout << " Pixel areas lengths differ: " + std::cout << " Failed" << std::endl + << " pixel areas lengths differ: " << testedDataSize << " # " << referenceDataSize << std::endl; delete tested; @@ -76,18 +96,19 @@ int InternalTest(std::string const & filename, testedDataSize) != 0 ) { (void)res; - std::cout << " Pixel differ (as expanded in memory)." + std::cout << " Failed" << std::endl + << " pixel differ (as expanded in memory)." << std::endl; delete tested; delete reference; return 1; } - std::cout << " Passed..." << std::endl; //////////////// Clean up: delete tested; delete reference; - std::cout << " Passed clean up." << std::endl ; + + std::cout << "OK." << std::endl; return 0; }