<div dir="ltr"><div><div><div><div>Hi Jan,<br><br>>an error message is displayed: "A Dataset is required but none exist."<br><br></div>This was due to limitations with the input preprocessor presenting the list of datasets. Since ImagePluses aren't explicitly tracked by the IJ2 framework, having an ImagePlus recognized as a Dataset requires some extra layers. We had covered the single input case (which is why your first script worked) but not the general multi-input case. There is an <a href="https://github.com/imagej/imagej-legacy/issues/106">issue tracking the multi-input</a> case, which I resolved today. So this should work as intended in our next release - and thank you for the motivation to wrap this up!<br><br></div>You can also manually enable ImagePlus <> Dataset synchronization to ensure ImagePluses always have a corresponding Dataset: <a href="http://imagej.net/Compatibility#Translation_of_data_structures">http://imagej.net/Compatibility#Translation_of_data_structures</a><br><br>>(where can this title be set, by the way?)<br><br></div>For the multiple choice input selection, the labels are based on the name of the input type. Since the input type is Dataset, the Dataset name is used (which delegates to the wrapped ImgPlus). In your code you are applying labels to the Display, but not the underlying dataset - if you name the ImgPlus, or explicitly create a Dataset and set its name, that name will propagate up to the input chooser (and the Display). As a side note, you should use the net.imagej.ImgPlus instead of the net.imglib2.meta.<br><br></div>An updated script would be:<br><br><br> # @DisplayService display<br> # @OpService ops<br> # @net.imagej.Dataset inputData1<br> # @net.imagej.Dataset inputData2<br><br> from net.imagej import ImgPlus<br><br> display.createDisplay(ImgPlus(inputData1, "my1"))<br> display.createDisplay(ImgPlus(inputData2, "my2"))<br><div><br></div><div>Hope that helps. Let me know if you have any other questions.<br><br></div><div>Best,<br></div><div>Mark<br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Apr 27, 2015 at 8:58 AM, Jan Eglinger <span dir="ltr"><<a href="mailto:jan.eglinger@gmail.com" target="_blank">jan.eglinger@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Dear all,<br>
<br>
*** TL;DR:<br>
How do I proceed to get multiple input Datasets as ImageJ2 parameters from open images in Fiji?<br>
***<br>
<br>
I was recently exploring ImageJ2 scripting in Fiji and found the OpsThresholdIJ1Analyze template [1] in the script editor very helpful.<br>
<br>
When trying to get more than one @net.imagej.Dataset input parameter however, I noticed some inconsistencies.<br>
Let me try to illustrate with the two following scripts:<br>
<br>
# @DisplayService display<br>
# @OpService ops<br>
# @net.imagej.Dataset inputData1<br>
<br>
from net.imglib2.meta import ImgPlus<br>
<br>
display.createDisplay("my1", ImgPlus(inputData1))<br>
<br>
<br>
The above script re-displays the current image as expected (I tried with the Blobs sample image open, which will be re-displayed with a non-inverted LUT.)<br>
<br>
When I ask for two input datasets (right after a fresh start of Fiji with only the Blobs sample image open):<br>
<br>
# @DisplayService display<br>
# @OpService ops<br>
# @net.imagej.Dataset inputData1<br>
# @net.imagej.Dataset inputData2<br>
<br>
from net.imglib2.meta import ImgPlus<br>
<br>
display.createDisplay("my1", ImgPlus(inputData1))<br>
display.createDisplay("my2", ImgPlus(inputData2))<br>
<br>
an error message is displayed: "A Dataset is required but none exist."<br>
The same error message is displayed when I open a second image in Fiji before running the script.<br>
<br>
Now, when I run script #2 after script #1 was run at least once, I get a dialog with two choices "InputData1" and "InputData2", both choice fields containing "blobs.gif" and a number of "Untitled" entries (where can this title be set, by the way?).<br>
<br>
I guess that a choice is only displayed if there are ImageJ2 datasets (i.e. wrapped ImagePlus) already available. The single input case seems to be special-cased as it auto-wraps the currently open image.<br>
<br>
So how do I proceed to get more than one input in ImageJ2 scripting from open (ImageJ1-)images?<br>
<br>
Thanks for your advice,<br>
Regards,<br>
Jan<br>
<br>
<br>
[1]: <a href="https://github.com/imagej/imagej-legacy/blob/master/src/main/resources/script_templates/Python/OpsThresholdIJ1Analyze.py" target="_blank">https://github.com/imagej/imagej-legacy/blob/master/src/main/resources/script_templates/Python/OpsThresholdIJ1Analyze.py</a><br>
<br>
_______________________________________________<br>
ImageJ-devel mailing list<br>
<a href="mailto:ImageJ-devel@imagej.net" target="_blank">ImageJ-devel@imagej.net</a><br>
<a href="http://imagej.net/mailman/listinfo/imagej-devel" target="_blank">http://imagej.net/mailman/listinfo/imagej-devel</a><br>
</blockquote></div><br></div>