Selecting region without turning it white

Hi all,
I am relatively new to ImageJ/Fiji- my apologies for anything that is unclear.

I’ve been tasked to obtain cell metrics of cells on a striped fluorescent background. To figure out if the cell is on or off the stripe, I have used a multi Otsu thresholding method that produces an image of the cells and an image of the background (and a third image, which I discard). To determine if the cell is on or off the stripes, my idea was to:

  1. Threshold both images.
  2. Use “Analyze Particles” on the cell image to add the cells to the ROI manager.
  3. Use getContainedPoints() to obtain a list of pixels for each cell.
  4. For each cell, select those pixels in the background image using makeSelection().
  5. Use the getValue() function to determine the mode of the region- if those pixels are mostly black (off stripe) or white (on stripe).

Step 4 is the one I am having issues with. When using the makeSelection() function, it goes to the background image and makes the selection white regardless of if it was black or white originally. I want to select the region but keep the color of the original background image.

If anybody has any ideas on how to make this selection without changing the color of the region on the background image, or even ideas on how to determine what part of the background the cell is on in general, I would appreciate it!

Hi @kasmith
welcome to the forum.

You want to analyze the original image intensity in particle areas - segmented by thresholding?

If so, you can use the ‘Redirect to’ option in ‘Analyze>Set Measurment’.
With this option the analysis/measurement will use the segmented image for particle detection and the ‘redirected’ image for intensity measurement.

More information can be found in:
https://imagej.nih.gov/ij/docs/guide/146-30.html#sub:Set-Measurements

Redirect to 
The image selected from this popup menu will be used as the target
for statistical calculations done by Analyze▷Measure… [m]↑ 
and Analyze▷Analyze Particles…↑ commands. 
This feature allows you to outline a structure on one image and measure
the intensity of the corresponding region in another image. 

and here
https://imagej.nih.gov/ij/macros/examples/MeasureRedirected.txt

1 Like