1 /*=========================================================================
4 Module: $RCSfile: TestAllVM.cxx,v $
6 Date: $Date: 2005/10/21 16:32:10 $
7 Version: $Revision: 1.6 $
9 Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
10 l'Image). All rights reserved. See Doc/License.txt or
11 http://www.creatis.insa-lyon.fr/Public/Gdcm/License.html for details.
13 This software is distributed WITHOUT ANY WARRANTY; without even
14 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 PURPOSE. See the above copyright notices for more information.
17 =========================================================================*/
20 #include "gdcmDataEntry.h"
23 #include "gdcmDataImages.h"
25 int DoTheVMTest(std::string const &filename)
28 // - Do not test unknow VM in shadow groups (in element 0x0000 is present
29 // - Skip Sequences (if they are 'True Length'); loading will be quicker
30 // (anyway, Sequences are skipped at processing time ...)
31 file.SetLoadMode( gdcm::LD_NOSHADOW | gdcm::LD_NOSEQ );
33 file.SetFileName( filename );
34 if( !file.Load() ) //would be really bad...
37 gdcm::DocEntry *d = file.GetFirstEntry();
38 std::cerr << "Testing file : " << filename << std::endl;
41 if ( gdcm::DataEntry *de = dynamic_cast<gdcm::DataEntry *>(d) )
43 if( !de->IsValueCountValid() )
45 std::cerr << "Element: " << de->GetKey() <<
46 " (" << de->GetName() << ") " <<
47 "Contains a wrong VM: " << de->GetValueCount()
48 << " should be: " << de->GetVM() << std::endl;;
53 // We skip pb of SQ recursive exploration
56 d = file.GetNextEntry();
62 int TestAllVM(int argc, char *argv[])
67 const char *filename = argv[1];
68 if( DoTheVMTest( filename ) )
74 while( gdcmDataImages[i] != 0 )
76 std::string filename = GDCM_DATA_ROOT;
78 filename += gdcmDataImages[i];
80 if( DoTheVMTest( filename ) )
83 std::cerr << std::endl; // skip a line after each file