def load(self, loadable):
        """Load the selection as an RT object
    using the DICOMSpatialRegistrationImport module
    """
        success = False

        # Export file lists to DicomExamineInfo
        import vtkSlicerDICOMSpatialRegistrationImportModuleLogic

        loadInfo = vtkSlicerDICOMSpatialRegistrationImportModuleLogic.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 = vtkSlicerDICOMSpatialRegistrationImportModuleLogic.vtkSlicerDICOMSpatialRegistrationImportModuleLogic()
        # logic = slicer.modules.dicomspatialregistrationimport.logic()
        logic.SetMRMLScene(slicer.mrmlScene)
        if logic.LoadDICOMSpatialRegistration(loadInfo):
            success = True

        return success
Esempio n. 2
0
    def load(self, loadable):
        """Load the selection as an RT object
    using the DICOMSpatialRegistrationImport module
    """
        success = False

        # Export file lists to DicomExamineInfo
        import vtkSlicerDICOMSpatialRegistrationImportModuleLogic
        loadInfo = vtkSlicerDICOMSpatialRegistrationImportModuleLogic.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 = vtkSlicerDICOMSpatialRegistrationImportModuleLogic.vtkSlicerDICOMSpatialRegistrationImportModuleLogic(
        )
        #logic = slicer.modules.dicomspatialregistrationimport.logic()
        logic.SetMRMLScene(slicer.mrmlScene)
        if logic.LoadDICOMSpatialRegistration(loadInfo):
            success = True

        return success
Esempio n. 3
0
    def examine(self, fileLists):
        """ Returns a list of DICOMLoadable instances
    corresponding to ways of interpreting the 
    fileLists parameter.
    """
        import vtkSlicerDICOMSpatialRegistrationImportModuleLogic

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

        # Examine files
        logic = vtkSlicerDICOMSpatialRegistrationImportModuleLogic.vtkSlicerDICOMSpatialRegistrationImportModuleLogic(
        )
        #logic = slicer.modules.dicomspatialregistrationimport.logic()
        print "reg inside examine"
        logic.Examine(examineInfo)

        # Import loadables from DicomExamineInfo
        loadables = []
        for loadableIndex in xrange(examineInfo.GetNumberOfLoadables()):
            loadable = DICOMLib.DICOMLoadable()
            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
    def examine(self, fileLists):
        """ Returns a list of DICOMLoadable instances
    corresponding to ways of interpreting the 
    fileLists parameter.
    """
        import vtkSlicerDICOMSpatialRegistrationImportModuleLogic

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

        # Examine files
        logic = vtkSlicerDICOMSpatialRegistrationImportModuleLogic.vtkSlicerDICOMSpatialRegistrationImportModuleLogic()
        # logic = slicer.modules.dicomspatialregistrationimport.logic()
        print "reg inside examine"
        logic.Examine(examineInfo)

        # Import loadables from DicomExamineInfo
        loadables = []
        for loadableIndex in xrange(examineInfo.GetNumberOfLoadables()):
            loadable = DICOMLib.DICOMLoadable()
            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