NIH Image to ImageJ macro question

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

NIH Image to ImageJ macro question

rjhomer
Hi

Many years ago I wrote a simple macro for the old NIH Image.

I have never updated it to apply to ImageJ but would like to do so  
now. Unfortunately, after reviewing the documentation available, I  
don't see how to do this.  I have no background in Java at all.

The macro I wrote operates on a series of already opened images,  
applies a filter to each, applies a math operation between the  
filtered file and a pre-existing grid, analyzes the resultant image,  
then does the same with a second grid, analyzes this image too, then  
closes the image.

I can easily do the image analysis on a single image but don't see how  
to automate the process (e.g. open up one image, analyze it, close it,  
open the next, etc). I realize that this must have something to do  
with the batch function, but don't see how to do it.

I have included my old macro below. If anyone can help, I would  
appreciate it.


Robert Homer




procedure  processimage;

var g,intval:integer;

begin
        IntVal:=GetNumber('Set Threshold(1--255):',50);
        for g:=1 to nPics do begin
                                                        choosePic(g);
                                                                SetThreshold(IntVal);
                                                                        MakeBinary;Filter('Median');filter('median'); Invert;
                                                        end;
end;


procedure chordlength;

var g,d,e:integer

begin
        for g:=1 to nPics do begin
                                                choosepic(g);
                                        d:=picnumber;
                                                Open('power hd:applications:graphics:NIH Image  
1-60:macros:gridxx');
                                                e:=PicNumber;
                                                ImageMath('and',d,e,1,0,'result');
                                                AnalyzeParticles('ignore');Dispose;
                                                choosePic(e);Dispose;
                                                Open('power hd:applications:graphics:NIH Image  
1-60:macros:gridyy');
                                                        e:=PicNumber;
                                                imageMath('and',d,e,1,0,'Result');
                                                AnalyzeParticles('ignore');Dispose;
                                                ChoosePic(e); Dispose;
end;
end;
macro 'Chord excluding edges-pic  [A]';

var IntVal,g,d,e,i:integer; sum:real; file:string;

begin
       
                SetPrecision(2,8);
       
                SetParticleSize(15,500000);
                SetOptions('Area');
        ResetCounter;
                SetScale(1,'pixel',1);

        processimage;
        chordlength;

        SetUser1Label('mean');
file:=WindowTitle;
                sum:=0;
                for i:=1 to rCount do
                                sum:=sum+rArea[i];
                                rUser1[rCount]:=sum/(rCount*1.5);
                                UpdateResults;
                                SetExport('measurements');
                                Export('chord length',  file);
                       
                end;
end;