pynetdicom.dsutils.encode

pynetdicom.dsutils.encode(ds, is_implicit_vr, is_little_endian)

Encode a pydicom Dataset ds to bytes.

Parameters:
  • ds (pydicom.dataset.Dataset) – The dataset to encode
  • is_implicit_vr (bool) – The element encoding scheme the dataset will be encoded with.
  • is_little_endian (bool) – The byte ordering the dataset will be encoded in.
Returns:

The encoded dataset as bytes (if successful) or None if the encoding failed.

Return type:

bytes or None