當前位置: 首頁>>代碼示例>>Python>>正文


Python ProjectManager.loadProject方法代碼示例

本文整理匯總了Python中ilastik.shell.projectManager.ProjectManager.loadProject方法的典型用法代碼示例。如果您正苦於以下問題:Python ProjectManager.loadProject方法的具體用法?Python ProjectManager.loadProject怎麽用?Python ProjectManager.loadProject使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在ilastik.shell.projectManager.ProjectManager的用法示例。


在下文中一共展示了ProjectManager.loadProject方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: HeadlessShell

# 需要導入模塊: from ilastik.shell.projectManager import ProjectManager [as 別名]
# 或者: from ilastik.shell.projectManager.ProjectManager import loadProject [as 別名]
class HeadlessShell(object):
    """
    For now, this class is just a stand-in for the GUI shell (used when running from the command line).
    """

    def __init__(self):
        self._applets = []
        self.projectManager = ProjectManager()
        self.currentImageIndex = -1

    def addApplet(self, aplt):
        self._applets.append(aplt)
        self.projectManager.addApplet(aplt)

    def changeCurrentInputImageIndex(self, newImageIndex):
        if newImageIndex != self.currentImageIndex:
            # Alert each central widget and viewer control widget that the image selection changed
            for i in range(len(self._applets)):
                self._applets[i].gui.setImageIndex(newImageIndex)

            self.currentImageIndex = newImageIndex

    def openProjectPath(self, projectFilePath):
        try:
            hdf5File, readOnly = self.projectManager.openProjectFile(projectFilePath)
            self.projectManager.loadProject(hdf5File, projectFilePath, readOnly)
        except ProjectManager.ProjectVersionError:
            # Couldn't open project.  Try importing it.
            oldProjectFilePath = projectFilePath
            name, ext = os.path.splitext(oldProjectFilePath)
            projectFilePath = name + "_imported" + ext

            logger.info("Importing project as '" + projectFilePath + "'")
            projectFile = self.projectManager.createBlankProjectFile(projectFilePath)
            self.projectManager.importProject(oldProjectFilePath, projectFile, projectFilePath)
開發者ID:kemaleren,項目名稱:ilastik,代碼行數:37,代碼來源:headlessShell.py


注:本文中的ilastik.shell.projectManager.ProjectManager.loadProject方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。