How to create a plugin @Parameter thar is required=false and autofFll=false


I’m working with a Fiji plugin, and I’m able to create a Dataset @Parameter. I need this parameter to be optional, and therefore, I don’t want it to be pre-filled when the user opens the plugin modal window.

I’ve tried using required=false and autofill=false in the @Parameter annotation, but the field still shows up prefilled with one o the current Datasets;

I’ve also tried setting initializer = "nameOfFunctionThatSetsThisParameterToNull", but the field still shows up initialized.

So my question would be: what is the correct way to have a optional Dataset field in an ImageJ plugin?

Thank you,


The issue is not with the parameter itself (i.e. for required=false parameters, you are allowed e.g. to call CommandService#run(yourCommand.class, ...) with null as an input), but rather with the UI widget that tries to harvest an input value for your parameter.

I just filed an issue today (following @k-dominik’s comment on the ilastik4ij repo):

1 Like