Example #1
0
def loadNodeFromFile(filename, filetype, properties={}, returnNode=False):
  from slicer import app
  from vtk import vtkCollection
  properties['fileName'] = filename

  if returnNode:
      loadedNodes = vtkCollection()
      success = app.coreIOManager().loadNodes(filetype, properties, loadedNodes)
      return success, loadedNodes.GetItemAsObject(0)
  else:
      success = app.coreIOManager().loadNodes(filetype, properties)
      return success
 def saveNode(self,node, filename, properties={}):
   """Save 'node' data into 'filename'.
   It is the user responsability to provide the appropriate file extension.
   User has also the possibility to overwrite the fileType internally retrieved using
   method 'qSlicerCoreIOManager::fileWriterFileType(vtkObject*)'. This can be done
   by specifiying a 'fileType'attribute to the optional 'properties' dictionary.
   """
   from slicer import app
   properties["nodeID"] = node.GetID();
   properties["fileName"] = filename
   if hasattr(properties, "fileType"):
     filetype = properties["fileType"]
   else:
     filetype = app.coreIOManager().fileWriterFileType(node)
   return app.coreIOManager().saveNodes(filetype, properties)
Example #3
0
def saveScene(filename, properties={}):
  """Save the current scene.

  Based on the value of 'filename', the current scene is saved either
  as a MRML file, MRB file or directory.

  If filename ends with '.mrml', the scene is saved as a single file
  without associated data.

  If filename ends with '.mrb', the scene is saved as a MRML bundle (Zip
  archive with scene and data files).

  In every other case, the scene is saved in the directory
  specified by 'filename'. Both MRML scene file and data
  will be written to disk. If needed, directories and sub-directories
  will be created.
  """
  from slicer import app
  filetype = 'SceneFile'
  properties['fileName'] = filename
  return app.coreIOManager().saveNodes(filetype, properties)
Example #4
0
def openAddVolumeDialog():
  from slicer import app
  return app.coreIOManager().openAddVolumeDialog()
Example #5
0
def openAddVolumeDialog():
  from slicer import app
  return app.coreIOManager().openAddVolumeDialog()
Example #6
0
def loadScene(filename, clear = True):
  from slicer import app, qSlicerIO
  filetype = qSlicerIO.SceneFile
  properties = {'fileName':filename}
  return app.coreIOManager().loadNodes(filetype, properties)
Example #7
0
def loadVolume(filename):
  from slicer import app, qSlicerIO
  filetype = qSlicerIO.VolumeFile
  properties = {'fileName':filename}
  return app.coreIOManager().loadNodes(filetype, properties)
Example #8
0
def openSaveDataDialog():
  from slicer import app
  return app.coreIOManager().openSaveDataDialog()
Example #9
0
def openAddSegmentationDialog():
    from slicer import app, qSlicerFileDialog
    return app.coreIOManager().openDialog('SegmentationFile',
                                          qSlicerFileDialog.Read)
Example #10
0
def openAddTransformDialog():
  from slicer import app
  return app.coreIOManager().openAddTransformDialog()
Example #11
0
def openAddFiducialDialog():
  from slicer import app
  return app.coreIOManager().openAddFiducialDialog()
Example #12
0
def openSaveDataDialog():
  from slicer import app
  return app.coreIOManager().openSaveDataDialog()
Example #13
0
def openAddScalarOverlayDialog():
  from slicer import app
  return app.coreIOManager().openAddScalarOverlayDialog()
Example #14
0
def openAddFiberBundleDialog():
  from slicer import app
  return app.coreIOManager().openAddFiberBundleDialog()
Example #15
0
def openAddFiducialDialog():
  from slicer import app
  return app.coreIOManager().openAddFiducialDialog()
Example #16
0
def openAddColorTableDialog():
  from slicer import app
  return app.coreIOManager().openAddColorTableDialog()
Example #17
0
def openAddTransformDialog():
  from slicer import app
  return app.coreIOManager().openAddTransformDialog()
Example #18
0
def openAddScalarOverlayDialog():
  from slicer import app
  return app.coreIOManager().openAddScalarOverlayDialog()
Example #19
0
def openAddSegmentationDialog():
  from slicer import app, qSlicerFileDialog
  return app.coreIOManager().openDialog('SegmentationFile', qSlicerFileDialog.Read)
Example #20
0
def loadScene(filename, clear = True):
  filetype = 'SceneFile'
  properties = {'fileName':filename}
  return app.coreIOManager().loadNodes(filetype, properties)
Example #21
0
def openAddColorTableDialog():
  from slicer import app
  return app.coreIOManager().openAddColorTableDialog()
Example #22
0
def loadDTI(filename):
  from slicer import app, qSlicerIO
  filetype = qSlicerIO.DTIFile
  properties = {}
  return app.coreIOManager().loadNodes(filetype, properties)
Example #23
0
def openAddFiberBundleDialog():
  from slicer import app
  return app.coreIOManager().openAddFiberBundleDialog()
Example #24
0
def loadFiducialList(filename):
  from slicer import app, qSlicerIO
  filetype = qSlicerIO.FiducialListFile
  properties = {'fileName':filename}
  return app.coreIOManager().loadNodes(filetype, properties)
Example #25
0
def loadScalarOverlay(filename):
  from slicer import app, qSlicerIO
  filetype = qSlicerIO.ScalarOverlayFile
  properties = {'fileName':filename}
  return app.coreIOManager().loadNodes(filetype, properties)
Example #26
0
def loadScene(filename, clear=True):
    from slicer import app, qSlicerIO
    filetype = qSlicerIO.SceneFile
    properties = {'fileName': filename}
    return app.coreIOManager().loadNodes(filetype, properties)