Posted by
Wayne Rasband-2 on
Jan 11, 2021; 6:25pm
URL: http://imagej.273.s1.nabble.com/Problem-with-creating-ring-like-ROIs-with-particle-analyzer-tp5020989p5024361.html
> On Jul 23, 2018, at 3:00 AM, Straub, Volko A. (Dr.) <
[hidden email]> wrote:
>
> Dear All,
>
> I have encountered a problem using the particle analyzer and I was wondering whether anybody had a suggestion for a solution.
Hi Volko,
Here is an updated version of your test macro that works as expected. It requires ImageJ 1.53g (or newer), which added the “Composite ROI” option to the particle analyzer.
-wayne
requires("1.53g");
run("Duplicate...", "title=Nuclei");
setAutoThreshold("Default dark no-reset");
setOption("BlackBackground", true);
run("Convert to Mask");
run("Set Measurements...", "area mean center decimal=1");
run("Analyze Particles...", "display clear add");
for(i=0;i<roiManager("count");i++) {
roiManager("Select", i);
run("Make Band...", "band=2");
roiManager("Update");
};
run("Select None");
run("Duplicate...", "title=Border");
run("Maximum...", "radius=2");
imageCalculator("Subtract", "Border","Nuclei");
run("Analyze Particles...", "display add composite");
roiManager("multi-measure append");
selectWindow("Test.tif");
roiManager("multi-measure append");
> I am trying to create ring-like ROIs to measure the intensity around a central region. I can create the ring-like ROIs by first creating a selection of the central regions using the particle analyzer and then use the 'Make Band' function to create rings for each ROI. This is okay, but gets very slow when images are large and contain hundreds or thousands of ROIs.
>
> So, instead I tried to use the maximum filter to dilate the ROIs and then subtract the original ROIs. This produces the desired rings, which can be analysed with the particle analyzer. This works and inspecting the measurement in the results table shows the expected results. However, when these regions are added to the ROI manager, the ROIs now include the central hole rather than just the ring. So, any subsequent measurements using these ROIs measure not just the ring but the ring plus the hole.
>
> This issue has previously been discussed on the mailing list (
http://imagej.1557.x6.nabble.com/ROI-with-holes-Particle-Analyzer-vs-ROI-Manager-td5009887.html) and the suggested solution was to use the 'Limit to Threshold' option in measurements. That works okay for the binary images of the rings, however I can't get this to work if I want to use the ROIs to measure the pixel intensity on another image. I also tried to use the redirect option in "Set Measurements", but I don't seem to get this to work either.
>
>
> I attach a small sample image and some macro to illustrate the issue. The image contains three nuclei. I am trying to measure the intensity of the ring around the nuclei. The first three ROIs are created using the 'Make Band' function, while ROIs 4-6 are created by dilation and subsequent subtraction of the original image. Both approaches produce the same results for measurements on the binary 'Border' image (compare results 1-3 and 4-6). However, using the ROIs to measure the intensity of the ROIs on the original image ('Test') produces different results for the ROIs created using the 'Make Band' function (1-3) and the ROIs created by dilation and subsequent subtraction (4-6) as these ROIs contain the whole area and not just the ring.
>
>
> Sorry for the lengthy email. I hope that this makes sense and would be very grateful for any suggestions.
>
> Thanks,
>
> Volko
>
>
>
> Test Macro:
>
>
> image=getTitle();
> run("Duplicate...", "title=Nuclei");
> setAutoThreshold("Default dark no-reset");
> setOption("BlackBackground", true);
> run("Convert to Mask");
>
> run("Set Measurements...", "area mean center limit redirect=None decimal=1");
> run("Analyze Particles...", "display clear add");
> for(i=0;i<roiManager("count");i++){
> roiManager("Select", i);
> run("Make Band...", "band=2");
> roiManager("Update");
> };
>
> run("Select None");
> run("Duplicate...", "title=Border");
> run("Maximum...", "radius=2");
> imageCalculator("Subtract", "Border","Nuclei");
> run("Analyze Particles...", "display add");
>
> setThreshold(100,255);
>
> roiManager("multi-measure append");
> selectWindow("Test");
> roiManager("multi-measure append");
>
>
> ImageJ - ROI with holes / Particle Analyzer vs. ROI Manager<
http://imagej.1557.x6.nabble.com/ROI-with-holes-Particle-Analyzer-vs-ROI-Manager-td5009887.html>
> imagej.1557.x6.nabble.com
> ROI with holes / Particle Analyzer vs. ROI Manager. Dear all, the Particle Analyzer can "exclude" holes when measuring particles, gives reasonable results on my data.
>
> <Test.tif>
--
ImageJ mailing list:
http://imagej.nih.gov/ij/list.html