Selaa lähdekoodia

Changing menu location for slicerNetwork

Andrej Studen 5 vuotta sitten
vanhempi
commit
ab8f199c98
1 muutettua tiedostoa jossa 8 lisäystä ja 2 poistoa
  1. 8 2
      labkeySlicerPythonExtension/slicerNetwork.py

+ 8 - 2
labkeySlicerPythonExtension/slicerNetwork.py

@@ -306,12 +306,18 @@ class labkeyURIHandler(slicer.vtkURIHandler):
         return ('VolumeFile','SegmentationFile','TransformFile')
 
     #mimic slicer.util.loadNodeFromFile
-    def loadNode(self, relativeName, filetype, properties={}, returnNode=False):
+    def loadNode(self, relativeName, filetype, properties={},returnNode=False):
          #this is the only relevant part - file must be downloaded to cache
          #labkeyName is just the relative part (from labkey onwards)
          localPath=self.DownloadFileToCache(relativeName)
          print localPath
-         slicer.util.loadNodeFromFile(localPath,filetype,properties,returnNode)
+         if not returnNode:
+             slicer.util.loadNodeFromFile(localPath,filetype,properties,returnNode=False)
+             return
+         ok,node=slicer.util.loadNodeFromFile(localPath,filetype,properties,returnNode=True)
+         if ok:
+            return node
+         return None
     #     #remove retrieved file