muratmaga
(Murat Maga)
October 2, 2022, 11:25pm
9
See the source of ImportFromURL module in SlicerMorph. You need to have the correct storageNode to store the downloaded data (assuming your goal is not just to download but open it in Slicer).
class ImportFromURLLogic(ScriptedLoadableModuleLogic):
"""This class should implement all the actual
computation done by your module. The interface
should be such that other python code can import
this class and make use of the functionality without
requiring an instance of the Widget.
Uses ScriptedLoadableModuleLogic base class, available at:
https://github.com/Slicer/Slicer/blob/master/Base/Python/slicer/ScriptedLoadableModule.py
"""
def runImport(self, url, fileNames, nodeNames):
filename, extension = os.path.splitext(fileNames)
if(extension in ['.zip']):
fileTypes = 'ZipFile'
elif(extension in ['.mrb'] ):
fileTypes = 'SceneFile'
elif(extension in ['.dcm', '.nrrd', '.nii', '.mhd', '.mha', '.hdr', '.img', '.bmp', '.jpg', '.jpeg', '.png', '.tif', '.tiff']):
fileTypes = 'VolumeFile'
elif(extension == '.gz'):
subfilename, subextension = os.path.splitext(filename)
if subextension == '.nii':
This file has been truncated. show original