Search code examples
pythondicompydicom

What is the purpose of pydicom Sequence class?


I cannot understand what is the purpose of the class Sequence in pydicom.

I read the example provided on the documentation page of pydicom: https://pydicom.github.io/pydicom/stable/auto_examples/metadata_processing/plot_sequences.html#sphx-glr-auto-examples-metadata-processing-plot-sequences-py

It seems to be nothing more than a list of Dataset.

Furthermore, it is described in the example as an element of the Dataset class, and I do not understand if it required or not.

Does anyone has already used this?

Thanks


Solution

  • From https://pydicom.github.io/pydicom/stable/base_element.html#sequence

    Sequence is derived from Python’s list. The only added functionality is to make string representations prettier. Otherwise all the usual methods of list like item selection, append, etc. are available.

    So it is basically just a python list.

    Furthermore, it is described in the example as an element of the Dataset class, and I do not understand if it required or not.

    A Sequence is one possible value of a DataElement in a Dataset - those data elements with value representation (VR) of 'SQ'.