Posted by
Michael Doube-2 on
Nov 08, 2005; 12:57pm
URL: http://imagej.273.s1.nabble.com/Malfunctioning-Macro-tp3704517p3704520.html
Wayne
I have tested the macro using the latest Linux version of ImageJ (1.34s
with Java 1.5.0_04) from your site on Fedora Core 4, and it works fine.
I still can't get it to work properly on WinXP pro. Could it be a
Java/WinXP issue? I tried the newer version of JRE (1.5.0_05) on Linux
and that made ImageJ not work properly - it wouldn't do much at all,
including opening plain .tif files
------------------------
Exception in thread "main" java.lang.NullPointerException
at .get_state (/usr/lib/lib-gnu-java-awt-peer-gtk.so.6.0.0)
at .Java_gnu_java_awt_peer_gtk_GtkMenuPeer_addItem
(/usr/lib/lib-gnu-java-awt-peer-gtk.so.6.0.0)
at
gnu.java.awt.peer.gtk.GtkMenuPeer.addItem(java.awt.peer.MenuItemPeer,
int, boolean) (/usr/lib/lib-gnu-java-awt-peer-gtk.so.6.0.0)
at gnu.java.awt.peer.gtk.GtkMenuPeer.addItem(java.awt.MenuItem)
(/usr/lib/lib-gnu-java-awt-peer-gtk.so.6.0.0)
at java.awt.Menu.add(java.awt.MenuItem) (/usr/lib/libgcj.so.6.0.0)
at ij.plugin.MacroInstaller.install() (Unknown Source)
at ij.plugin.MacroInstaller.install(java.lang.String) (Unknown Source)
at ij.plugin.MacroInstaller.run(java.lang.String) (Unknown Source)
at ij.Menus.installStartupMacroSet() (Unknown Source)
at ij.ImageJ.ImageJ(java.applet.Applet) (Unknown Source)
at ij.ImageJ.main(java.lang.String[]) (Unknown Source)
at gnu.java.lang.MainThread.call_main() (/usr/lib/libgcj.so.6.0.0)
at gnu.java.lang.MainThread.run() (/usr/lib/libgcj.so.6.0.0)
-----------------------------------------------
Cheers
Mike
Michael Doube wrote:
> Thanks Wayne,
>
> Changing the code as you suggest fixed the first part of the problem;
> now I don't have to File-Import-Raw before running the macro.
>
> ----------new code---------
> run("Raw...", "image=8-bit width=512 height=512 offset=128 number=1
> gap=0");
> ----------end------------
>
> However, the second part of the problem remains - third and subsequent
> repeats of the macro require me to click on the Results window, as
> though it has to be in the foreground in order for ImageJ to properly
> catch the [q] keystroke.
>
> I will test it on Linux and see what happens.
>
> Upgrading to 1.35g didn't help.
>
> Regards
>
> Mike
>
> Wayne Rasband wrote:
>
>>> A macro that used to work just fine has stopped working
>>> properly. I used to install it, then hit [q], and it
>>> worked. Now I have to File-Import-Raw before it will work,
>>> and the second and subsequent repeats of the macro require
>>> me to click on the results window before it will go again. I have
>>> tried the new version (1.34s) of ij.jar, to no
>>> avail. I'm using Java 1.5.0_04 and WinXP Pro SP2. Something has
>>> changed, but I don't know what!
>>
>>
>>
>> It works fine for me using ImageJ 1.35g/Mac OS X 10.3.9/Java 1.4.2,
>> but the run() call looks a little strange. It should probably be
>>
>> run("Raw...", "image=8-bit width=512 height=512 offset=128
>> number=1 gap=0");
>>
>> which causes a file open dialog to be shown, but not the Import/Raw
>> dialog.
>>
>> -wayne
>>
>>
>>>
>>> The text of my macro follows
>>>
>>> Thanks
>>>
>>> Mike
>>>
>>> ---------------
>>> macro "Standard Grey Peak Finder [q]" {
>>> setBatchMode(true);
>>>
>>> run("Raw...", "open... image=8-bit width=512 height=512 offset=128
>>> number=1 gap=0");
>>>
>>> row=nResults;
>>>
>>> getRawStatistics(area, mean, min, max, std, histogram);
>>>
>>> f=0;
>>> for(n=0;n<128;n++){
>>> if(histogram[n]>f){
>>> f=histogram[n];
>>> peak1=n;
>>> } }
>>> setResult("Brominated",row,peak1);
>>>
>>> g=0;
>>> for(o=255; o>127; o--) {
>>> if(histogram[o]>g){
>>> g=histogram[o];
>>> peak2=o;
>>> }
>>> }
>>> setResult("Iodinated",row,peak2);
>>>
>>> name = getTitle();
>>> setResult("Label", row, name);
>>> updateResults();
>>> }
>>>
>>> --
>>> Michael Doube BPhil BVSc MRCVS
>>> MPhil / PhD Student
>>> Dental Institute
>>> Barts and The London School of Medicine and Dentistry
>>> Queen Mary, University of London
>>> New Rd
>>> London E1 1BB
>>> United Kingdom
>>>
>>> Phone +44 (0)20 7377 7000 ext 2681
>>
>>
>
--
Michael Doube BPhil BVSc MRCVS
MPhil / PhD Student
Dental Institute
Barts and The London School of Medicine and Dentistry
Queen Mary, University of London
New Rd
London E1 1BB
United Kingdom
Phone +44 (0)20 7377 7000 ext 2681