# Imported dicom files do not show in the dicomDatabase

**URL:** <https://discourse.slicer.org/t/imported-dicom-files-do-not-show-in-the-dicomdatabase/2651>\
**Category:** Development\
**Created:** [April 20, 2018, 9:52pm UTC](https://discourse.slicer.org/t/imported-dicom-files-do-not-show-in-the-dicomdatabase/2651 "2018-04-20T21:52:27Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![EricWilson](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/ericwilson/32/1513_2.png) [@EricWilson](https://discourse.slicer.org/u/EricWilson)\
**Post date:** [April 20, 2018, 9:52pm UTC](https://discourse.slicer.org/t/imported-dicom-files-do-not-show-in-the-dicomdatabase/2651/1 "2018-04-20T21:52:27Z")

</div>

I am attempting to take a series of dicom files, import them to slicer, then iterate over them to get the first file to use for data. currently, I have an issue where the import method I am using will get the data in the files properly and will display the volume in the 3 views, but If the dicomDatabase does not already have the patient, no patient will display there. the functions for iteration over the data also return no patient data. if the patient is already in the database from being imported manually, everything will work as expected.

this is the method i am currently using:

path = ‘PATH\_TO\_DIR’  
ctk.ctkDICOMIndexer().addDirectory(slicer.dicomDatabase, path)  
db = slicer.dicomDatabase  
for patient in db.patients():  
for study in db.studiesForPatient(patient):  
for series in db.seriesForStudy(study):  
files = db.filesForSeries(series)

I’ve been looking through the source for the DICOM and DICOMLib scripts, but most things I have found related to the database are only done through the widget rather than the logic.

What is the best way to do this, and trigger the update on the dicomDatabase with the new directory?

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [April 21, 2018, 5:11am UTC](https://discourse.slicer.org/t/imported-dicom-files-do-not-show-in-the-dicomdatabase/2651/2 "2018-04-21T05:11:36Z")

</div>

You can import DICOM files to the database by using `DICOMUtils.LoadDICOMFilesToDatabase`. You can use this automated test as an example: [https://github.com/SlicerRt/SlicerRT/blob/master/BatchProcessing/BatchStructureSetConversion.py](https://github.com/SlicerRt/SlicerRT/blob/master/BatchProcessing/BatchStructureSetConversion.py)
