Customizing slots

In the previous examples, we used the @AlgorithmInputSlot and @AlgorithmOutputSlot annotations with autoCreate = true to automatically configure the slots.

This is not sufficient for more complicated algorithms that require

A custom JIPipeSlotConfiguration can be used to implement such more advanced behaviors.

For many cases, the default implementation JIPipeMutableSlotConfiguration is sufficient.

The slot configuration can be overriden during instantiation of the algorithm:

public MyAlgorithm(JIPipeNodeInfo info) {
    super(info, JIPipeMutableSlotConfiguration.builder()
    .addInputSlot("Input", ImagePlusData.class)
    .restrictOutputTo(ImagePlusData.class)
    .build());
}

The slots of JIPipeMutableSlotConfiguration are by default unsealed - meaning that users can add more slots. Use the seal() functions to prevent this.

Do not create static slot configurations. Each algorithm should have its own instance. Use a private static function if you want to work outside the capabilities of the builder.

You should keep the @AlgorithmInputSlot and @AlgorithmOutputSlot annotations. They are required for the algorithm finder and generating tooltips.