Re: Batch mode

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

Re: Batch mode

Hélio Miot
Hi all,
I´m trying to measure roughness characteristics
from series preprocessed of images in a folder.
I´m using the plugin "Roughness calculation", but can´t do
batch process for all the images in a specified directory.

I´ve tried the macro:

macro "Batch Ro Measure" {
    dir = getDirectory("Choose a Directory ");
    list = getFileList(dir);
        setBatchMode(true);
    print("#,","Rq,","Ra,","Rsk,","Rku,");
    for (i=0; i<list.length; i++) {
        path = dir+list[i];
        showProgress(i, list.length);
        if (!endsWith(path,"/")) open(path);
        if (nImages>=1) {
            run("Roughness calculation");
            close();
            Rq= getResult("Rq",0);
            Ra= getResult("Ra",0);
            Rsk= getResult("Rsk",0);
            Rku= getResult("Rku  ",0);
            print(list[i],",",Rq,",",Ra,",",Rsk,",",Rku);
        }
    }
}

But It doesn´t work.

Can you help me?

Hélio A. Miot
Professor Assistente Doutor
Departamento de Dermatologia, S/N
Faculdade de Medicina da UNESP
Campus Universitário de Rubião Jr.
18618-000  -  Botucatu - SP - Brasil
Reply | Threaded
Open this post in threaded view
|

Re: Batch mode

Wayne Rasband
The Roughness Calculation plugin outputs results in a format that is  
not compatible with the getResult() macro function. You need to  
either modify the macro so it uses the getInfo() function, or use the  
File>Import>Image Sequence command to open the images as a virtual  
stack and run the plugin on the stack.

    macro "Batch Ro Measure" {
       dir = getDirectory("Choose a Directory ");
       list = getFileList(dir);
       setBatchMode(true);
       for (i=0; i<list.length; i++) {
           path = dir+list[i];
           showProgress(i, list.length);
           if (!endsWith(path,"/")) open(path);
           if (nImages>=1) {
               run("Roughness calculation");
               close();
               selectWindow("Results");
               lines = split(getInfo(), "\n");
               if (i==0)
                   print(lines[0]); //headings
               print(lines[1]);
           }
       }
    }

-wayne

On Jul 6, 2008, at 5:59 PM, Hélio Miot wrote:

> Hi all,
> I´m trying to measure roughness characteristics
> from series preprocessed of images in a folder.
> I´m using the plugin "Roughness calculation", but can´t do
> batch process for all the images in a specified directory.
>
> I´ve tried the macro:
>
> macro "Batch Ro Measure" {
>    dir = getDirectory("Choose a Directory ");
>    list = getFileList(dir);
>        setBatchMode(true);
>    print("#,","Rq,","Ra,","Rsk,","Rku,");
>    for (i=0; i<list.length; i++) {
>        path = dir+list[i];
>        showProgress(i, list.length);
>        if (!endsWith(path,"/")) open(path);
>        if (nImages>=1) {
>            run("Roughness calculation");
>            close();
>            Rq= getResult("Rq",0);
>            Ra= getResult("Ra",0);
>            Rsk= getResult("Rsk",0);
>            Rku= getResult("Rku  ",0);
>            print(list[i],",",Rq,",",Ra,",",Rsk,",",Rku);
>        }
>    }
> }
>
> But It doesn´t work.
>
> Can you help me?
>
> Hélio A. Miot
> Professor Assistente Doutor
> Departamento de Dermatologia, S/N
> Faculdade de Medicina da UNESP
> Campus Universitário de Rubião Jr.
> 18618-000  -  Botucatu - SP - Brasil