2 //-----------------------------------------------------------------------------
9 #include "gdcmDictSet.h"
10 #include "gdcmDebug.h"
12 //-----------------------------------------------------------------------------
18 std::string filename=gdcmDictSet::BuildDictPath() + std::string(DICT_VR);
19 std::ifstream from(filename.c_str());
20 dbg.Error(!from, "gdcmVR::gdcmVR: can't open dictionary",filename.c_str());
29 from.getline(buff, 1024, ' ');
32 from.getline(buff, 1024, ';');
36 from.getline(buff, 1024, '\n');
53 //-----------------------------------------------------------------------------
57 * @param os The output stream to be written to.
59 void gdcmVR::Print(std::ostream &os)
63 for (VRHT::iterator it = vr.begin(); it != vr.end(); ++it)
65 s << "VR : "<<it->first<<" = "<<it->second<<std::endl;
70 //-----------------------------------------------------------------------------
73 * \brief Get the count for an element
74 * @param key key to count
76 int gdcmVR::Count(VRKey key)
82 * \brief Simple predicate that checks wether the given argument
83 * corresponds to the Value Representation of a \ref gdcmBinEntry .
84 * This predicate is the negation of
85 * \ref gdcmVR::IsVROfGdcmStringRepresentable .
86 * @param tested value represenation to check for.
88 bool gdcmVR::IsVROfGdcmBinaryRepresentable(VRKey tested)
90 if ( ! Count(tested) )
92 dbg.Verbose(0, "gdcmVR::IsVROfGdcmBinaryRepresentable: tested not a VR!");
96 if ( IsVROfGdcmStringRepresentable(tested) )
98 dbg.Verbose(0, "gdcmVR::IsVROfGdcmBinaryRepresentable: binary VR !");
106 * \brief Simple predicate that checks wether the given argument
107 * corresponds to the Value Representation of a \ref gdcmValEntry
108 * but NOT a \ref gdcmBinEntry.
109 * @param tested value represenation to check for.
111 bool gdcmVR::IsVROfGdcmStringRepresentable(VRKey tested)
113 if ( ! Count(tested) )
115 dbg.Verbose(0, "gdcmVR::IsVROfGdcmStringRepresentable: tested not a VR!");
119 if (tested == "AE" || tested == "AS" || tested == "DA" || tested == "PN" ||
120 tested == "UI" || tested == "TM" || tested == "SH" || tested == "LO" ||
121 tested == "CS" || tested == "IS" || tested == "LO" || tested == "LT" ||
122 tested == "SH" || tested == "ST" || tested == "DS" || tested == "SL" ||
123 tested == "SS" || tested == "UL" || tested == "US" )
130 //-----------------------------------------------------------------------------
133 //-----------------------------------------------------------------------------
136 //-----------------------------------------------------------------------------