def examineForImport(self, fileLists):
        """ Returns a list of qSlicerDICOMLoadable
    instances corresponding to ways of interpreting the 
    fileLists parameter.
    """
        # Create loadables for each file list
        loadables = []
        for fileList in fileLists:  # Each file list corresponds to one series, so do loadables
            # Convert file list to VTK object to be able to pass it for examining
            # (VTK class cannot have Qt object as argument, otherwise it is not python wrapped)
            vtkFileList = vtk.vtkStringArray()
            for file in fileList:
                vtkFileList.InsertNextValue(slicer.util.toVTKString(file))

            # Examine files
            loadablesCollection = vtk.vtkCollection()
            slicer.modules.dicomrtimportexport.logic().ExamineForLoad(
                vtkFileList, loadablesCollection)

            for loadableIndex in xrange(
                    0, loadablesCollection.GetNumberOfItems()):
                vtkLoadable = loadablesCollection.GetItemAsObject(
                    loadableIndex)
                # Create Qt loadable if confidence is greater than 0
                if vtkLoadable.GetConfidence() > 0:
                    # Convert to Qt loadable to pass it back
                    qtLoadable = slicer.qSlicerDICOMLoadable()
                    qtLoadable.copyFromVtkLoadable(vtkLoadable)
                    qtLoadable.tooltip = 'Valid RT object in selection'
                    qtLoadable.selected = True
                    loadables.append(qtLoadable)

        return loadables
  def examineForImport(self,fileLists):
    """ Returns a list of qSlicerDICOMLoadable
    instances corresponding to ways of interpreting the 
    fileLists parameter.
    """
    # Create loadables for each file list
    loadables = []
    for fileList in fileLists: # Each file list corresponds to one series, so do loadables
      # Convert file list to VTK object to be able to pass it for examining
      # (VTK class cannot have Qt object as argument, otherwise it is not python wrapped)
      vtkFileList = vtk.vtkStringArray()
      for file in fileList:
        vtkFileList.InsertNextValue(slicer.util.toVTKString(file))

      # Examine files
      loadablesCollection = vtk.vtkCollection()
      slicer.modules.dicomrtimportexport.logic().ExamineForLoad(vtkFileList, loadablesCollection)

      for loadableIndex in xrange(0,loadablesCollection.GetNumberOfItems()):
        vtkLoadable = loadablesCollection.GetItemAsObject(loadableIndex)
        # Create Qt loadable if confidence is greater than 0
        if vtkLoadable.GetConfidence() > 0:
          # Convert to Qt loadable to pass it back
          qtLoadable = slicer.qSlicerDICOMLoadable()
          qtLoadable.copyFromVtkLoadable(vtkLoadable)
          qtLoadable.tooltip = 'Valid RT object in selection'
          qtLoadable.selected = True
          loadables.append(qtLoadable)

    return loadables
示例#3
0
    def examine(self, fileLists):
        """ Returns a list of qSlicerDICOMLoadable instances
    corresponding to ways of interpreting the 
    fileLists parameter.
    """

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

        # Examine files
        logic = slicer.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
示例#4
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