Individual selections in a stack - imageJ

Hello,

I have a stack of images, and I would like to:

  1. Create a selection from a threshold - same threshold range, but separate selection for each image in the stack (according to the threshold pattern in each image).
  2. Save the selections and apply them to a different image stack (in the same order as the first stack).

However, if I “Create selection” after setting the threshold, the created selection is that for the current image in the stack and does not change for each image in the stack. The stack consists of nearly 200 images, thus I would really prefer to process the whole stack at once. Would appreciate help.

Hello Aleksandra,

What I would do is add your selections to the region of interest manager, either manually or with a macro, an then restore them slice by slice, again either manually or with a macro. This macro code should do what you want automatically, just change the threshold numbers after “setThreshold” to the range you want (currently at 20-255).

//--------------------begin------------------
 for (n=1; n<=nSlices; n++) {
  setSlice(n);
setThreshold(20, 255);
run("Create Selection");
roiManager("Add");
}

waitForUser("open your second stack");

r = roiManager("count");
 for (i=r-1; i>=0; i--) {
roiManager("select", i);
     roiManager("Measure");
}
//------------------------end------------------

Best,
Christine