I am having the following problems under Windows when programmatically loading a volume. Always the wrong volume is loaded into Slicer. The directory that I shared here has two volumes:
a. MRI Prostate image (two files)
b. ZFrame template (one file)
Please try the following on Windows:
load prostate image
This is supposed to load the prostate volume, but it doesn’t. It loads the template image which is located in the same directory.
prostateVolume = slicer.util.loadVolume(‘a000001.dcm’, returnNode=True)
I’ve debugged into this and the problem is caused by using backslash path separator character or drive letter capitalization. I’ve made file comparison mechanism more robust (normalizing filenames before comparison) in r26146, which should fix the problem.
I didn’t realize this is going on. I would definitely switch to the DICOM plugin. Most likely, that util function is just using straight ITK reader, since it is the same call that is used to read non-DICOM data.
Ultimately, scalar images are always read by ITK reader. The difference is how the list of files is determined and how they deal with inconsistencies (varying spacing, non-parallel slices, etc).
ScalarVolume DICOM plugin requires a list of files (files may spread across various folders) and the plugin sorts all the files and provides the file list to the ITK reader.
When you load a DICOM volume using slicer.util.loadVolume then the ITK reader receives only a single filename and the ITK reader determines the file list (it considers filenames in the same folder, checks series UID match, and sorts based on image position patient).