Plugin Calculations for Cardiac Segments

With the Cardiac Analysis tool, you can build your own calculation algorithms to work on the cardiac segments as plugins. Using a simple example, this section details how to create your calculation method, which is written using the Java programming language. If you are not a java programmer, or find this task too daunting, you can commission Xinapse Systems to write your analysis plugin.

The steps needed to create and use a plugin are:

  1. Write the java source code for the class that extends com.xinapse.apps.cardiac.SelectableCardiacAnalysis.
  2. Compile the source code to produce java class files.
  3. Either place your plugin in a standard location or extend Jim's classpath so that Jim knows where to find the new class.
  4. Import the new plugin into Jim.
  5. Restart Jim.

Source code for the example plugin

The example plugin we will simply calculate the area of each cardiac segment. The class you will create must extend the class com.xinapse.apps.cardiac.SelectableCardiacAnalysis The source code for our example can be found in SegmentArea.java. The source code contains explanations of the forms that must be followed. Save the example source code into a folder of your choice.

Compiling the source code

Compile the source code using the command:

javac SegmentArea.java

This will generate the class files SegmentArea.class and SegmentArea$Panel.class. Both of these class files will need to be copied to the plugins folder.
Note: you must use javac version 17.

Telling Jim where to find your new class

Jim can find your plugin if either:

  1. You place all the .class files for your plugin in one of two standard locations. These are:
  2. You modify Jim's standard classpath to include the folder where your new class files are. Please see the relevant sections about customising an installation on Windows, Unix or Mac OS.

If necessary, copy the plugin .class files created by the compilation above to your chosen location.

Import the plugin into Jim

To import the new plugin, select Import plugin ... from the tool's Plugins menu: plugins_import_plugin, and tell Jim the fully-qualified class name for your new plugin. In our example, we simply enter "SegmentArea", but if you had put you plugin into a particular package such as "edu.myuni.plugins", you would enter "edu.myuni.plugins.SegmentArea".

SegmentArea plugin import

Then click the ok button.

Restart Jim and your new plugin will be represented by a new tab in the Cardiac Analysis tool:

Cardiac analysis tool with the
                                                                  imported plugin

Note: if you recompile your plugin, you will need to restart Jim for the change to take effect.

Removing a plugin from Jim

If, at sometime in the future, you wish to stop using a plugin, you can simply delete the .class files from the plugin folder. When you do this, Jim will give you a warning message next time you try to use the tool, like this:

SegmentArea plugin not
                                                                   found

After this one warning, Jim will not try to use the plugin again.

If you temporarily want to stop using the plugin, but without deleting the .class files, select Manage plugins ... from the tool's Plugins menu: plugins_manage_plugins and delete the plugin from the list of current plugins that pops up. To start using the plugin again you will have to repeat the procedure of importing your plugin into Jim.

Jim Home