How to Make a Clean UI for Imagej Macro

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

How to Make a Clean UI for Imagej Macro

tankhead
This post was updated on .
Hi,

I am a medical physics intern and am currently working on an automated winston-lutz test using an imagej macro.  I have it functioning perfectly but am disappointed in the user interface.  The image, threshold, measurement, log, and results windows are displayed.  I tried using setLocation at 5000,5000 to set the windows off-screen but it requires that the window is already opened before it moves the window.  My program has a few flashes from the windows opening and then quickly moving off-screen before the log window shows the user whether the test passed or not.

Please provide suggestions or actual code that will either let me set the location of a window before it opens or somehow hides windows when imagej is functioning.  I forgot to mention that I also have hidden the ImageJ toolbar off screen too, so dont worry about that.  I am fairly novice at java programming so please write out the code and give as much detail as possible. THANKS in advance!

-Tank
Reply | Threaded
Open this post in threaded view
|

Re: Want Clean UI

Michael Schmid
Hi Tank,

in a macro you can use setBatchMode(true) to disable displaying (and  
updating) images on the screen.
In a plugin (java code), obviously, don't call ImagePlus.show() if  
you don't want to see the image.

Hope this helps,

Michael
________________________________________________________________

On 3 Jan 2011, at 19:56, tankhead wrote:

> Hi,
>
> I am a medical physics intern and am currently working on an automated
> winston-lutz test using an imagej macro.  I have it functioning  
> perfectly
> but am disappointed in the user interface.  The image, threshold,
> measurement, log, and results windows are displayed.  I tried using
> setLocation at 5000,5000 to set the windows off-screen but it  
> requires that
> the window is already opened before it moves the window.  My  
> program has a
> few flashes from the windows opening and then quickly moving off-
> screen
> before the log window shows the user whether the test passed or not.
>
> Please provide suggestions or actual code that will either let me  
> set the
> location of a window before it opens or somehow hides windows when  
> imagej is
> functioning.  I forgot to mention that I also have hidden the  
> ImageJ toolbar
> off screen too, so dont worry about that.  I am fairly novice at java
> programming so please write out the code and give as much detail as
> possible. THANKS in advance!
>
> -Tank
Reply | Threaded
Open this post in threaded view
|

Re: Want Clean UI

tankhead
Michael,

If you saw the post I deleted I had accidentally erased part of my code and that is why I was getting the error "There is no image open."  However, I still need a solution for the threshold and results windows.  Maybe even the log window.  I had been displaying the final results of the test just in the Log Window but it may look better displayed in a dialog text window.  So I have 1 question at the moment:

How can I hide the threshold, results, and log windows so they are not seen at all? (I may keep the log window...just depends on if I can get the dialog box working correctly or not).

Thanks for your quick response yesterday!
-Dan

Reply | Threaded
Open this post in threaded view
|

Re: Want Clean UI

tankhead
Wayne,

How can I use the threshold tool without opening it?  Also, how do I use the command getResult() without opening the window?  Thanks.

-Dan
Reply | Threaded
Open this post in threaded view
|

Re: Want Clean UI

tankhead
So after about 5 min. I have the threshold window not opened.  The results table is still throwing me off.  I use run("Measure"); and then getResult(); to return a value to my program.  Is there a way to return a measured value without having the Result window open?  Thanks.
Reply | Threaded
Open this post in threaded view
|

Re: Want Clean UI

Rasband, Wayne (NIH/NIMH) [E]
On Jan 4, 2011, at 5:09 PM, tankhead wrote:

> So after about 5 min. I have the threshold window not opened.  The results
> table is still throwing me off.  I use run("Measure"); and then getResult();
> to return a value to my program.  Is there a way to return a measured value
> without having the Result window open?  Thanks.

Use the getStatistics() or getRawStatistics() macro functions to measure area, mean, min and max. Or any value that can be measured using the Measure command can be retrieved using the List.setMeasurements() and List.getValue() functions. There is an example at

    http://rsb.info.nih.gov/ij/macros/DrawEllipse.txt

-wayne