Example #1
0
  def load(self,loadable):
    """Load the selection as an RT object
    using the DicomSroImport module
    """
    success = False

    # Export file lists to DicomExamineInfo
    import vtkSlicerDicomSroImportModuleLogic
    loadInfo = vtkSlicerDicomSroImportModuleLogic.vtkDICOMImportInfo()
    fileListIndex = loadInfo.InsertNextFileList() 
    fileList = loadInfo.GetFileList(fileListIndex) # vtk.vtkStringArray()      
    for f in loadable.files:
      fileList.InsertNextValue(f) 
    loadInfo.InsertNextLoadable(fileList, loadable.name, loadable.tooltip, loadable.warning, loadable.selected, loadable.confidence)

    logic = vtkSlicerDicomSroImportModuleLogic.vtkSlicerDicomSroImportModuleLogic()
    #logic = slicer.modules.DicomSroimport.logic()
    logic.SetMRMLScene(slicer.mrmlScene)
    if logic.LoadDicomSro(loadInfo):
      success = True

    return success
Example #2
0
  def examine(self,fileLists):
    """ Returns a list of qSlicerDICOMLoadable instances
    corresponding to ways of interpreting the 
    fileLists parameter.
    """    
    import vtkSlicerDicomSroImportModuleLogic

    # Export file lists to DicomExamineInfo
    examineInfo = vtkSlicerDicomSroImportModuleLogic.vtkDICOMImportInfo()
    for files in fileLists:
      fileListIndex = examineInfo.InsertNextFileList() 
      fileList = examineInfo.GetFileList(fileListIndex) # vtk.vtkStringArray()  	  
      for f in files:
        fileList.InsertNextValue(f)	

    # Examine files
    logic = vtkSlicerDicomSroImportModuleLogic.vtkSlicerDicomSroImportModuleLogic()
    #logic = slicer.modules.DicomSroimport.logic()
    print "reg inside examine"
    logic.Examine(examineInfo)	
    
    # Import loadables from DicomExamineInfo
    loadables = []
    for loadableIndex in xrange(examineInfo.GetNumberOfLoadables()):
      loadable = slicer.qSlicerDICOMLoadable()
      loadableFilesVtk = examineInfo.GetLoadableFiles(loadableIndex)
      loadableFilesPy = []
      for fileIndex in xrange(loadableFilesVtk.GetNumberOfValues()):
        loadableFilesPy.append(loadableFilesVtk.GetValue(fileIndex))
      loadable.files = loadableFilesPy

      name = examineInfo.GetLoadableName(loadableIndex)
      loadable.name = name
      loadable.tooltip = examineInfo.GetLoadableTooltip(loadableIndex)
      loadable.selected = examineInfo.GetLoadableSelected(loadableIndex)
      loadable.confidence = examineInfo.GetLoadableConfidence(loadableIndex)
      loadables.append(loadable)

    return loadables