Login  Register

Re: batching imageCalculator (please NOT spam)

Posted by Christophe CHAMOT on Jul 05, 2006; 10:26am
URL: http://imagej.273.s1.nabble.com/batching-imageCalculator-please-NOT-spam-tp3702275p3702276.html

gianpaolo rando a écrit :

> I don't know why the server consider my message as spam...
> anycase...
>  
>> Hi everybody, this is my first post.
>>
>> I've two directories:
>>       dirA = getDirectory("Choose
>> SourceA Directory ");
>>       dirB = getDirectory("Choose
>> SourceB Directory ");
>> both containing a lot of image files with the same title (1, 2, 3).
>>
>> I need to write a macro that subtract image B/1 to A/1, B/2 to
>> A/2, B/3 to A/3...
>>
>> some suggestions?
>>
>> Gianpaolo Rando
>> University of Milan
>>    
>
>  
Hi listers,

You can try something like this macro:

-------Snip-----------

dirA = getDirectory("Choose source A Directory ");
listA = getFileList(dirA);
//print(""+dirA+listA[i]);
dirB = getDirectory("Choose source B Directory ");
listB = getFileList(dirB);
//print(""+dirB+listB[i]);
count=1;
for (i=0; i<listA.length; i++) {
open(""+dirA+listA[i]);
rename("A");
open(""+dirB+listB[i]);
rename("B");
imageCalculator("Subtract create", "A","B");
saveAs("Tiff", "/home/kriss/Desktop/C/Result"+count+".tif");
count++;
close();
close();
close();
}

-------Snap-----------

Hope it helps ...

--
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/
---------------------------------------------------------------------