subtract an image from a sequence of images

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

subtract an image from a sequence of images

Agathe R
Hello,

i habe been succesfully using subtract on single images (I subtract 1 image from another image) (using the option 32-bits float result).
When I do the same on a sequence of images though (I subtract 1 image from a sequence of image), the result is different (the new images look binary, only back or white pixels, no grey), so the result is not usable because I loose so much pixel information.

Has someone faced this issue and found a solution?

Thank you, Agathe

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: subtract an image from a sequence of images

Wayne Rasband-2
> On Jun 8, 2019, at 4:51 PM, Agathe R <[hidden email]> wrote:
>
> Hello,
>
> i habe been succesfully using subtract on single images (I subtract 1 image from another image) (using the option 32-bits float result).
> When I do the same on a sequence of images though (I subtract 1 image from a sequence of image), the result is different (the new images look binary, only back or white pixels, no grey), so the result is not usable because I loose so much pixel information.
>
> Has someone faced this issue and found a solution?

The following macro subtracts the currently open image from all the images in a folder and saves the resulting images in another folder.

-wayne


  dir1 = getDirectory("Choose Source Folder ");
  dir2 = getDirectory("Choose Destination Folder ");
  setBatchMode(true);
  list = getFileList(dir1);
  name2 = getTitle;
  for (i=0; i<list.length; i++) {
     name = list[i];
     open(dir1+name);
     print(i, name);
     imageCalculator("Subtract create 32-bit", name, name2);
     close();
     selectWindow(name);
     close;
     //print(i, nImages, name);
  }

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html