Apply 2D mask to stack to create ROIs, then analyze ROIs

Dear folks,

Currently I am looking at analyzing particles in a stack. Segmenting these properly was not straightforward: there is quite some variation in intensity in the stack depending on depth and orientation of particles, combined with noise. I had no luck with the 3D ImageJ suite with this particular data set. I faffed a bit with WEKA, though did not manage to segment the image such that I am happy with it.

I now take the following approach to segment and then analyze:

Via a z-projection I create a 2D mask to use on the stack from which the projection is created:

I create ROIs with the mask and the ROI manager (I use the wand tool to select the particles 1 by 1 as advised here Binary mask to roi?):

On the right you see the stack with the ROIs overlaying the stack. Now I am exporting substacks of each ROI:

n = roiManager("count");
if (n==0) {	exit("The ROI Manager is empty");}
for (i=0; i<n; i++) {
	roiManager('select', i);
	run("Duplicate...", "[flake_]"+i+" duplicate"); 
	run("Clear Outside", "stack");
	//saveAs("Tiff", "MyDir/ball_"+i+".tif");

Then for each particle / ROI I later perform analysis to extract angle information from the XZ and YZ orthogonal images. See here the views of ball_3:

My questions:

  • Is it possible to create ROIs with the 2D mask faster / automatically? Currently I click and add each particle 1 by 1. Some of the datasets really contain looooots of particles. This would save quite some time.
  • Is it possible to avoid having to save stacks for each particle individually and perform analysis on these, and could I do it somehow apply the 2D mask to the stack and then perform analysis ROI per ROI?
1 Like

Hi @Danielle_Z

To answer your first question, have you tried the following in your 2D mask image:

  1. Edit > Selection > Create Selection, which will create a combined ROI of all the particles in the image.
  2. Add the combined ROI to the ROI Manager, then go to More > Split in the ROI manager. This will create individual ROIs for each particle.

I recently used this approach to count number of shapes (circles, squares, triangles) in an image (check it out here).



Thanks so much, More > Split works well for me :slight_smile: I had not noticed this option before. Happy (Fri)days!