save results

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

save results

Paul Batty
G'day folks

I am new to image and would like to save results genrated from a macro I have written without having to do each one manually? I am trying to determine the area of a burrow structure, my macro goes as follows:

run("Set Measurements...", "area redirect=None decimal=3");
open("G:\\t-SPI COBO\\S1_cropped_tiffs\\processed images\\I_6.tif");
run("Set Scale...", "distance=16 known=1 pixel=1 unit=mm global");
run("8-bit");
run("Threshold");
run("Analyze Particles...", "size=0-Infinity circularity=0.00-1.00 show=Masks summarize");
saveAs("Text", "G:\\t-SPI COBO\\S1_cropped_tiffs\\results\\Summary of I_6.txt");
close();
close();


Thanks in advance

Paul.
Reply | Threaded
Open this post in threaded view
|

Re: save results

Christophe CHAMOT
Paul Batty a écrit :

> G'day folks
>
> I am new to image and would like to save results genrated from a macro I have written without having to do each one manually? I am trying to determine the area of a burrow structure, my macro goes as follows:
>
> run("Set Measurements...", "area redirect=None decimal=3");
> open("G:\\t-SPI COBO\\S1_cropped_tiffs\\processed images\\I_6.tif");
> run("Set Scale...", "distance=16 known=1 pixel=1 unit=mm global");
> run("8-bit");
> run("Threshold");
> run("Analyze Particles...", "size=0-Infinity circularity=0.00-1.00 show=Masks summarize");
> saveAs("Text", "G:\\t-SPI COBO\\S1_cropped_tiffs\\results\\Summary of I_6.txt");
> close();
> close();
>
>
> Thanks in advance
>
> Paul.
>
>  
Hello Paul,

What about a loop ? (if your images are indexed from 1 to 12 for instance)

run("Set Measurements...", "area redirect=None decimal=3");
for(i=1;i<12;i++){
open("G:\\t-SPI COBO\\S1_cropped_tiffs\\processed images\\I_"+i+".tif");
run("Set Scale...", "distance=16 known=1 pixel=1 unit=mm global");
run("8-bit");
run("Threshold");
run("Analyze Particles...", "size=0-Infinity circularity=0.00-1.00
show=Masks summarize");
saveAs("Text", "G:\\t-SPI COBO\\S1_cropped_tiffs\\results\\Summary of
I_"+i+".txt");
close();
close();
}

Hope it helps,

Chris

--
Christophe CHAMOT
---------------------------------------------------------------------
Plate-Forme  de Recherche IFR117
"Imageries des Processus Dynamiques
en Biologie  Cellulaire et Biologie du Développement "
Institut Jacques Monod, CNRS,  Universités Paris 6 et 7
2, place Jussieu - Tour 43
75251 Paris cedex  05
Tel: 01 44 27 47 56
fax: 01 44 27 98 57
http://www.ijm.jussieu.fr/
---------------------------------------------------------------------  
Reply | Threaded
Open this post in threaded view
|

Re: save results

Michael Miller
In reply to this post by Paul Batty
I imagine the macro you have works very nicely for single images that are
already open.
Save that and keep it :-D you did all the hard work for us!

Replace "main_process.txt" with whatever you saved your "single file" macro.

Make this a separate macro, or add it to your other one and instead of
runMacro("main_process.txt") you can call a function. There are lots of ways
to organize your macros nicely.

Anyway, here's some code that will do an entire folder that you select all
at once.

---

requires("1.32");
dir = getDirectory("Choose a Directory ");
list = getFileList(dir);
// setBatchMode increases the run speed of the macro by not displaying the
actions performed.
setBatchMode(true);
for (i=0; i<list.length; i++) {
    showProgress(i/list.length);
 if (endsWith(list[i], "/") == 0) {
  imagepath = "open=" + dir + list[i];
  run("Open...", imagepath);
  runMacro("main_process.txt")
 }
}
setBatchMode(false);

--

-Mike

----- Original Message -----
From: "Paul Batty" <[hidden email]>
To: <[hidden email]>
Sent: Monday, November 20, 2006 6:41 AM
Subject: save results


> G'day folks
>
> I am new to image and would like to save results genrated from a macro I
> have written without having to do each one manually? I am trying to
> determine the area of a burrow structure, my macro goes as follows:
>
> run("Set Measurements...", "area redirect=None decimal=3");
> open("G:\\t-SPI COBO\\S1_cropped_tiffs\\processed images\\I_6.tif");
> run("Set Scale...", "distance=16 known=1 pixel=1 unit=mm global");
> run("8-bit");
> run("Threshold");
> run("Analyze Particles...", "size=0-Infinity circularity=0.00-1.00
> show=Masks summarize");
> saveAs("Text", "G:\\t-SPI COBO\\S1_cropped_tiffs\\results\\Summary of
> I_6.txt");
> close();
> close();
>
>
> Thanks in advance
>
> Paul.