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