1 /*=========================================================================
4 Module: $RCSfile: gdcmValidator.cxx,v $
6 Date: $Date: 2005/10/18 08:35:51 $
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 =========================================================================*/
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 const std::string &s = entry->GetString();
41 std::string::size_type n = s.find("\\");
42 if ( n == s.npos ) // none found
46 n++; // number of '\' + 1 == Value Multiplicity
49 std::istringstream os;
50 os.str( entry->GetVM());
56 void Validator::SetInput(ElementSet *input)
58 // berk for now SetInput do two things at the same time
59 DocEntry *d=input->GetFirstEntry();
62 if ( DataEntry *v = dynamic_cast<DataEntry *>(d) )
66 std::cout << "Rah this DICOM contains one wrong tag:" <<
67 v->GetString() << " " <<
68 v->GetGroup() << "," << v->GetElement() << "," <<
69 v->GetVR() << " " << v->GetVM() << " " << v->GetName() << std::endl;
74 // We skip pb of SQ recursive exploration
76 d=input->GetNextEntry();
80 } // end namespace gdcm