1 /*=========================================================================
4 Module: $RCSfile: gdcmValidator.cxx,v $
6 Date: $Date: 2005/06/24 10:55:59 $
7 Version: $Revision: 1.4 $
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 "gdcmBinEntry.h"
22 #include "gdcmValEntry.h"
29 Validator::Validator()
33 Validator::~Validator()
37 // Function to compare the VM found while parsing d->GetValue()
38 // compare to the one from the dictionary
39 bool CheckVM(ValEntry *v)
41 const std::string &s = v->GetValue();
42 std::string::size_type n = s.find("\\");
43 if ( n == s.npos ) // none found
47 n++; // number of '\' + 1 == Value Multiplicity
50 std::istringstream os;
57 void Validator::SetInput(ElementSet *input)
59 // berk for now SetInput do two things at the same time
60 gdcm::DocEntry *d=input->GetFirstEntry();
63 if ( gdcm::BinEntry *b = dynamic_cast<gdcm::BinEntry*>(d) )
65 // copyH->InsertBinEntry( b->GetBinArea(),b->GetLength(),
66 // b->GetGroup(),b->GetElement(),
70 else if ( gdcm::ValEntry *v = dynamic_cast<gdcm::ValEntry*>(d) )
74 std::cout << "Rah this DICOM contains one wrong tag:" <<
75 v->GetValue() << " " <<
76 v->GetGroup() << "," << v->GetElement() << "," <<
77 v->GetVR() << " " << v->GetVM() << " " << v->GetName() << std::endl;
82 // We skip pb of SQ recursive exploration
84 d=input->GetNextEntry();
88 } // end namespace gdcm