# Loading DICOM files with python script for Mac

**URL:** https://discourse.slicer.org/t/loading-dicom-files-with-python-script-for-mac/12855
**Category:** Support
**Created:** [August 4, 2020, 4:52pm UTC](https://discourse.slicer.org/t/loading-dicom-files-with-python-script-for-mac/12855 "2020-08-04T16:52:38Z")
**Posts on this page:** 1
**Showing post:** 3

<div class="post-metadata">

### Author: ![epearlstone](https://avatars.discourse-cdn.com/v4/letter/e/7ab992/32.png) [@epearlstone](https://discourse.slicer.org/u/epearlstone)
#### Post date: [August 4, 2020, 5:43pm UTC](https://discourse.slicer.org/t/loading-dicom-files-with-python-script-for-mac/12855/3 "2020-08-04T17:43:29Z")

</div>

I am expecting my folder full of dcm files to be imported as they would normally when using the DICOM import GUI (which works well. I am simply trying to practice using this scripting method). I am using the latest version of Slicer 4.11.0 and Python 3.6.7. I will attach a picture of my Slicer screen. No error is being given with my current implementation but nothing is happening. No files are loaded.  
I am using the script provided in the python script [repository](https://www.slicer.org/wiki/Documentation/Nightly/ScriptRepository#How_to_load_DICOM_files_into_the_scene_from_a_folder) given below:

> How to load DICOM files into the scene from a folder  
> This code loads all DICOM objects into the scene from a file folder. All the registered plugins are evaluated and the one with the highest confidence will be used to load the data. Files are imported into a temporary DICOM database, so the current Slicer DICOM database is not impacted.

```python
dicomDataDir = "c:/my/folder/with/dicom-files" # input folder with DICOM files
loadedNodeIDs = [] # this list will contain the list of all loaded node IDs
  
from DICOMLib import DICOMUtils
with DICOMUtils.TemporaryDICOMDatabase() as db:
  DICOMUtils.importDicom(dicomDataDir, db)
  patientUIDs = db.patients()
  for patientUID in patientUIDs:
    loadedNodeIDs.extend(DICOMUtils.loadPatientByUID(patientUID))

```

---

_[View the full topic](https://discourse.slicer.org/t/loading-dicom-files-with-python-script-for-mac/12855)._
