1
votes

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

2

2 Answers

2
votes

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'.

2
votes

I do not fully agree to what is written. A sequence should be considered as a list of structs. A sequence consists of (list-)items each of which has the same struct(ure), i.e. attributes.

I also disagree that sequences are less relevant in image objects. The new Enhanced (CT-/MR-/XA-/US-/..) image SOP classes make heavy use of sequences to encode per frame attributes. See here.