ImageJ integration

ImageJ to JIPipe

JIPipe integrates commonly used data types and popular algorithms from ImageJ. If an algorithm is not available for JIPipe, you can still run them via the Macro node. There is also a Python script node available that behaves similar to the macro node.

JIPipe to ImageJ

JIPipe algorithms and pipelines can be executed from within an ImageJ environment. There are two ways JIPipe integrates back into ImageJ:

  1. You can run a pipeline project from a macro/command
  2. You can run JIPipe algorithms from a macro/command if the slot data types are supported by ImageJ

Running a pipeline

You can run an JIPipe pipeline via the command Plugins > JIPipe > Run JIPipe project. It will ask you the project file and the output directory.

To run the command via a macro, run:

run("Run JIPipe project", "projectFile=<Project>, outputDirectory=<Directory>, threads=<Threads>")

There can be issues using the macro recorder depending on which ImageJ algorithms are used. This issue is especially prevalent in ImageJ macro algorithm nodes.

You can also run JIPipe in headless-mode just like any ImageJ2 algorithm:

./ImageJ-linux64 --headless --ij2 --run "Run JIPipe project" 'projectFile="<Project>", outputDirectory="<Directory>", threads=<Threads>'

While JIPipe works in Headless-mode, some ImageJ algorithms don’t. You will get an error message if an algorithm requires a graphical environment.

Running a single algorithm

JIPipe algorithms can be run from ImageJ macros/commands if the slot data types are compatible with ImageJ. By default, this includes any image data type, result tables, and regions of interest (via ROIManager). If you run the command Plugins > JIPipe > Run JIPipe algorithm, a dialog with all available algorithms, parameters, and more information is shown.

A difference to the parameter panel of an algorithm within the graph editor UI is that you have to select the input image.

Single algorithm setup dialog

Output data is created according to the slot name. For example if the output slot name is Output, the created image window will also be named Output.

Just as in a graph, images are converted automatically to the data type specified by the algorithm.

There may be issues if multiple ROI or result table outputs are generated. JIPipe will merge multiple ROI List data items into one Results Table.

There can be issues using the macro recorder depending on which ImageJ algorithm is executed. This issue is especially prevalent in ImageJ macro algorithm nodes.

To run the command via a macro, run:

run("Run JIPipe algorithm", "nodeId=<Algorithm>, parameters=<Parameters>")

The algorithm ID can be looked up via the plugin manager. Parameters are provided as string in JSON format. The JSON data should have following structure:

Use the “Copy command” button in the “Run JIPipe algorithm” GUI command to quickly create a valid macro for your parameters.

If you are a developer of a JIPipe node (Java only) and want to provide your node as separate entry in the ImageJ menu, you can use our Java API to create custom SciJava commands that provide a similar UI to the single algorithm run. You just have to inherit from JIPipeRunCustomAlgorithmCommand and provide the constructor with the node ID. Then add the Plugin annotation just as with any SciJava command.