pydicom.sequence.Sequence

class pydicom.sequence.Sequence(iterable: Iterable[Dataset] | None = None)[source]

Class to hold multiple Dataset in a list.

__init__(iterable: Iterable[Dataset] | None = None) None[source]

Initialize a list of Dataset.

Parameters:

iterable (Iterable[Dataset] | None) – An iterable object (e.g. list, tuple) containing Dataset. If not used then an empty Sequence is generated.

Methods

__init__([iterable])

Initialize a list of Dataset.

append(item)

Append an item.

clear()

count(value)

extend(val)

Extend the Sequence using an iterable of Dataset instances.

index(value, [start, [stop]])

Raises ValueError if the value is not present.

insert(position, item)

Insert an item at position.

pop([index])

Raise IndexError if list is empty or index is out of range.

remove(value)

S.remove(value) -- remove first occurrence of value.

reverse()

S.reverse() -- reverse IN PLACE

append(item: T) None[source]

Append an item.

clear() None -- remove all items from S[source]
count(value) integer -- return number of occurrences of value[source]
extend(val: Iterable[Dataset]) None[source]

Extend the Sequence using an iterable of Dataset instances.

index(value[, start[, stop]]) integer -- return first index of value.[source]

Raises ValueError if the value is not present.

Supporting start and stop arguments is optional, but recommended.

insert(position: int, item: T) None[source]

Insert an item at position.

pop([index]) item -- remove and return item at index (default last).[source]

Raise IndexError if list is empty or index is out of range.

remove(value)[source]

S.remove(value) – remove first occurrence of value. Raise ValueError if the value is not present.

reverse()[source]

S.reverse() – reverse IN PLACE