# Load Dicom series file problems

**URL:** https://discourse.slicer.org/t/load-dicom-series-file-problems/4160
**Category:** Support
**Tags:** dicom
**Created:** [September 21, 2018, 9:45am UTC](https://discourse.slicer.org/t/load-dicom-series-file-problems/4160 "2018-09-21T09:45:57Z")
**Posts on this page:** 1
**Showing post:** 2

<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: [September 21, 2018, 11:43am UTC](https://discourse.slicer.org/t/load-dicom-series-file-problems/4160/2 "2018-09-21T11:43:41Z")

</div>

You get the file list by calling `filelist=os.listdir(path)`, which returns the files in some random order (how they are ordered in the file system). See this topic about how to do it correctly:

> [@Load DICOM series using python](https://discourse.slicer.org/t/load-dicom-series-using-python/3257):
>
> Hi I am trying to create a python script that can import a DICOM image series from a folder, however I can’t seem to find a way to make this work. I can load a single DICOM file (in my case an RTSTRUCT) using this code: contour\_fn = 'contours.dcm' # Add filename to list for DICOM-RT module contour\_vtkFileList = vtk.vtkStringArray() contour\_vtkFileList.InsertNextValue(slicer.util.toVTKString(contour\_fn)) # Examine files contour\_loadablesCollection = vtk.vtkCollection() slicer.modules…

---

_[View the full topic](https://discourse.slicer.org/t/load-dicom-series-file-problems/4160)._
