dbdicom.Record.patients#

Record.patients(sort=True, sortby=['PatientName'], **kwargs) list[source]#

Return a list of patients under the record.

If the record is a database, this returns the children. If it is a series or a study, this returns the parent patient.

Parameters:
  • sort (bool, optional) – Set to False to return an unsorted list (faster). Defaults to True.

  • sortby (list, optional) – list of DICOM keywords to sort the result. This argument is ignored if sort=False. Defaults to [‘PatientName’].

  • kwargs (keyword arguments, optional) – Set any number of valid DICOM (tag, value) pairs as keywords to filer the list. The result will only contain patients with the appropriate values.

Returns:

A list of dbdicom Patient objects.

Return type:

list

Example

Find all patients in a database:

>>> database = db.database_hollywood()
>>> patients_list = database.patients()
>>> print([s.label() for s in patients_list])
['Patient James Bond', 'Patient Scarface']

Find all patients with a given name:

>>> patients_list = database.patients(PatientName='James Bond')
>>> print([s.label() for s in patients_list])
['Patient James Bond']