X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=Testing%2FTestAllReadCompareDicom.cxx;h=5d08ea35740eac6483365f0e6819b3ab63608e5a;hb=HEAD;hp=56aecc31634df67bce56481e673b2aeb846c6f9e;hpb=0c1b69c840b2ab0f42ef1cdbbc1897c44a5ed264;p=gdcm.git diff --git a/Testing/TestAllReadCompareDicom.cxx b/Testing/TestAllReadCompareDicom.cxx index 56aecc31..5d08ea35 100644 --- a/Testing/TestAllReadCompareDicom.cxx +++ b/Testing/TestAllReadCompareDicom.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: TestAllReadCompareDicom.cxx,v $ Language: C++ - Date: $Date: 2007/06/04 08:51:24 $ - Version: $Revision: 1.59 $ + Date: $Date: 2008/09/15 15:49:21 $ + Version: $Revision: 1.62 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -291,11 +291,11 @@ bool TestFile::ReadFileData(std::ifstream *fp) // Track BigEndian troubles std::cout << " ScalarSize : " << GetScalarSize() << " IsCurrentProcessorBigEndian:" - << gdcm::Util::IsCurrentProcessorBigEndian() + << GDCM_NAME_SPACE::Util::IsCurrentProcessorBigEndian() << std::endl; //if (GetScalarSize() == 1 || GetSwapCode() == 1234) - if (GetScalarSize() == 1 || !gdcm::Util::IsCurrentProcessorBigEndian() ) + if (GetScalarSize() == 1 || !GDCM_NAME_SPACE::Util::IsCurrentProcessorBigEndian() ) { return true; } @@ -446,8 +446,8 @@ int InternalTest(std::string const &filename, std::cout << "1..."; // new style - gdcm::File *f = gdcm::File::New(); - f->SetLoadMode ( gdcm::LD_ALL ); // Load everything + GDCM_NAME_SPACE::File *f = GDCM_NAME_SPACE::File::New(); + f->SetLoadMode ( GDCM_NAME_SPACE::LD_ALL ); // Load everything f->SetFileName( filename ); f->Load(); @@ -459,7 +459,7 @@ int InternalTest(std::string const &filename, f->Delete(); return 1; } - gdcm::FileHelper *tested = gdcm::FileHelper::New( f ); + GDCM_NAME_SPACE::FileHelper *tested = GDCM_NAME_SPACE::FileHelper::New( f ); ////// Step 2: ////// Check for existence of reference baseline dicom file: @@ -542,7 +542,9 @@ int InternalTest(std::string const &filename, } // Test the data size - if (testedDataSize != referenceDataSize) + // *actual* image length may differ to 1 with Pixel Data Element length! + if ((testedDataSize+testedDataSize%2) != + (referenceDataSize+referenceDataSize%2) ) { std::cout << " Failed" << std::endl << " pixel (" @@ -553,7 +555,8 @@ int InternalTest(std::string const &filename, << " Image size: (" << tested->GetFile()->GetXSize() << "," << tested->GetFile()->GetYSize() << "," - << tested->GetFile()->GetZSize() << ")" + << tested->GetFile()->GetZSize() << ") nb of scalar components " + << tested->GetFile()->GetNumberOfScalarComponents() << std::endl; tested->Delete(); delete reference; @@ -562,8 +565,14 @@ int InternalTest(std::string const &filename, } // Test the data content + int length = tested->GetFile()->GetXSize()*tested->GetFile()->GetYSize()*tested->GetFile()->GetZSize() + *reference->GetScalarSize()*tested->GetFile()->GetNumberOfScalarComponents(); + + // *actual* image length may differ to 1 with Pixel Data Element length! + if (length != testedDataSize) + std::cout <<"--------------------length " << length << " != testedDataSize " << testedDataSize << std::endl; if ( memcmp(testedImageData, referenceImageData, - testedDataSize) != 0 ) + length/*testedDataSize*/) != 0 ) { std::string ts = tested->GetFile()->GetTransferSyntax(); @@ -573,7 +582,7 @@ int InternalTest(std::string const &filename, << ") differ (as expanded in memory)." << std::endl << " compression : " - << gdcm::Global::GetTS()->GetValue(ts) << std::endl; + << GDCM_NAME_SPACE::Global::GetTS()->GetValue(ts) << std::endl; std::cout << " list of the first " << MAX_NUMBER_OF_DIFFERENCE << " pixels differing (pos : test - ref) :" @@ -612,10 +621,10 @@ int InternalTest(std::string const &filename, int TestAllReadCompareDicom(int argc, char *argv[]) { // Temporarily added, to track BigEndian troubles -gdcm::Debug::WarningOn(); +GDCM_NAME_SPACE::Debug::WarningOn(); if (argc == 4) - gdcm::Debug::DebugOn(); + GDCM_NAME_SPACE::Debug::DebugOn(); if ( argc >= 3 ) { @@ -668,7 +677,7 @@ gdcm::Debug::WarningOn(); std::string baseLineDir = GDCM_DATA_ROOT; baseLineDir += "/BaselineDicom"; - if( !gdcm::DirList::IsDirectory(baseLineDir) ) + if( !GDCM_NAME_SPACE::DirList::IsDirectory(baseLineDir) ) { std::cerr << " The reference baseline directory " << std::endl << " " @@ -679,9 +688,9 @@ gdcm::Debug::WarningOn(); } //if (gdcmDataImages[i] == "D_CLUNIE_CT2_RLE.dcm") -// gdcm::Debug::DebugOn(); // track pb on BigEndian Proc +// GDCM_NAME_SPACE::Debug::DebugOn(); // track pb on BigEndian Proc //else - gdcm::Debug::DebugOff(); + GDCM_NAME_SPACE::Debug::DebugOff(); ////// Step 1 (see above description): std::string filename = GDCM_DATA_ROOT;