1 /*=========================================================================
4 Module: $RCSfile: TestAllVM.cxx,v $
6 Date: $Date: 2005/10/21 15:16:22 $
7 Version: $Revision: 1.5 $
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 ...
29 file.SetLoadMode( gdcm::LD_NOSHADOW | gdcm::LD_NOSHADOWSEQ );
30 file.SetFileName( filename );
31 if( !file.Load() ) //would be really bad...
34 gdcm::DocEntry *d = file.GetFirstEntry();
35 std::cerr << "Testing file : " << filename << std::endl;
38 if ( gdcm::DataEntry *de = dynamic_cast<gdcm::DataEntry *>(d) )
40 if( !de->IsValueCountValid() )
42 std::cerr << "Element: " << de->GetKey() <<
43 " (" << de->GetName() << ") " <<
44 "Contains a wrong VM: " << de->GetValueCount()
45 << " should be: " << de->GetVM() << std::endl;;
50 // We skip pb of SQ recursive exploration
53 d = file.GetNextEntry();
59 int TestAllVM(int argc, char *argv[])
64 const char *filename = argv[1];
65 if( DoTheVMTest( filename ) )
71 while( gdcmDataImages[i] != 0 )
73 std::string filename = GDCM_DATA_ROOT;
75 filename += gdcmDataImages[i];
77 if( DoTheVMTest( filename ) )
80 std::cerr << std::endl; // skip a line after each file