dbdicom.copy_to#

dbdicom.copy_to(records: list, parent: Record)[source]#

Copy a list of records to a new parent.

Parameters:
  • records (list) – list of Records of the same type

  • parent (Record) – location for the copies.

See also

copy move_to

Example

Consider the hollywood demo database:

>>> database = db.dro.database_hollywood()

There are currently two MRI studies in the database:

>>> MRIs = database.studies(StudyDescription='MRI)
>>> len(MRIs)
2

Create a new patient and copy the MRI studies there:

>>> tarantino = database.new_patient(PatientName='Tarantino')
>>> db.copy_to(MRIs, tarantino)
>>> tarantino_MRIs = tarantino.studies()
>>> len(tarantino_MRIs)
2

Note that all header information is automatically updated:

>>> tarantino_MRIs[0].PatientName
Tarantino

Since the studies were copied, the originals remained and the total number of studies in the database has increased:

>>> MRIs = database.studies(StudyDescription='MRI)
>>> len(MRIs)
4