Login  Register

Re: Need to close the result table from my java application

Posted by Md Tamjidul Hoque on Jun 08, 2010; 12:47am
URL: http://imagej.273.s1.nabble.com/Need-to-close-the-result-table-from-my-java-application-tp3687988p3687992.html

Hi Wayne

            Problem #1:
            ========
             with the following line the result-table window is now
suddenly reappearing (which was not happening before with the same code
same ImageJ version) in my java application and I do not want it be
displayed:
             .......
            Line# X:  IJ.run("Set Measurements...", "  redirect=None
decimal=2"); // This is just to minimize the possible computation and
insertion of the computed result into the ResultTable.
            ........
            interestingly the result-table shows the previous run
results (expect in the case where ImageJ is just been reloaded) - as the
above line is called before any calculation - so just thought to report

            this assuming there might be a bug.

            Also, if I turn off the above line then things are all ok
(i.e. the result-table window is not dispalyed), though I call the
following line at the middle of the code later:

           Line# Y: IJ.run("Set Measurements...", "area mean min shape
redirect=None decimal=9");


           Problem #2:
           ========
            To turn off the ResultWindow I am using the following code
as you advised before:
   

          TextWindow win = ResultsTable.getResultsWindow();
          if (win!=null) win.close(false);


           But, within my batch mode java application (where noting is
displayed per operations) - the screen is blinking (due to close it as
early as possible but the same procedure is in a loop) very
           badly. Could there a better option, such as setting the
resultTable  window invisible or so?
     

Thanks
Tamjid

 
Rasband, Wayne (NIH/NIMH) [E] wrote:

> On Mar 19, 2010, at 5:50 AM, Michael Schmid wrote:
>
>  
>> Hi Bob,
>>
>> the TextWindow class has a close() method. So you probably need  
>> something like the following:
>>
>>   Frame frame = WindowManager.getFrame("Results");
>>   if (frame instanceof TextWindow) {
>>     TextWindow textWindow = (TextWindow)Frame;
>>     textWindow.close();
>>   } else {
>>     SOME ERROR HANDLING (either frame=null or there is a non-
>> TextWindow window named 'Results')
>>   }
>>
>> TextWindow.close should take care of the rest: If the title is  
>> "Results", it puts the results counter to zero and clears the  
>> textPanel associated with the results.
>>    
>
> In ImageJ 1.43s or later you can close the "Results" window using:
>
>    TextWindow win = ResultsTable.getResultsWindow();
>    if (win!=null) win.close();
>
> or use
>
>    TextWindow win = ResultsTable.getResultsWindow();
>    if (win!=null) win.close(false);
>
> if you do not want the "save changes" dialog to be shown.
>
> -wayne
>
>
>  
>> Michael
>> ________________________________________________________________
>>
>> On 18 Mar 2010, at 16:34, Bob Loushin wrote:
>>
>>    
>>> @Michael Schmid  Yes, close() would be a great solution, but it  
>>> doesn't exist, at least at the level I'm trying to get at it (Frame  
>>> class).
>>>      
>
>