How can I analyse ROIs within segmented cells?

Hi all,

Can I somehow use two instances of the particle analyser or use it in nested loops?

I have an ImageJ macro in which cells are segmented and added to the particle analyser to loop over the cells in each frame. Now within each cell (each of which is a ROI) I threshold particles of which I would like to analyse the area and other features and count the particles. How could I do this if the particle analyser already holds the cells as ROIs?

Cheers,
Anne

One solution is to crop the Cell ROI and then perform the further analysis within the crop. Depends a bit what you want to do. For certain measurements this might not even be necessary since they can be done within the ROI Manager.

I would still do all image processing steps on the entire image, it is more efficient that way. Then Crop the processed image (duplicate the large image first or better use the duplicate command with the ROI selected)

I duplicate the cell ROI and then do the further analysis, is this what you mean?
However since I am looping over time-lapse frames and within each frame over many cells (which I duplicate) and within these cells I would like to threshold particles and count them, I still have the cells in the particle analyser in this case so I cannot add the particles. Maybe I don’t understand your suggestion.

The reason for doing the analysis on the single-cell level is that I threshold the particles based on the single-cell fluorescence.

I tried outlining what I would like to do:

getDimensions(width, height, channels, slices, frames);
for (s = 0; s < frames; s++) {
		Stack.setFrame(s+1);
		run("Select None");
		run("Duplicate...", "title=1");
		//some processing in between here
		
		getStatistics(area, mean, min, max, std, histogram);
		setThreshold(0.9*mean, max);
		setOption("BlackBackground", true);
		run("Create Mask");
		
		roiManager("reset");
		run("Analyze Particles...", "size=100-5000 add");

		selectWindow("original image");
		cells = roiManager("count");
		
		for (i = 0; i < cells; i++) {
			roiManager("select", i);
			run("Duplicate...");
			getStatistics(area, mean, min, max, std, histogram);
			run("Select None");
			setThreshold(2*mean, max);
			run("Create Selection");
			//here I would like to count the number of regions per cell that are thresholded
			//ideally for each particle:
			getStatistics(area, mean, min, max, std, histogram);
		}
	}

Ok you do not need to go via the ROI manager to get the count or statistics of your particles:

You can select display results to get statistics for each particle and summarize to get the count and mean statistics:

run("Set Measurements...", "area mean standard modal min redirect=None decimal=9");
run("Analyze Particles...", "display summarize");

Thanks a lot, this helps!

And yes I meant the ROI manager and not the particle analyser, I somehow just assumed that I need to use them together.