Re: Subtraction of images in two folders
Posted by
Herbie on
Mar 02, 2016; 10:04pm
URL: http://imagej.273.s1.nabble.com/Subtraction-of-images-in-two-folders-tp5015773p5015774.html
Ramon,
in the loop you may try:
open(dir1+listOD[i]);
img1 = getImageID();
open(dir2+listOC[i]);
img2 = getImageID();
imageCalculator("Subtract", img1, img2);
selectImage(img1);
save(getDirectory("imagej")+"/"+newDir+"/"+(i+1)+".tif");
close();
close();
... and perhaps you should use
setBatchMode(false);
at the end of your macro.
... and as far as I know
showProgress();
doesn't work this way. Read the manual!
HTH
Herbie
:::::::::::::::::::::::::::::::::::::::::
Am 02.03.16 um 21:36 schrieb Ramon Silva:
> Hi, i'm trying to do a subtraction of binary images, but what i receive as
> result of subtraction is a white image. If you could help me with this
> problem i'll appreciate it, because i don't know what is going wrong in my
> code (ps.: i'm a beginner).
> Since now, thank you!
>
> Here's my actual code:
>
> requires("1.38o");
> showMessage("Folder 1")
> dir1 = getDirectory("Choose a Directory ");
> showMessage("Folder 2:")
> dir2 = getDirectory("Choose a Directory ");
> listOD = getFileList(dir1);
> listOC = getFileList(dir2);
> newDir = "NeuroretinalRim";
> File.makeDirectory(newDir);
> setBatchMode(true);
> for (i=0; i<listOD.length; i++) {
> showProgress(i, listOD.length);
> open(dir1+listOD[i]);
> open(dir2+listOC[i]);
> imageCalculator("Subtract", listOD[i], listOC[i]);
> save(getDirectory("imagej")+"//"+newDir+"//"+(i+1)+".tif");
> }
>
--
ImageJ mailing list:
http://imagej.nih.gov/ij/list.html