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 is False (default), returns a DSfloat or list of them

If use_DS_decimal is True, returns a DSdecimal or list of them

If use_DS_numpy is True, returns a numpy.float64 or a numpy.ndarray of them

Return type

DSfloat, DSdecimal, numpy.float64, list of DSfloat/DSdecimal or numpy.ndarray of numpy.float64

Raises
  • ValueError – If use_DS_numpy is True and the string contains non-valid characters

  • ImportError – If use_DS_numpy is True and numpy is not available