1 /*=========================================================================
4 Module: $RCSfile: gdcmValidator.cxx,v $
6 Date: $Date: 2005/10/28 15:52:15 $
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 =========================================================================*/
19 #include "gdcmValidator.h"
20 #include "gdcmElementSet.h"
21 #include "gdcmDataEntry.h"
28 Validator::Validator()
32 Validator::~Validator()
36 // Function to compare the VM found while parsing d->GetString()
37 // compare to the one from the dictionary
38 bool CheckVM(DataEntry *entry)
40 // Don't waste time checking tags where VM is OB and OW, since we know
41 // it's allways 1, whatever the actual length (found on disc)
43 if ( entry->GetVR() == "OB" || entry->GetVR() == "OW" )
46 const std::string &s = entry->GetString();
47 std::string::size_type n = s.find("\\");
48 if ( n == s.npos ) // none found
52 n++; // number of '\' + 1 == Value Multiplicity
55 std::istringstream os;
56 os.str( entry->GetVM());
62 void Validator::SetInput(ElementSet *input)
64 // berk for now SetInput do two things at the same time
65 DocEntry *d=input->GetFirstEntry();
68 if ( DataEntry *v = dynamic_cast<DataEntry *>(d) )
72 std::cout << "Rah this DICOM contains one wrong tag:" <<
73 v->GetString() << " " <<
74 v->GetGroup() << "," << v->GetElement() << "," <<
75 v->GetVR() << " " << v->GetVM() << " " << v->GetName() << std::endl;
80 // We skip pb of SQ recursive exploration
82 d=input->GetNextEntry();
86 } // end namespace gdcm