1 /*=========================================================================
4 Module: $RCSfile: gdcmVR.cxx,v $
6 Date: $Date: 2004/06/20 18:08:48 $
7 Version: $Revision: 1.13 $
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.htm 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 =========================================================================*/
25 #include "gdcmDictSet.h"
26 #include "gdcmDebug.h"
28 //-----------------------------------------------------------------------------
34 std::string filename=gdcmDictSet::BuildDictPath() + std::string(DICT_VR);
35 std::ifstream from(filename.c_str());
36 dbg.Error(!from, "gdcmVR::gdcmVR: can't open dictionary",filename.c_str());
45 from.getline(buff, 1024, ' ');
48 from.getline(buff, 1024, ';');
52 from.getline(buff, 1024, '\n');
69 //-----------------------------------------------------------------------------
73 * @param os The output stream to be written to.
75 void gdcmVR::Print(std::ostream &os)
79 for (VRHT::iterator it = vr.begin(); it != vr.end(); ++it)
81 s << "VR : "<<it->first<<" = "<<it->second<<std::endl;
86 //-----------------------------------------------------------------------------
89 * \brief Get the count for an element
90 * @param key key to count
92 int gdcmVR::Count(VRKey key)
98 * \brief Simple predicate that checks wether the given argument
99 * corresponds to the Value Representation of a \ref gdcmBinEntry .
100 * This predicate is the negation of
101 * \ref gdcmVR::IsVROfGdcmStringRepresentable .
102 * @param tested value represenation to check for.
104 bool gdcmVR::IsVROfGdcmBinaryRepresentable(VRKey tested)
106 if ( ! Count(tested) )
108 dbg.Verbose(0, "gdcmVR::IsVROfGdcmBinaryRepresentable: tested not a VR!");
112 if ( IsVROfGdcmStringRepresentable(tested) )
114 dbg.Verbose(0, "gdcmVR::IsVROfGdcmBinaryRepresentable: binary VR !");
122 * \brief Simple predicate that checks wether the given argument
123 * corresponds to the Value Representation of a \ref gdcmValEntry
124 * but NOT a \ref gdcmBinEntry.
125 * @param tested value represenation to check for.
127 bool gdcmVR::IsVROfGdcmStringRepresentable(VRKey tested)
129 if ( ! Count(tested) )
131 dbg.Verbose(0, "gdcmVR::IsVROfGdcmStringRepresentable: tested not a VR!");
135 if (tested == "AE" || tested == "AS" || tested == "DA" || tested == "PN" ||
136 tested == "UI" || tested == "TM" || tested == "SH" || tested == "LO" ||
137 tested == "CS" || tested == "IS" || tested == "LO" || tested == "LT" ||
138 tested == "SH" || tested == "ST" || tested == "DS" || tested == "SL" ||
139 tested == "SS" || tested == "UL" || tested == "US" )
146 //-----------------------------------------------------------------------------
149 //-----------------------------------------------------------------------------
152 //-----------------------------------------------------------------------------