pydicom.values.convert_DS_string¶
-
pydicom.values.
convert_DS_string
(byte_string: bytes, is_little_endian: bool, struct_format: Optional[str] = None) → Union[pydicom.valuerep.DSfloat, pydicom.valuerep.DSdecimal, Sequence[Union[pydicom.valuerep.DSfloat, pydicom.valuerep.DSdecimal]], numpy.float64, numpy.ndarray][source]¶ Return a decoded ‘DS’ value.
Changed in version 2.0: The option to return numpy values was added.
- Parameters
- 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
, MultiValue 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