Posted by
Michael Doube-2 on
Nov 08, 2005; 11:26am
URL: http://imagej.273.s1.nabble.com/Malfunctioning-Macro-tp3704517p3704519.html
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