dbdicom.Record.new_series#

Record.new_series(**kwargs)[source]#

Create a new series.

Parameters:

kwargs (optional) – Any valid DICOM (tag, value) pair can be assigned up front as properties of the new series.

Returns:

instance of the new series

Return type:

Series

Example

Consider an empty study:

>>> fMRI = db.study(StudyDescription='fMRI', StudyDate='20230203')
>>> fMRI.print()
---------- STUDY ---------------
Study fMRI [20230203]
--------------------------------

Create two new series in the study:

>>> rstate = fMRI.new_series(SeriesDescription='Resting state')
>>> ftap = fMRI.new_series(SeriesDescription='Finger tap')
>>> fMRI.print()
---------- STUDY ---------------
Study fMRI [20230203]
    Series 001 [Resting state]
        Nr of instances: 0
    Series 002 [Finger tap]
        Nr of instances: 0
--------------------------------

Any other record can also create a new series. Missing intermediate generations are created automatically:

>>> database = db.database()
>>> database.print()
---------- DATABASE --------------
Location:  In memory
----------------------------------
>>> rstate = database.new_series(SeriesDescription='Resting state')
>>> ftap = database.new_series(SeriesDescription='Finger tap')
>>> database.print()
---------- DATABASE --------------
Location:  In memory
Patient New Patient
    Study New Study [None]
        Series 001 [Resting state]
            Nr of instances: 0
Patient New Patient
    Study New Study [None]
        Series 001 [Finger tap]
            Nr of instances: 0
----------------------------------

Note since any missing levels in the hierarchy are automatically created, these new series now end up in different patients.