1 /*=========================================================================
4 Module: $RCSfile: gdcmVR.cxx,v $
6 Date: $Date: 2005/09/07 14:12:23 $
7 Version: $Revision: 1.40 $
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 //-----------------------------------------------------------------------------
30 /// \brief auto generated function, to fill up the 'Value Representation'
31 /// Dictionnary, if relevant file is not found on user's disk
32 void FillDefaultVRDict(VRHT &vr);
34 //-----------------------------------------------------------------------------
35 // Constructor / Destructor
41 std::string filename = DictSet::BuildDictPath() + DICT_VR;
42 std::ifstream from(filename.c_str());
45 gdcmWarningMacro("Can't open dictionary" << filename.c_str());
46 FillDefaultVRDict(vr);
57 from.getline(buff, 1024, ' ');
60 from.getline(buff, 1024, ';');
64 from.getline(buff, 1024, '\n');
83 //-----------------------------------------------------------------------------
87 * \brief Simple predicate that checks whether the given argument
88 * corresponds to the Value Representation of a \ref BinEntry .
89 * @param tested value representation to check for.
91 bool VR::IsVROfBinaryRepresentable(VRKey const &tested)
93 //if ( tested == GDCM_UNKNOWN)
95 //std::cout << "---------- never used --------------" << tested
100 if ( IsVROfStringRepresentable(tested) )
103 if ( IsVROfSequence(tested) )
110 * \brief Simple predicate that checks whether the given argument
111 * corresponds to the Value Representation of a \ref ValEntry
112 * but NOT a \ref BinEntry.
113 * @param tested value representation to be checked.
115 bool VR::IsVROfStringRepresentable(VRKey const &tested)
119 return tested == "AE" ||
138 // Should be quicker --> But it doesn't work : revert to old code
140 return tested != "FL" &&
144 tested != "AT" && // Attribute Tag ?!?
149 //-----------------------------------------------------------------------------
152 //-----------------------------------------------------------------------------
155 //-----------------------------------------------------------------------------
159 * @param os The output stream to be written to.
161 void VR::Print(std::ostream &os)
163 std::ostringstream s;
165 for (VRHT::iterator it = vr.begin(); it != vr.end(); ++it)
167 s << "VR : " << it->first << " = " << it->second << std::endl;
172 //-----------------------------------------------------------------------------
173 } // end namespace gdcm