run("Set Mearsurements...... How to pass a variable

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

run("Set Mearsurements...... How to pass a variable

Guy Mayor-2
Hello,

I am writing a bach macro that process all images in a folder or a tree of
folders. I would like to iteratively use a

run("Set Measurements...", "area mean standard modal min perimeter fit
circularity feret's integrated redirect=None decimal=0");

followed by several

run("Distribution...", "parameter=Area or=50 and=2");
run("Distribution...", "parameter=Feret or=50 and=2");
....

To generate several distribution pictures for each processed picture

I have not been able to find a correct syntaxe to assigne
"redirect=imagename" to a variable (the changing image name). I can only
pass "None" or the name of an open image in the popup menu

Is it any way to pass a variable in this setup?

If not, how could I achieve this goal at macro level?


Thanks for any help or suggestion


Guy Mayor
Reply | Threaded
Open this post in threaded view
|

Re: run("Set Mearsurements...... How to pass a variable

Ben Tupper
On Oct 27, 2008, at 7:22 AM, Guy Mayor wrote:

> Hello,
>
> I am writing a bach macro that process all images in a folder or a  
> tree of
> folders. I would like to iteratively use a
>
> run("Set Measurements...", "area mean standard modal min perimeter fit
> circularity feret's integrated redirect=None decimal=0");
>
> followed by several
>
> run("Distribution...", "parameter=Area or=50 and=2");
> run("Distribution...", "parameter=Feret or=50 and=2");
> ....
>
> To generate several distribution pictures for each processed picture
>
> I have not been able to find a correct syntaxe to assigne
> "redirect=imagename" to a variable (the changing image name). I can  
> only
> pass "None" or the name of an open image in the popup menu
>

Hi,

You should be able to split the string and insert you image name.  
Something like the following...

run("Set Measurements...", "area mean standard modal min perimeter fit
circularity feret's integrated redirect=" + myImageName +" decimal=0");

Cheers,
Ben


> Is it any way to pass a variable in this setup?
>
> If not, how could I achieve this goal at macro level?
>
>
> Thanks for any help or suggestion
>
>
> Guy Mayor
Reply | Threaded
Open this post in threaded view
|

Re: run("Set Mearsurements...... How to pass a variable

tisalon
In reply to this post by Guy Mayor-2

Dear all I'm trying to write a macro that open all the movies (*.dv) inside a
file and then substract the background of two channels. This is the code
that I have till now but it seems that the command save does not work and
also does not make any substraction, just open the movies and split the
channels:

dir1 = getDirectory("C:\Users\p250572\Desktop\Santi\training");
list = getFileList(dir1);
dir2 = dir1+"analysed"+File.separator;
File.makeDirectory(dir2);
for (i=0; i<list.length; i++)
       {

       if (File.isDirectory(dir1+list[i])){}
       else{

               path = dir1+list[i];
               if (endsWith(path, ".db")){}
               else{

                       open(path);
                       if (bitDepth!=24){}  
                       else {
                               setBatchMode(true);
                               title = File.nameWithoutExtension ;
                               run("Split Channels");
                               close();
                                                                selectWindow(title);
                                                                run("Subtract Background...", "rolling=50");
                               saveAs("Tiff", dir2+title+"d0.tif");
                               saveAs("Tiff", dir2+title+"d1.tif");
                               close();
                               saveAs("Tiff", dir2+title+"d2.tif");
                               close();
                               setBatchMode(false);

                               }
                       }
               }
       }

Any piece of advice will be appreciate!

Best wishes;