Dear All,
I have encountered a problem using the particle analyzer and I was wondering whether anybody had a suggestion for a solution. 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. -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html Test.tif (11K) Download Attachment |
Good day Volko,
did you try making ring-ROIs from two circular selections using the XOR-feature of the ROI-manager? Here is an example macro: // ROI-xor Demo newImage("Test", "8-bit ramp", 256, 256, 1); makeOval(52, 59, 128, 128); roiManager("Add"); run("Enlarge...", "enlarge=-16"); roiManager("Add"); roiManager("Select", newArray(0,1)); roiManager("XOR"); roiManager("Add"); roiManager("Select", newArray(0,1)); roiManager("Delete"); roiManager("Show All with labels"); Regards Herbie :::::::::::::::::::::::::::::::::::::::::::::::::::: Am 23.07.18 um 09:00 schrieb Straub, Volko A. (Dr.): > Dear All, > > > I have encountered a problem using the particle analyzer and I was wondering whether anybody had a suggestion for a solution. > > 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. > > > > -- > ImageJ mailing list: http://imagej.nih.gov/ij/list.html > -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
In reply to this post by Straub, Volko A. (Dr.)
On Monday, 23 July 2018 08:00:14 BST Straub, Volko A. (Dr.) wrote:
> 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 will not strictly answer your question on ROIs but might be a useful alternative if you do not find a solution. Rather than using ROIs I prefer using a binary mask of the objects to analyse and get the pixel data via Redirection. I use Particles 8 for this, it restricts the data collection to the pixels set in white in the mask. It you chose redirection it automatically gets the pixel stats (gresycale or RGB). Cheers Gabriel -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Thanks Herbie & Gabriel for your suggestions.
The suggestion to use the 'Enlarge' function with the ROI managers 'XOR feature' to create the rings resulted in significant speed improvements compared to using the 'Make Band' function. The relative speed improvements are dependent on number of particles and image size, and are particularly striking for larger images with many particles. For example, for an image with 120 particles (image size 664x650 pixels), using the XOR approach is about 2x faster than the 'Make Band' approach. For an image with 1300 particles (image size 2504x2320 pixels), the speed improvement is about 5x. I was surprised by this as using the 'XOR feature' requires the temporary creation of 3x as many ROIs (original ROI, enlarge ROI and combination of the two). Gabriel's suggestion to use binary masks and redirect the measurements to the original image seems even faster, but can cause problems when the creation of the ring masks by dilation and subsequent subtraction of the original image leads to contact between neighbouring particles. This can be avoided by using some non-merging dilation, but I found that the order in which the measurements of the ring masks and the cores (original particles) are shown in the results table are not necessarily the same (probably because some of the rings are incomplete due to the way they where created). This is a problem as I try to compare measurements of the core and the surrounding area, and at the moment I can't figure out a simple way to check that core and surrounding area measurements correspond. Thanks again, Volko ________________________________ From: Gabriel Landini <[hidden email]> Sent: 23 July 2018 11:22:22 To: [hidden email] Subject: Re: Problem with creating ring like ROIs with particle analyzer On Monday, 23 July 2018 08:00:14 BST Straub, Volko A. (Dr.) wrote: > 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 will not strictly answer your question on ROIs but might be a useful alternative if you do not find a solution. Rather than using ROIs I prefer using a binary mask of the objects to analyse and get the pixel data via Redirection. I use Particles 8 for this, it restricts the data collection to the pixels set in white in the mask. It you chose redirection it automatically gets the pixel stats (gresycale or RGB). Cheers Gabriel -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
In reply to this post by Herbie
Dear Herbie,
can you help me with creating a ring selection? I have particles, and want to make a ring from the 10 % eroded and 10% dilated outline of the selection (several particles per one Image). After defining the eroded and the dilated Image, I used the following commands: newImage("Difference", "8-bit white", w, h, 1); roiManager('select', 2); run("Create Mask"); mask_name = getTitle(); roiManager('select', 1); run("Clear"); run("Create Selection"); roiManager("Add"); roiManager('select', 3); roiManager("Show All with labels"); but the, at the end, it Shows the last ROI, supposed to be the ring, exactly as the dilated ROI (in this case, the ROI 2). Can you help me, what did I do wrong? Thanks a lot, Vica Herbie wrote > Good day Volko, > > did you try making ring-ROIs from two circular selections using the > XOR-feature of the ROI-manager? > > Here is an example macro: > > // ROI-xor Demo > newImage("Test", "8-bit ramp", 256, 256, 1); > makeOval(52, 59, 128, 128); > roiManager("Add"); > run("Enlarge...", "enlarge=-16"); > roiManager("Add"); > roiManager("Select", newArray(0,1)); > roiManager("XOR"); > roiManager("Add"); > roiManager("Select", newArray(0,1)); > roiManager("Delete"); > roiManager("Show All with labels"); > > Regards > > Herbie > > :::::::::::::::::::::::::::::::::::::::::::::::::::: > Am 23.07.18 um 09:00 schrieb Straub, Volko A. (Dr.): >> Dear All, >> >> >> I have encountered a problem using the particle analyzer and I was >> wondering whether anybody had a suggestion for a solution. >> >> 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. >> >> >> >> -- >> ImageJ mailing list: http://imagej.nih.gov/ij/list.html >> > > -- > ImageJ mailing list: http://imagej.nih.gov/ij/list.html -- Sent from: http://imagej.1557.x6.nabble.com/ -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Greetings Vica,
you did not tell us about 10% of *what*. If the RoI is circular,r it may be the diameter but if the RoI-shape is arbitrary things become less defined. In the following I use the Feret. // requires("1.53g") run("Create Selection"); sz = 0.1*getValue("Feret"); roiManager("Add"); run("Enlarge...", "enlarge="+sz); roiManager("Add"); roiManager("select", 0); sz = -sz; run("Enlarge...", "enlarge="+sz); roiManager("Add"); roiManager("select", 0); roiManager("delete"); roiManager("Select", newArray(0,1)); roiManager("XOR"); roiManager("Add"); roiManager("Select", newArray(0,1)); roiManager("delete"); roiManager("show all without labels"); roiManager("select", 0); exit(); // Attached please find a test image that I used. HTH Herbie :::::::::::::::::::::::::::::::::: Am 11.01.21 um 06:36 schrieb Vica: > Dear Herbie, > > can you help me with creating a ring selection? I have particles, and want > to make a ring from the 10 % eroded and 10% dilated outline of the selection > (several particles per one Image). > After defining the eroded and the dilated Image, I used the following > commands: > > > newImage("Difference", "8-bit white", w, h, 1); > roiManager('select', 2); > run("Create Mask"); > mask_name = getTitle(); > roiManager('select', 1); > run("Clear"); > run("Create Selection"); > roiManager("Add"); > roiManager('select', 3); > roiManager("Show All with labels"); > > but the, at the end, it Shows the last ROI, supposed to be the ring, exactly > as the dilated ROI (in this case, the ROI 2). > Can you help me, what did I do wrong? > > Thanks a lot, > Vica > > > Herbie wrote >> Good day Volko, >> >> did you try making ring-ROIs from two circular selections using the >> XOR-feature of the ROI-manager? >> >> Here is an example macro: >> >> // ROI-xor Demo >> newImage("Test", "8-bit ramp", 256, 256, 1); >> makeOval(52, 59, 128, 128); >> roiManager("Add"); >> run("Enlarge...", "enlarge=-16"); >> roiManager("Add"); >> roiManager("Select", newArray(0,1)); >> roiManager("XOR"); >> roiManager("Add"); >> roiManager("Select", newArray(0,1)); >> roiManager("Delete"); >> roiManager("Show All with labels"); >> >> Regards >> >> Herbie >> >> :::::::::::::::::::::::::::::::::::::::::::::::::::: >> Am 23.07.18 um 09:00 schrieb Straub, Volko A. (Dr.): >>> Dear All, >>> >>> >>> I have encountered a problem using the particle analyzer and I was >>> wondering whether anybody had a suggestion for a solution. >>> >>> 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. >>> >>> >>> >>> -- >>> ImageJ mailing list: http://imagej.nih.gov/ij/list.html >>> >> >> -- >> ImageJ mailing list: http://imagej.nih.gov/ij/list.html > > > > > > -- > Sent from: http://imagej.1557.x6.nabble.com/ > > -- > ImageJ mailing list: http://imagej.nih.gov/ij/list.html > -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html Test-Pattern.png (1K) Download Attachment |
In reply to this post by Straub, Volko A. (Dr.)
> 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. > > <snip> > > 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. Upgrade to the latest daily build (1.53h37) and use the particle analyzer’s “Composite ROI” option, as in the following example. -wayne requires("1.53h"); newImage("Untitled", "8-bit black", 500, 500, 1); makeOval(73, 51, 168, 154); run("Invert"); makeOval(121, 89, 83, 84); run("Invert"); makeOval(254, 250, 165, 182); run("Invert"); makeOval(300, 305, 74, 78); run("Invert"); run("Select None"); setOption("Area"); setAutoThreshold("Default dark"); run("Analyze Particles...", "display clear add composite"); resetThreshold; roiManager("Measure”); -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
In reply to this post by Straub, Volko A. (Dr.)
> 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 |
Thanks Wayne,
This goes some way back. Nice to have another option to create more complex ROIs directly from Analyze Particles. All the best, Volko -----Original Message----- From: Wayne Rasband <[hidden email]> Sent: 11 January 2021 18:25 To: [hidden email] Subject: Re: Problem with creating ring like ROIs with particle analyzer > 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 (https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2Fimagej.1557.x6.nabble.com%2FROI-with-holes-Particle-Analyzer-vs-ROI-Manager-td5009887.html&data=04%7C01%7Cvs64%40leicester.ac.uk%7C0ab6e0f414464337c43108d8b65e707e%7Caebecd6a31d44b0195ce8274afe853d9%7C0%7C0%7C637459864013588988%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=JgflgR2i19ozYOepbWUQkcmHWsQQqezi7100bV8Y7Aw%3D&reserved=0) 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<https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F > %2Fimagej.1557.x6.nabble.com%2FROI-with-holes-Particle-Analyzer-vs-ROI > -Manager-td5009887.html&data=04%7C01%7Cvs64%40leicester.ac.uk%7C0a > b6e0f414464337c43108d8b65e707e%7Caebecd6a31d44b0195ce8274afe853d9%7C0% > 7C0%7C637459864013588988%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiL > CJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=JgflgR2 > i19ozYOepbWUQkcmHWsQQqezi7100bV8Y7Aw%3D&reserved=0> > 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: https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2Fimagej.nih.gov%2Fij%2Flist.html&data=04%7C01%7Cvs64%40leicester.ac.uk%7C0ab6e0f414464337c43108d8b65e707e%7Caebecd6a31d44b0195ce8274afe853d9%7C0%7C0%7C637459864013588988%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=KDA9mfr8jaNtC93SzjVTv5E5KGq2zCI8WsR%2BLebU16c%3D&reserved=0 -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Free forum by Nabble | Edit this page |