dbdicom.Record.new_patient#

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

Create a new patient.

Parameters:

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

Returns:

instance of the new patient

Return type:

Patient

Example

Create a new patient in a database:

>>> database = db.database()
>>> database.print()
---------- DATABASE --------------
Location:  In memory
----------------------------------
>>> nemo = database.new_patient(PatientName='Nemo')
>>> dory = database.new_patient(PatientName='Dory')
>>> database.print()
---------- DATABASE --------------
Location:  In memory
Patient Dory
Patient Nemo
----------------------------------

A lower-level record can also create a new patient. Create a new series and show its default database:

>>> series = db.series()
>>> series.database().print()
---------- DATABASE --------------
Location:  In memory
    Patient New Patient
        Study New Study [None]
        Series 001 [New Series]
            Nr of instances: 0
----------------------------------

The series can create new patients in its database directly:

>>> dory = series.new_patient(PatientName='Dory')
>>> nemo = series.new_patient(PatientName='Nemo')
>>> series.print()
---------- DATABASE --------------
Location:  In memory
    Patient Dory
    Patient Nemo
    Patient New Patient
        Study New Study [None]
            Series 001 [New Series]
                Nr of instances: 0
----------------------------------