本文整理汇总了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)