X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=Testing%2FTestAllVM.cxx;h=0abb80701e060e599e57c2475cba0f17a11c832f;hb=88a0e8d8c47070a680d71eb6a7ac349993e81a5f;hp=e0181e9cfb705ab29757085281ad7a9391bc9a9a;hpb=be54306f862b4c88b06397e266070903556f44f2;p=gdcm.git diff --git a/Testing/TestAllVM.cxx b/Testing/TestAllVM.cxx index e0181e9c..0abb8070 100644 --- a/Testing/TestAllVM.cxx +++ b/Testing/TestAllVM.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: TestAllVM.cxx,v $ Language: C++ - Date: $Date: 2005/10/21 16:32:10 $ - Version: $Revision: 1.6 $ + Date: $Date: 2007/06/21 14:59:06 $ + Version: $Revision: 1.15 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -24,39 +24,48 @@ int DoTheVMTest(std::string const &filename) { - gdcm::File file; - // - Do not test unknow VM in shadow groups (in element 0x0000 is present - // - Skip Sequences (if they are 'True Length'); loading will be quicker - // (anyway, Sequences are skipped at processing time ...) - file.SetLoadMode( gdcm::LD_NOSHADOW | gdcm::LD_NOSEQ ); + GDCM_NAME_SPACE::File *file = GDCM_NAME_SPACE::File::New(); + // - Do not test unknow VM in shadow groups (if element 0x0000 is present) + // - Skip Sequences (if they are 'True Length'); loading will be quicker + // (anyway, Sequences are skipped at processing time ...) + file->SetLoadMode( GDCM_NAME_SPACE::LD_NOSHADOW | GDCM_NAME_SPACE::LD_NOSEQ ); - file.SetFileName( filename ); - if( !file.Load() ) //would be really bad... - return 1; + file->SetFileName( filename ); + if( !file->Load() ) //would be really bad... + return 1; - gdcm::DocEntry *d = file.GetFirstEntry(); - std::cerr << "Testing file : " << filename << std::endl; - while(d) + GDCM_NAME_SPACE::DocEntry *d = file->GetFirstEntry(); + std::cerr << "Testing file : " << filename << std::endl; + GDCM_NAME_SPACE::DataEntry *de; + while(d) + { + if ( (de = dynamic_cast(d)) ) { - if ( gdcm::DataEntry *de = dynamic_cast(d) ) - { - if( !de->IsValueCountValid() ) - { - std::cerr << "Element: " << de->GetKey() << - " (" << de->GetName() << ") " << - "Contains a wrong VM: " << de->GetValueCount() - << " should be: " << de->GetVM() << std::endl;; - } + if ( !(de->GetGroup() % 2) ) // Don't check shadow elements. Righ now, + // Private Dictionnary are not dealt with + { + // We know OB and OW VM is always 1, whatever the actual + // found value is. + + if (de->GetVR() != "OB" && de->GetVR() != "OW" ) + if( !de->IsValueCountValid() ) + { + std::cerr << "Element: " << de->GetKey() << + " (" << de->GetName() << ") " << + "Contains a wrong VM: " << de->GetValueCount() + << " should be: " << de->GetVM() << std::endl;; + } } - else - { + } + else + { // We skip pb of SQ recursive exploration - } - - d = file.GetNextEntry(); } + d = file->GetNextEntry(); + } + file->Delete(); - return 0; + return 0; } int TestAllVM(int argc, char *argv[]) @@ -76,6 +85,11 @@ int TestAllVM(int argc, char *argv[]) std::string filename = GDCM_DATA_ROOT; filename += "/"; filename += gdcmDataImages[i]; + + if (!strcmp(gdcmDataImages[i],"00191113.dcm")) // Track bug on Darwin + GDCM_NAME_SPACE::Debug::DebugOn(); + else + GDCM_NAME_SPACE::Debug::DebugOff(); if( DoTheVMTest( filename ) ) return 1;