pydicom.valuerep.DS(val: Union[None, str, int, float, Decimal], auto_format: bool = False, validation_mode: Optional[int] = None) Union[None, str, DSfloat, DSdecimal][source]

Factory function for creating DS class instances.

Checks for blank string; if so, returns that, else calls DSfloat or DSdecimal to create the class instance. This avoids overriding DSfloat.__new__() (which carries a time penalty for large arrays of DS).

Similarly the string clean and check can be avoided and DSfloat called directly if a string has already been processed.