Skip to content

Plugins

Rob Campbell edited this page Jan 6, 2017 · 5 revisions

The functionality of MaSIV is extended using plugins. Plugins are started from the plugins menu in the main MaSIV window. The built-in plugins provide simple functionality such as cropping the stack, creating a z-profile, and measuring distances. Also included are tutorial plugins, which are aimed at those wishing to learn how to write their own plugins. A setting in the preferences file allows the turorial plugins to be removed from the menu.

Installing new plugins

Additional plugins can be installed from the command line using the masiv.pluginManager, which is capable of installing plugins hosted on GitHub. These "external" plugins are hosted in a diretory of your choice. Choose a location outside of the MaSIV install directory. For example, you might create a directory called masiv_plugins in your home directory. This is the directory into which the plugin manager will install the plugins. It is possible to define more than one external plugins directory and the installer prompts you to choose one. Edit the MaSIV preferences file (masivPrefs.yml). e.g.:

plugins:
    hideTutorialPlugins: 0
    bundledPluginsDirPath: code/plugins
    externalPluginsDirs: {~/work/MaSIV_plugins_dev/,~/.masiv_plugins}

You are now ready to install plugins. Currently the following external plugins are available:

To install one of these plugins, navigate to its GitHub page and copy the URL in the browser's location bar (not the Git URL). Then use this URL to install the plugin. For example:

masiv.pluginManager.install('https://github.com/raacampbell/neuriteTracer')

You can list the installed plugins as follows:

>> masiv.pluginManager.listExternalPlugins(1)
 External plugins:

 (1) ~/work/Anatomy/MaSIV_plugins_dev/neuriteTracer
        Not managed by masiv.pluginManager

 (2) ~/.masiv_plugins/masiv-cell-counter
       Repo name: masiv-cell-counter
       URL: https://github.com/alexanderbrown/masiv-cell-counter
       Author: Alex Brown

You may update a plugin at the command line as follows:

>> masiv.pluginManager.update('~/.masiv_plugins/masiv-cell-counter')
  Checking if plugin masiv-cell-counter is up to date on branch master
  Plugin "masiv-cell-counter" is up to date on branch "master".

These commands will be updated soon to make them more convenient.

Writing your own plugins

Like the rest of MaSIV, the plugins are written using object-oriented code. Each plugin is a class that inherits masivPlugin. Please see the tutorial plugins for getting started. If you want something more complicated, the neurite tracer plugin is quite heavily commented.

Clone this wiki locally