The standard library contains nodes that allow to run Python scripts using the Jython library. Python scripts have access to all JIPipe and ImageJ APIs that are available at runtime.
Due to restrictions in the Jython library, Python libraries that are built on a native backend (such as Numpy) will not work.
As JIPipe builds on the functionality provided by ImageJ. Please refer to the ImageJ documentation to find information on how to expand Jython with additional libraries.
You can find the nodes in the
Miscellaneous menu. You can find algorithms equivalent
to each of the Java standard algorithms:
|Jython script||JIPipeParameterSlotAlgorithm||This algorithm allows users to run multiple parameter sets by optionally enabling an additional slot
|Jython script (simple iterating)||JIPipeSimpleIteratingAlgorithm||A JIPipeParameterSlotAlgorithm that has one input slot and iterates over the input rows.|
|Jython script (iterating)||JIPipeIteratingAlgorithm||A JIPipeParameterSlotAlgorithm that can have multiple input slots and match annotations of the input data to create data batches.|
|Jython script (merging)||JIPipeMergingAlgorithm||A JIPipeParameterSlotAlgorithm that can have multiple input slots and match annotations of the input data to create data batches. The difference to JIPipeIteratingAlgorithm is that a batch can have duplicate items per slot.|
All Python script nodes share a set of variables that are available in the code:
||A list of all effective input slots. This means, slots like the ‘Parameters’ slot are not listed here. Each slot is using the Jython API to access the native Java data type. Refer to the JIPipeDataSlot documentation for further information.|
||A list of all output slots. Each slot is using the Jython API to access the native Java data type. Refer to the JIPipeDataSlot documentation for further information.|
||A dictionary from input slot name to input slot instance.|
||A dictionary from output slot name to output slot instance.|
Data batch access
Python nodes based on JIPipeSimpleIteratingAlgorithm, JIPipeIteratingAlgorithm, and
JIPipeMergingAlgorithm repeat the script for each data batch (or at least once if there is none).
Data batches organize the data of various input slots into one bundle that should be processed. Access to this data batch is provided via a variable
This variable points to an instance of JIPipeDataBatch (or JIPipeMergingDataBatch for the merging algorithm).
Each node provides means to define Python variables inside the JIPipe environment via custom parameters. Each parameter value is passed as variable into Python - the name of the variable being determined by the unique ID of the parameter.
All Python nodes are multi-parameter capable (including iterating and merging nodes). “Jython script (multi-parameter capable)” provides a unique variable
that contains any annotations of the current parameter set.