Importing Data

To import a local repository of .dcm files, use the ImageManager’s import_path() method:

>>> from django_dicom.models import Image

>>> path = '/path/to/local/dcm/repo/'
>>> results = Image.objects.import_path(path)
Importing DICOM data: 4312image [34:24,  2.09image/s]
Successfully imported DICOM data from '/path/to/local/dcm/repo/'!
Created:        4312

>>> results
{'created': 4312, 'existing': 0}

You can verify the addition of new data to the database by querying the desired DICOM entity:

>>> from django_dicom.models import Image, Patient

>>> Image.objects.count()
4312
>>> Patient.objects.count()
3