+int DoTheVMTest(std::string const &filename)
+{
+ gdcm::File *file = gdcm::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::LD_NOSHADOW | gdcm::LD_NOSEQ );
+
+ file->SetFileName( filename );
+ if( !file->Load() ) //would be really bad...
+ return 1;
+
+ gdcm::DocEntry *d = file->GetFirstEntry();
+ std::cerr << "Testing file : " << filename << std::endl;
+ gdcm::DataEntry *de;
+ while(d)
+ {
+ if ( (de = dynamic_cast<gdcm::DataEntry *>(d)) )
+ {
+ 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
+ {
+ // We skip pb of SQ recursive exploration
+ }
+ d = file->GetNextEntry();
+ }
+ file->Delete();
+
+ return 0;
+}
+
+int TestAllVM(int argc, char *argv[])