<div dir="ltr">Hi Carnë,<div><br></div><div><div>> I open the sample image "blobs" and the plugin will print "8-bit"</div><div>> (expected). Then I open the sample "CT" and it prints "16-bit"</div>

<div>> (expected). I then select the blobs image, run it again but get</div><div>> "16-bit"</div></div><div><br></div><div>This is a bug in the ImageJ2 legacy layer, responsible for keeping the ImageJ2 data structures in sync with ImageJ 1.x. Could you please file an issue at <a href="https://github.com/imagej/imagej-legacy/issues">https://github.com/imagej/imagej-legacy/issues</a> ?</div>

<div><div><br></div></div><div>Thank you,</div><div>Curtis</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Aug 14, 2014 at 12:18 PM, Carnë Draug <span dir="ltr"><<a href="mailto:carandraug+dev@gmail.com" target="_blank">carandraug+dev@gmail.com</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi<br>
<br>
I'm trying to write an ImageJ plugin but I'm failing at the most basic<br>
step which I thought would be getting the current image (last selected<br>
image). I am using the @Parameter annotation to get a Dataset and<br>
implementing a Command interface but I'm unsure of what it's<br>
happening. Using:<br>
<br>
  @Parameter<br>
  private Dataset dataset;<br>
<br>
as suggested on the tutorials [1], seems to use what the image was<br>
when opened. After reading the javadocs [2], I have tried to set<br>
persist to false but go no change.<br>
<br>
Please, consider my very small case which should simply print the<br>
image data type [3] (it requires closing the text window after each<br>
call). I open the sample image "blobs" and the plugin will print<br>
"8-bit" (expected). Then I open the sample "CT" and it prints "16-bit"<br>
(expected). I then select the blobs image, run it again but get<br>
"16-bit" (that was a surprise, I guess it's choosing the last opened<br>
image). So I change the CT to 8-bit using "Edit > Type", run the<br>
plugin again but still get back "16-bit" (uh! I have no idea of what's<br>
going on).<br>
<br>
I'm probably doing something very stupid as I'm still getting to grips<br>
with java. Could anyone explain to me how to get the current image? I<br>
did found the ImageJ1 getCurrentImage() method but I'm trying to use<br>
ImgLib2 to later on get a RandomAccessible and implement some<br>
N-dimensional algorithms.<br>
<br>
Thank you,<br>
Carnë<br>
<br>
[1] <a href="https://github.com/imagej/imagej-tutorials/blob/master/simple-commands/src/main/java/ComputeStats.java" target="_blank">https://github.com/imagej/imagej-tutorials/blob/master/simple-commands/src/main/java/ComputeStats.java</a><br>


[2] <a href="http://jenkins.imagej.net/job/SciJava-common-javadoc/javadoc/org/scijava/plugin/Parameter.html" target="_blank">http://jenkins.imagej.net/job/SciJava-common-javadoc/javadoc/org/scijava/plugin/Parameter.html</a><br>


[3] <a href="http://pastebin.com/ZVt1YsJ0" target="_blank">http://pastebin.com/ZVt1YsJ0</a><br>
<br>
_______________________________________________<br>
ImageJ-devel mailing list<br>
<a href="mailto:ImageJ-devel@imagej.net">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>