1 /*=========================================================================
4 Module: $RCSfile: gdcmVR.cxx,v $
6 Date: $Date: 2005/01/28 17:01:30 $
7 Version: $Revision: 1.33 $
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 =========================================================================*/
21 #include "gdcmDictSet.h"
22 #include "gdcmDebug.h"
29 void FillDefaultVRDict(VRHT &vr);
30 //-----------------------------------------------------------------------------
37 std::string filename = DictSet::BuildDictPath() + DICT_VR;
38 std::ifstream from(filename.c_str());
41 gdcmVerboseMacro("Can't open dictionary" << filename.c_str());
42 FillDefaultVRDict(vr);
53 from.getline(buff, 1024, ' ');
56 from.getline(buff, 1024, ';');
60 from.getline(buff, 1024, '\n');
71 //-----------------------------------------------------------------------------
80 //-----------------------------------------------------------------------------
84 * @param os The output stream to be written to.
86 void VR::Print(std::ostream &os)
90 for (VRHT::iterator it = vr.begin(); it != vr.end(); ++it)
92 s << "VR : " << it->first << " = " << it->second << std::endl;
97 //-----------------------------------------------------------------------------
100 * \brief Get the count for an element
101 * @param key key to count
103 int VR::Count(VRKey const &key)
105 return vr.count(key);
108 //-----------------------------------------------------------------------------
110 * \brief Simple predicate that checks whether the given argument
111 * corresponds to the Value Representation of a \ref BinEntry .
112 * @param tested value representation to check for.
114 bool VR::IsVROfBinaryRepresentable(VRKey const &tested)
116 if ( tested == GDCM_UNKNOWN)
119 if ( IsVROfStringRepresentable(tested) )
122 if ( IsVROfSequence(tested) )
129 * \brief Simple predicate that checks whether the given argument
130 * corresponds to the Value Representation of a \ref ValEntry
131 * but NOT a \ref BinEntry.
132 * @param tested value representation to be checked.
134 bool VR::IsVROfStringRepresentable(VRKey const &tested)
136 return tested == "AE" ||
157 * \brief Simple predicate that checks whether the given argument
158 * corresponds to the Value Representation of a \ref SeqEntry
159 * @param tested value representation to check for.
161 bool VR::IsVROfSequence(VRKey const &tested)
163 return tested == "SQ";
166 bool VR::IsValidVR(VRKey const &key)
168 return vr.find(key) != vr.end();
171 //-----------------------------------------------------------------------------
174 //-----------------------------------------------------------------------------
177 //-----------------------------------------------------------------------------
179 } // end namespace gdcm