1 /*=========================================================================
4 Module: $RCSfile: gdcmVR.cxx,v $
6 Date: $Date: 2004/11/16 14:48:19 $
7 Version: $Revision: 1.23 $
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 //-----------------------------------------------------------------------------
36 std::string filename = DictSet::BuildDictPath() + DICT_VR;
37 std::ifstream from(filename.c_str());
40 dbg.Verbose(2, "VR::VR: can't open dictionary", filename.c_str());
41 FillDefaultVRDict(vr);
52 from.getline(buff, 1024, ' ');
55 from.getline(buff, 1024, ';');
59 from.getline(buff, 1024, '\n');
70 //-----------------------------------------------------------------------------
79 //-----------------------------------------------------------------------------
83 * @param os The output stream to be written to.
85 void VR::Print(std::ostream &os)
89 for (VRHT::iterator it = vr.begin(); it != vr.end(); ++it)
91 s << "VR : " << it->first << " = " << it->second << std::endl;
96 //-----------------------------------------------------------------------------
99 * \brief Get the count for an element
100 * @param key key to count
102 int VR::Count(VRKey const & key)
104 return vr.count(key);
107 //-----------------------------------------------------------------------------
109 * \brief Simple predicate that checks wether the given argument
110 * corresponds to the Value Representation of a \ref BinEntry .
111 * This predicate is the negation of
112 * \ref VR::IsVROfGdcmStringRepresentable .
113 * @param tested value representation to check for.
115 bool VR::IsVROfGdcmBinaryRepresentable(VRKey const & tested)
117 //std::cout << "VR::IsVROfGdcmBinaryRepresentable===================="
118 // << tested << std::endl;
120 if ( tested == "unkn")
123 if ( ! Count(tested) )
125 dbg.Verbose(0, "VR::IsVROfGdcmBinaryRepresentable: tested not a VR!");
129 if ( IsVROfGdcmStringRepresentable(tested) )
131 dbg.Verbose(0, "VR::IsVROfGdcmBinaryRepresentable: binary VR !");
138 //-----------------------------------------------------------------------------
140 * \brief Simple predicate that checks wether the given argument
141 * corresponds to the Value Representation of a \ref ValEntry
142 * but NOT a \ref BinEntry.
143 * @param tested value representation to check for.
145 bool VR::IsVROfGdcmStringRepresentable(VRKey const & tested)
148 if ( ! Count(tested) )
150 dbg.Verbose(0, "VR::IsVROfGdcmStringRepresentable: tested not a VR!");
154 if ( tested == "AE" ||
178 //-----------------------------------------------------------------------------
181 //-----------------------------------------------------------------------------
184 //-----------------------------------------------------------------------------
186 } // end namespace gdcm