Posted by
Kenneth Sloan-2 on
Oct 25, 2018; 4:21pm
URL: http://imagej.273.s1.nabble.com/current-window-when-using-IJ-run-Java-tp5021353.html
A question about running commands which depend on the current window. Java plugin.
I have a Java plugin which generates several ImagePlus objects, and shows them.
The last one is an 8-bit image to which I want to apply a LUT.
I (naƮvely?) assumed that the last ImagePlus.show() call would make that window the current one, so I tried:
...
ip1.show();
ip2.show();
ip3.show();
IJ.run("royal");
ip1 is an RGB image.
ip2 is a 32-bit float image.
ip3 is an 8-bit byte image.
My expectation was that the LUT would be applied to the 3rd image (the 8-bit byte image). Instead, it was applied to
the 2nd image (the 32-bit float image).
I suspected some sort of race condition, so I tried this:
...
ip1.show();
ip2.show();
ip3.show();
WindowManager.setWindow(ip3.getWindow());
IJ.run("royal");
No joy! The LUT is *still* applied to ip2, the 32-bit float image.
What am I doing wrong?
For the time being, I'm leaving out the attempt to apply the LUT and simply telling the customer to use Image->Lookup Tables->royal
to get the color coding. That has certain advantages, BUT...I'd really like to know how to do this automatically.
Do I need to explicitly load the LUT? If so, what's the path to the pool of already installed LUTs? (needs to work across multiple platforms).
I dimly recall doing this year ago, but have forgotten the details. At the time, I was constructing a custom LUT. This time, I just want to use
one of the already installed LUT's.
--
Kenneth Sloan
[hidden email]
Vision is the art of seeing what is invisible to others.
--
ImageJ mailing list:
http://imagej.nih.gov/ij/list.html