Trouble loading a sequence programatically

Operating system: Windows 10
Slicer version: 4.11.20200930
Expected behavior: Sequence loaded from python interactor
Actual behavior: RuntimeError: Failed to load node from file

I have a tracked ultrasound file (generated using Plus) that I would like to load from the python interactor window with the eventual goal of being able to batch process similar files. When I drag and drop this file into Slicer and select Sequence Metafile it loads up great and I can do all kinds of things with it. However trying to load it with slicer.util.loadSequence results in an error (shown below). I’ve triple checked that the file actually exists and my spelling is correct. Anyone have thoughts or ideas?

Thanks

>>>yo = slicer.util.loadSequence('C:\\Users\\teres\\OneDrive\\Desktop\\TIS_0317_rayTraced.mha')
Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File "C:\Program Files\Slicer 4.11.20200930\bin\Python\slicer\util.py", line 818, in loadSequence
    return loadNodeFromFile(filename, filetype, properties)
  File "C:\Program Files\Slicer 4.11.20200930\bin\Python\slicer\util.py", line 598, in loadNodeFromFile
    raise RuntimeError(errorMessage)
RuntimeError: Failed to load node from file: C:\Users\teres\OneDrive\Desktop\TIS_0317_rayTraced.mha

Nevermind. Solved it myself.
yo = slicer.util.loadNodeFromFile('C:\\Users\\teres\\OneDrive\\Desktop\\TIS_0317_rayTraced.mha','Sequence Metafile')

2 Likes