JIPipe extensions can register custom parameter types for the use in nodes.
JIPipe requires you to register custom parameter types, where they are assigned an unique identifier. This is done to allow future refactoring without breaking a user’s project.
A custom parameter type must be JSON-serializable via the Jackson library. It is associated to an editor UI that is responsible for updating the parameter value from the GUI.
Required: creating an editor
New parameter types require a UI that will be used for interacting with the parameter.
To create an editor UI, you have to inherit from JIPipeParameterEditorUI.
The UI class provides access to the JIPipeParameterCollection object and the JIPipeParameterAccess object that encapsulates the getter and setters, as well as additional annotations.
There is also access to the SciJava context object.
Registering a parameter type
@Plugin(type = JIPipeJavaExtension.class) public class MyExtension extends JIPipeDefaultJavaExtension { // ... See previous tutorial for other methods @Override public void register() { // You have to provide an unique ID, the parameter class, a method to create a new instance, a method to create a deep copy, and an UI class registerParameterType("my-parameter", MyParameter.class, MyParameter::new, // Can be null if you have a default constructor p -> p.clone(), // Can be null if you have a copy constructor "My parameter", "A custom parameter type", MyParameterParameterEditorUI.class); // UI can be null if there is already a UI // If you have a hierarchy of parameters, you can register the editor for the whole hierarchy: registerParameterEditor(MyCollectionBase.class, MyCollectionParameterEditorUI.class); // There is a predefined method to register enum values: registerEnumParameterType("my-enum", MyEnum.class, "My Enum", "Enum of values"); } }