Re: Collate PlotWindows into a stack
Posted by
Mike Myerburg on
May 18, 2008; 2:11pm
URL: http://imagej.273.s1.nabble.com/Collate-PlotWindows-into-a-stack-tp3696195p3696199.html
Albert Cardona wrote:
>> Thank you for the help. However, I dont think this way will work for
>> me, because the plots are not generated all at once. The following
>> class is in the plugin and is used to plot the results. As I use the
>> plugin multiple times I wind up with numerous "PSD Sum" windows, but
>> they are not all generated at one time.
>
>
>
> You have then several options.
>
> 1) reshape your code so that you can capture them
>
> or:
>
> 2) scan WindowManager for windows that are instances of PlotWindow. For
> example:
>
>
> int[] ids = WindowManager.getIDList();
> for (int i=0; i<ids.length; i++) {
> ImagePlus imp = WindowManager.getImage(ids[i]);
> if (imp.getWindow() instanceof PlotWindow) {
> // Add this window to the list of PlotWindow to put into a stack
> // ...
> }
> }
>
>
> Ideally you'd run this when done generating all.
>
> Albert
>
Thanks for the suggestions- I think that I am getting closer. I added
this to the routine and created a static psdStack.
ImageProcessor ip = psdSumPlot.getImagePlus().getProcessor();
if (psdStack.getSize() == 0) {
psdStack.addSlice("plotwindow 1", ip); // the first one
new ImagePlus("All PlotWindows", psdStack).show();
} else psdStack.addSlice("plotwindow 1", ip);
The first image gets placed in the stack and when it runs the next time
nothing happens. I assume that the slice is added, but the ImagePlus is
not refreshed. Is there a way to make the ImagePlus update itself?
Thanks, Mike