X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=Testing%2FTestAllReadCompareDicom.cxx;h=aba924629643210b6c633898e0368204df8b3c90;hb=d00078b5e19310b379c8339fa8fe38362e8ca392;hp=e341b6451745594fb3638ab8c0fb2fe760b70a92;hpb=abac16617f1453f5db19618ccb45e821efa867b6;p=gdcm.git diff --git a/Testing/TestAllReadCompareDicom.cxx b/Testing/TestAllReadCompareDicom.cxx index e341b645..aba92462 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/30 14:17:52 $ - Version: $Revision: 1.20 $ + Date: $Date: 2005/01/20 16:16:59 $ + Version: $Revision: 1.24 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -16,8 +16,10 @@ =========================================================================*/ #include "gdcmHeader.h" -#include "gdcmFile.h" -#include +#include "gdcmFileHelper.h" + +#include +#include //Generated file: #include "gdcmDataImages.h" @@ -29,7 +31,7 @@ int InternalTest(std::string const & filename, ////// Step 1: std::cout << " 1..."; - gdcm::File* tested = new gdcm::File( filename ); + gdcm::FileHelper* tested = new gdcm::FileHelper( filename ); if( !tested->GetHeader()->IsReadable() ) { std::cout << " Failed" << std::endl @@ -43,7 +45,8 @@ int InternalTest(std::string const & filename, ////// Check for existence of reference baseline dicom file: std::cout << "2..."; - FILE* testFILE = fopen( referenceFileName.c_str(), "r" ); + //FILE* testFILE = fopen( referenceFileName.c_str(), "r" ); + std::ifstream testFILE( referenceFileName.c_str() ); if (! testFILE ) { uint8_t* testedImageData = tested->GetImageData(); // Kludge @@ -54,14 +57,15 @@ int InternalTest(std::string const & filename, } else { - fclose( testFILE ); + //fclose( testFILE ); } + testFILE.close(); ////// Step 3a: ////// When reference file is not gdcm readable test is failed: std::cout << "3a..."; - gdcm::File* reference = new gdcm::File( referenceFileName ); + gdcm::FileHelper* reference = new gdcm::FileHelper( referenceFileName ); if( !reference->GetHeader()->IsReadable() ) { std::cout << " Failed" << std::endl @@ -73,6 +77,8 @@ int InternalTest(std::string const & filename, return 1; } + std::string PixelType = reference->GetHeader()->GetPixelType(); + ////// Step 3b: std::cout << "3b..."; int testedDataSize = tested->GetImageDataSize(); @@ -103,7 +109,9 @@ int InternalTest(std::string const & filename, if (testedDataSize != referenceDataSize) { std::cout << " Failed" << std::endl - << " pixel areas lengths differ: " + << " pixel (" + << PixelType + <<") areas lengths differ: " << testedDataSize << " # " << referenceDataSize << std::endl; delete tested; @@ -117,7 +125,9 @@ int InternalTest(std::string const & filename, { (void)res; std::cout << " Failed" << std::endl - << " pixel differ (as expanded in memory)." + << " pixel (" + << PixelType + << ") differ (as expanded in memory)." << std::endl; delete tested; delete reference;