pydicom.values.convert_DS_string¶
- pydicom.values.convert_DS_string(byte_string, is_little_endian, struct_format=None)¶
Return a decoded ‘DS’ value.
Changed in version 2.0: The option to return numpy values was added.
- Parameters
byte_string (bytes or str) – The encoded ‘DS’ element value.
is_little_endian (bool) –
True
if the value is encoded as little endian,False
otherwise.struct_format (str, optional) – Not used.
- Returns
If
use_DS_decimal
isFalse
(default), returns aDSfloat
or list of themIf
use_DS_decimal
isTrue
, returns aDSdecimal
or list of themIf
use_DS_numpy
isTrue
, returns anumpy.float64
or anumpy.ndarray
of them- Return type
DSfloat
,DSdecimal
,numpy.float64
, list of DSfloat/DSdecimal ornumpy.ndarray
ofnumpy.float64
- Raises
ValueError – If
use_DS_numpy
isTrue
and the string contains non-valid charactersImportError – If
use_DS_numpy
isTrue
and numpy is not available