Project Manager

class ilastik.shell.projectManager.ProjectManager(shell, workflowClass, headless=False, workflow_cmdline_args=None, project_creation_args=None)[source]

This class manages creating, opening, importing, saving, and closing project files. It instantiates a workflow object and loads its applets with the settings from the project file by using the applets’ serializer objects.

To open a project file, instantiate a ProjectManager object. To close the project file, delete the ProjectManager object.

Once the project manager has been instantiated, clients can access its workflow member for direct access to its applets and their top-level operators.

__init__(shell, workflowClass, headless=False, workflow_cmdline_args=None, project_creation_args=None)[source]

Constructor.

Parameters:
  • workflowClass – A subclass of ilastik.workflow.Workflow (the class, not an instance).
  • headless – A bool that is passed to the workflow constructor, indicating whether or not the workflow should be opened in ‘headless’ mode.
  • workflow_cmdline_args – A list of strings from the command-line to configure the workflow.
exception ProjectVersionError(projectVersion, expectedVersion)[source]

Raised if an attempt is made to open a project file that was generated with an old version of ilastik.

exception ProjectManager.FileMissingError[source]

Raised if an attempt is made to open a project file that can’t be found on disk.

exception ProjectManager.SaveError[source]

Raised if saving the project results in an error of some kind. The project file will be in an UNKNOWN and potentially inconsistent state!

classmethod ProjectManager.createBlankProjectFile(projectFilePath, workflow_class=None, workflow_cmdline_args=None, h5_file_kwargs={})[source]

Create a new ilp file at the given path and initialize it with a project version.

Class method. If a file already exists at the location, it will be overwritten with a blank project (i.e. the mode is fixed to ‘w’).

Parameters:
  • projectFilePath – Full path of the new project (for instance ‘/tmp/MyProject.ilp’).
  • workflow_class – If not None, add dataset containing the name of the workflow_class.
  • workflow_cmdline_args – If not None, add dataset containing the commandline arguments.
  • h5_file_kwargs – Passed directly to h5py.File.__init__(); all standard params except ‘mode’ are allowed.
Return type:

h5py.File

classmethod ProjectManager.openProjectFile(projectFilePath, forceReadOnly=False)[source]

Class method. Attempt to open the given path to an existing project file. If it doesn’t exist, raise a ProjectManager.FileMissingError. If its version is outdated, raise a ProjectManager.ProjectVersionError.

classmethod ProjectManager.downloadProjectFromDvid(hostname, node_uuid, keyvalue_name, project_key=None, local_filepath=None)[source]

Download a file from a dvid keyvalue data instance and store it to the given local_filepath. If no local_filepath is given, create a new temporary file. Returns the path to the downloaded file.

ProjectManager.cleanUp()[source]

Should be called when the Projectmanager is canceled. Closes the project file.

ProjectManager.getDirtyAppletNames()[source]

Check the serializers for every applet in the workflow. If a serializer declares itself to be dirty (i.e. it is-out-of-sync with the applet’s operator), then the applet’s name is appended to the resulting list.

ProjectManager.saveProject(force_all_save=False)[source]

Update the project file with the state of the current workflow settings. Must not be called if the project file was opened in read-only mode.

ProjectManager.saveProjectSnapshot(snapshotPath)[source]

Copy the project file as it is, then serialize any dirty state into the copy. Original serializers and project file should not be touched.

ProjectManager.saveProjectAs(newPath)[source]

Implement “Save As” Equivalent to the following steps (but done without closing the current project file):

  1. rename Old.ilp -> New.ilp
  2. touch Old.ilp
  3. copycontents New.ilp -> Old.ilp

4) Save current applet state to current project (New.ilp) Postconditions: - Original project state is saved to a new file with the original name. - Current project file is still open, but has a new name. - Current project file has been saved (it is in sync with the applet states)