pydicom.dataelem.convert_raw_data_element¶
- pydicom.dataelem.convert_raw_data_element(raw: RawDataElement, *, encoding: str | MutableSequence[str] | None = None, ds: Dataset | None = None) DataElement[source]¶
- Return a - DataElementcreated from raw.- Added in version 3.0. - Customization Hooks - All callback functions for - convert_raw_data_element()use the function signature:- def func( raw: RawDataElement, data: dict[str, Any], *, encoding: str | MutableSequence[str] | None = None, ds: pydicom.dataset.Dataset | None = None, **kwargs: dict[str, Any], ) -> None: ... - Where raw, encoding and ds are the objects passed to this function, data is a - dictthat’s persistent for each raw element and is used to store the results of the corresponding callback functions, and kwargs are keyword arguments passed by setting the- "raw_element_kwargs"hook via- register_kwargs().- Available - hooksare (in order of execution):- "raw_element_vr": a function to perform the VR lookup for the raw element, required to add- {"VR": str}to data.
- "raw_element_value": a function to perform the conversion of the raw element- bytesvalue to an appropriate type (such as- intfor VR US), required to add- {"value": Any}to data.
 - register_callback()is used to set the callback function for a given hook, and only one callback can be set per hook.- Parameters:
- raw (pydicom.dataelem.RawDataElement) – The raw data to convert to a - DataElement.
- encoding (str | MutableSequence[str] | None) – The character set encodings for the raw data element. 
- ds (pydicom.dataset.Dataset | None) – The parent dataset of raw. 
 
- Returns:
- A - DataElementinstance created from raw.
- Return type: