I am trying to create a SciJava plugin for IJ2 / FIJI, and I really like the UI-agnosticity and
@Parameter elegant mechanism. However I would like to generate not one, but several sequential input dialogs, some of them during the command run-time, not just in the preprocessing step. First, to not overwhelm the user with a myriad of parameters in one go, and second and most important, because some of them depend hierarchically on previous choices and on some of the processes that the plugin performs.
To be more specific, these are two particular situations:
- the first dialog asks for an image hyperstack, then, after its dimensions are taken, the second dialog asks in which channel of the image the user wants to perform the subsequent analysis. I d rather not have a field in the first dialog asking for a channel choice, when the user and the plugin don’t know yet how many are there.
- In the first dialog, one chooses to either fill some parameters manually or from a file; if “from file…” is chosen, then the second dialog is a ChooseFile widget; if the manual option is chosen, then in the second dialog the user fills the whole set of parameters.
For now I rely on IJ1 ij.gui.GenericDialog as a quick-and-dirty solution. Another option, I could create my own JDialog. In these sense, I also thought about using the org.scijava.ui.swing/awt.Swing/AWTInputPanel and InputWidgets, but for what I see, these classes are instantiated but not implemented yet. Were this the case, I wouldn’t even know how to show and run the panel, with the UIService?
In any case, these solutions are not optimal, and I am actually interested in the following:
Ideally, I would have direct access from the running command to the InputPanel. This has already been addressed, at the end of the discussion from In ImageJ2 commands, how to update displayed parameters?. Is there any advance I am not aware of?
Alternatively, I could create a second auxiliary command plugin inside the package, this one would be called (if necessary) by the main plugin, run its own preprocessor with the @Parameter annotation and return the values to the main plugin. To do this, I would need some suggestions, because I am a newbie here.
–Can I have two independent Command plugins in the same package? Would it better be an Op plugin? A Module?
–How could I call the second, auxiliary plugin from the first one so that it runs independently, that is, calls its own preprocessor? should I run it as
ImageJ ij = new ImageJ(); ij.command().run(AuxPlugin.class)? What would happen with the context, would it be the same? Would that even matter? How could I run the second, auxiliary plugin headless, from parameters still not output to the context from the first plugin?
Thanks in advance, and sorry for the long post!