MCPcopy Create free account
hub / github.com/DentonW/DevIL / GetNumericValue

Function GetNumericValue

DevIL/src-IL/src/il_dicom.cpp:375–414  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

373
374
375ILboolean GetNumericValue(DICOMHEAD *Header, ILushort GroupNum, ILuint *Number)
376{
377 ILubyte VR1, VR2;
378 ILushort ValLen;
379
380 // 2 byte character string telling what type this element is ('OB', 'UI', etc.)
381 VR1 = igetc();
382 VR2 = igetc();
383
384 if (VR1 == 'U' && VR2 == 'S') { // Unsigned short
385 ValLen = GetShort(Header, GroupNum);//GetLittleUShort();
386 if (ValLen != 2) // Must always be 2 for short ('US')
387 return IL_FALSE;
388 *((ILushort*)Number) = GetShort(Header, GroupNum);//GetLittleUShort();
389 return IL_TRUE;
390 }
391 if (VR1 == 'U' && VR2 == 'L') { // Unsigned long
392 ValLen = GetInt(Header, GroupNum);//GetLittleUInt();
393 if (ValLen != 4) // Must always be 4 for long ('UL')
394 return IL_FALSE;
395 *Number = GetInt(Header, GroupNum);
396 return IL_TRUE;
397 }
398 if (VR1 == 'S' && VR2 == 'S') { // Signed short
399 ValLen = GetShort(Header, GroupNum);
400 if (ValLen != 2) // Must always be 2 for short ('US')
401 return IL_FALSE;
402 *((ILshort*)Number) = GetShort(Header, GroupNum);
403 return IL_TRUE;
404 }
405 if (VR1 == 'S' && VR2 == 'L') { // Signed long
406 ValLen = GetInt(Header, GroupNum);
407 if (ValLen != 4) // Must always be 4 for long ('UL')
408 return IL_FALSE;
409 *((ILint*)Number) = GetInt(Header, GroupNum);
410 return IL_TRUE;
411 }
412
413 return IL_FALSE;
414}
415
416
417ILboolean GetUID(ILubyte *UID)

Callers 1

iGetDicomHeadFunction · 0.85

Calls 2

GetShortFunction · 0.85
GetIntFunction · 0.85

Tested by

no test coverage detected