comparison OrthancServer/FromDcmtkBridge.cpp @ 1131:ac6bd50a8c83

author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 08 Sep 2014 17:34:33 +0200
parents 552a038f7c96
children ae9a83a6fa47
comparison
equal deleted inserted replaced
1130:baac89e6cc4b 1131:ac6bd50a8c83
86 #include <dcmtk/dcmdata/dcvrus.h> 86 #include <dcmtk/dcmdata/dcvrus.h>
87 #include <dcmtk/dcmdata/dcvrut.h> 87 #include <dcmtk/dcmdata/dcvrut.h>
88 #include <dcmtk/dcmdata/dcpixel.h> 88 #include <dcmtk/dcmdata/dcpixel.h>
89 #include <dcmtk/dcmdata/dcpixseq.h> 89 #include <dcmtk/dcmdata/dcpixseq.h>
90 #include <dcmtk/dcmdata/dcpxitem.h> 90 #include <dcmtk/dcmdata/dcpxitem.h>
91 #include <dcmtk/dcmdata/dcvrat.h>
91 92
92 93
93 #include <boost/math/special_functions/round.hpp> 94 #include <boost/math/special_functions/round.hpp>
94 #include <glog/logging.h> 95 #include <glog/logging.h>
95 #include <dcmtk/dcmdata/dcostrmb.h> 96 #include <dcmtk/dcmdata/dcostrmb.h>
232 **/ 233 **/
233 234
234 case EVR_OB: // other byte 235 case EVR_OB: // other byte
235 case EVR_OF: // other float 236 case EVR_OF: // other float
236 case EVR_OW: // other word 237 case EVR_OW: // other word
237 case EVR_AT: // attribute tag
238 case EVR_UN: // unknown value representation 238 case EVR_UN: // unknown value representation
239 return new DicomNullValue(); 239 return new DicomNullValue;
240 240
241 /** 241 /**
242 * String types, should never happen at this point because of 242 * String types, should never happen at this point because of
243 * "element.isaString()". 243 * "element.isaString()".
244 **/ 244 **/
256 case EVR_ST: // short text 256 case EVR_ST: // short text
257 case EVR_LT: // long text 257 case EVR_LT: // long text
258 case EVR_UT: // unlimited text 258 case EVR_UT: // unlimited text
259 case EVR_PN: // person name 259 case EVR_PN: // person name
260 case EVR_UI: // unique identifier 260 case EVR_UI: // unique identifier
261 return new DicomNullValue(); 261 return new DicomNullValue;
262 262
263 263
264 /** 264 /**
265 * Numerical types 265 * Numberic types
266 **/ 266 **/
267 267
268 case EVR_SL: // signed long 268 case EVR_SL: // signed long
269 { 269 {
270 Sint32 f; 270 Sint32 f;
271 if (dynamic_cast<DcmSignedLong&>(element).getSint32(f).good()) 271 if (dynamic_cast<DcmSignedLong&>(element).getSint32(f).good())
272 return new DicomString(boost::lexical_cast<std::string>(f)); 272 return new DicomString(boost::lexical_cast<std::string>(f));
273 else 273 else
274 return new DicomNullValue(); 274 return new DicomNullValue;
275 } 275 }
276 276
277 case EVR_SS: // signed short 277 case EVR_SS: // signed short
278 { 278 {
279 Sint16 f; 279 Sint16 f;
280 if (dynamic_cast<DcmSignedShort&>(element).getSint16(f).good()) 280 if (dynamic_cast<DcmSignedShort&>(element).getSint16(f).good())
281 return new DicomString(boost::lexical_cast<std::string>(f)); 281 return new DicomString(boost::lexical_cast<std::string>(f));
282 else 282 else
283 return new DicomNullValue(); 283 return new DicomNullValue;
284 } 284 }
285 285
286 case EVR_UL: // unsigned long 286 case EVR_UL: // unsigned long
287 { 287 {
288 Uint32 f; 288 Uint32 f;
289 if (dynamic_cast<DcmUnsignedLong&>(element).getUint32(f).good()) 289 if (dynamic_cast<DcmUnsignedLong&>(element).getUint32(f).good())
290 return new DicomString(boost::lexical_cast<std::string>(f)); 290 return new DicomString(boost::lexical_cast<std::string>(f));
291 else 291 else
292 return new DicomNullValue(); 292 return new DicomNullValue;
293 } 293 }
294 294
295 case EVR_US: // unsigned short 295 case EVR_US: // unsigned short
296 { 296 {
297 Uint16 f; 297 Uint16 f;
298 if (dynamic_cast<DcmUnsignedShort&>(element).getUint16(f).good()) 298 if (dynamic_cast<DcmUnsignedShort&>(element).getUint16(f).good())
299 return new DicomString(boost::lexical_cast<std::string>(f)); 299 return new DicomString(boost::lexical_cast<std::string>(f));
300 else 300 else
301 return new DicomNullValue(); 301 return new DicomNullValue;
302 } 302 }
303 303
304 case EVR_FL: // float single-precision 304 case EVR_FL: // float single-precision
305 { 305 {
306 Float32 f; 306 Float32 f;
307 if (dynamic_cast<DcmFloatingPointSingle&>(element).getFloat32(f).good()) 307 if (dynamic_cast<DcmFloatingPointSingle&>(element).getFloat32(f).good())
308 return new DicomString(boost::lexical_cast<std::string>(f)); 308 return new DicomString(boost::lexical_cast<std::string>(f));
309 else 309 else
310 return new DicomNullValue(); 310 return new DicomNullValue;
311 } 311 }
312 312
313 case EVR_FD: // float double-precision 313 case EVR_FD: // float double-precision
314 { 314 {
315 Float64 f; 315 Float64 f;
316 if (dynamic_cast<DcmFloatingPointDouble&>(element).getFloat64(f).good()) 316 if (dynamic_cast<DcmFloatingPointDouble&>(element).getFloat64(f).good())
317 return new DicomString(boost::lexical_cast<std::string>(f)); 317 return new DicomString(boost::lexical_cast<std::string>(f));
318 else 318 else
319 return new DicomNullValue(); 319 return new DicomNullValue;
320 }
321
322
323 /**
324 * Attribute tag.
325 **/
326
327 case EVR_AT:
328 {
329 OFString s;
330 if (dynamic_cast<DcmAttributeTag&>(element).getOFString(s, 0).good())
331 return new DicomString(s.c_str());
332 else
333 return new DicomNullValue;
320 } 334 }
321 335
322 336
323 /** 337 /**
324 * Sequence types, should never occur at this point because of 338 * Sequence types, should never occur at this point because of