How can I make a ROI that is the result of the subtraction between two ROIs?
Searching docs and list archives I've only found how to make "composite selections", which are created by hand (by drawing a ROI inside another, while pressing the alt key). I have two ROIs in the ROI manager, one ROI inside the other one. I want to select the area within the bigger ROI, excluding the area of the smaller ROI. If we were talking of two circles (one inside the other), I want select the area defined by the ring between them. Any suggestions? F Javier Diez-Guerra, PhD Profesor Titular Centro de Biologia Molecular Severo Ochoa Facultad de Ciencias, Universidad Autónoma Ctra Colmenar Viejo Km 15 Cantoblanco, 28049 Madrid SPAIN phone: +34 91 4978051 Fax: +34 91 4978087 e-mail: [hidden email] |
At 09:33 AM 6/5/2007, you wrote:
>How can I make a ROI that is the result of the subtraction between two ROIs? > >Searching docs and list archives I've only found >how to make "composite selections", which are >created by hand (by drawing a ROI inside another, while pressing the alt key). > >I have two ROIs in the ROI manager, one ROI >inside the other one. I want to select the area >within the bigger ROI, excluding the area of the >smaller ROI. If we were talking of two circles >(one inside the other), I want select the area >defined by the ring between them. > >Any suggestions? Hello Javier, Here's one solution of probably many: Load the bigger ROI, then use Edit-->Selection-->Create Mask. On the new mask window that pops up, load the second smaller ROI, then use Edit-->Clear. Now use the Wand tool to automatically highlight the remaining ring region, and then add that to the RoiManager. Mark Besonen UMass Geosciences >F Javier Diez-Guerra, PhD >Profesor Titular >Centro de Biologia Molecular Severo Ochoa >Facultad de Ciencias, Universidad Autónoma >Ctra Colmenar Viejo Km 15 >Cantoblanco, 28049 Madrid >SPAIN > >phone: +34 91 4978051 >Fax: +34 91 4978087 >e-mail: [hidden email] |
In reply to this post by F Javier Díez Guerra
On Tuesday 05 June 2007 14:33:46 F Javier Diez Guerra wrote:
> How can I make a ROI that is the result of the subtraction between two > ROIs? Create the first ROI, then Edit>Selection>Make Inverse Put the result in the ROI manager Create 2nd ROI Put it in the ROI manager Select those 2 ROIs and do More>>Combine in the ROI manager. G. |
In reply to this post by Mark R. Besonen
Mark,
Thanks for your input. However, I do not manage to get the ring ROI after selecting it with the magic wand. I imagine that since the selection is closed, the magic wand takes the whole area of the bigger ROI again and not the difference. Thanks, At 16:46 05/06/2007, you wrote: >At 09:33 AM 6/5/2007, you wrote: >>How can I make a ROI that is the result of the subtraction between two ROIs? >> >>Searching docs and list archives I've only >>found how to make "composite selections", which >>are created by hand (by drawing a ROI inside >>another, while pressing the alt key). >> >>I have two ROIs in the ROI manager, one ROI >>inside the other one. I want to select the area >>within the bigger ROI, excluding the area of >>the smaller ROI. If we were talking of two >>circles (one inside the other), I want select >>the area defined by the ring between them. >> >>Any suggestions? > >Hello Javier, > >Here's one solution of probably many: > >Load the bigger ROI, then use >Edit-->Selection-->Create Mask. On the new mask >window that pops up, load the second smaller >ROI, then use Edit-->Clear. Now use the Wand >tool to automatically highlight the remaining >ring region, and then add that to the RoiManager. > >Mark Besonen >UMass Geosciences > > > > >>F Javier Diez-Guerra, PhD >>Profesor Titular >>Centro de Biologia Molecular Severo Ochoa >>Facultad de Ciencias, Universidad Autónoma >>Ctra Colmenar Viejo Km 15 >>Cantoblanco, 28049 Madrid >>SPAIN >> >>phone: +34 91 4978051 >>Fax: +34 91 4978087 >>e-mail: [hidden email] > >F Javier Diez-Guerra, PhD >Profesor Titular >Centro de Biologia Molecular Severo Ochoa >Facultad de Ciencias, Universidad Autónoma >Ctra Colmenar Viejo Km 15 >Cantoblanco, 28049 Madrid >SPAIN > >phone: +34 91 4978051 >Fax: +34 91 4978087 >e-mail: [hidden email] |
On Tuesday 05 June 2007 16:11:20 F Javier Diez Guerra wrote:
> Mark, > > Thanks for your input. However, I do not manage > to get the ring ROI after selecting it with the > magic wand. I imagine that since the selection is > closed, the magic wand takes the whole area of > the bigger ROI again and not the difference. > I just realised that what I just sent would not work for a doughnut ROI, but only for overlapping ones. G. |
In reply to this post by F Javier Díez Guerra
Hi Javier,
You are absolutely right--I just tried what I suggested, and had the same result as you, so my suggestion was incorrect. Gabriel's solution, however, does work. Sorry for not testing first--I have been using the method I wrote for the last couple of weeks as sort of a clipping path for overlapping regions, not ones that were completely contained within another. I should have tested first! Mark Besonen UMass Geosciences At 11:11 AM 6/5/2007, F Javier Diez Guerra wrote: >Mark, > >Thanks for your input. However, I do not manage >to get the ring ROI after selecting it with the >magic wand. I imagine that since the selection >is closed, the magic wand takes the whole area >of the bigger ROI again and not the difference. > >Thanks, > > >At 16:46 05/06/2007, you wrote: >>At 09:33 AM 6/5/2007, you wrote: >>>How can I make a ROI that is the result of the subtraction between two ROIs? >>> >>>Searching docs and list archives I've only >>>found how to make "composite selections", >>>which are created by hand (by drawing a ROI >>>inside another, while pressing the alt key). >>> >>>I have two ROIs in the ROI manager, one ROI >>>inside the other one. I want to select the >>>area within the bigger ROI, excluding the area >>>of the smaller ROI. If we were talking of two >>>circles (one inside the other), I want select >>>the area defined by the ring between them. >>> >>>Any suggestions? >> >>Hello Javier, >> >>Here's one solution of probably many: >> >>Load the bigger ROI, then use >>Edit-->Selection-->Create Mask. On the new >>mask window that pops up, load the second >>smaller ROI, then use Edit-->Clear. Now use >>the Wand tool to automatically highlight the >>remaining ring region, and then add that to the RoiManager. >> >>Mark Besonen >>UMass Geosciences >> >> >> >> >>>F Javier Diez-Guerra, PhD >>>Profesor Titular >>>Centro de Biologia Molecular Severo Ochoa >>>Facultad de Ciencias, Universidad Autónoma >>>Ctra Colmenar Viejo Km 15 >>>Cantoblanco, 28049 Madrid >>>SPAIN >>> >>>phone: +34 91 4978051 >>>Fax: +34 91 4978087 >>>e-mail: [hidden email] >> >>F Javier Diez-Guerra, PhD >>Profesor Titular >>Centro de Biologia Molecular Severo Ochoa >>Facultad de Ciencias, Universidad Autónoma >>Ctra Colmenar Viejo Km 15 >>Cantoblanco, 28049 Madrid >>SPAIN >> >>phone: +34 91 4978051 >>Fax: +34 91 4978087 >>e-mail: [hidden email] -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- Mark R. Besonen e-mail: [hidden email] Department of Geosciences tel: (413) 545-1755 or 545-0659 [Office] 233 Morrill Science Center tel: (413) 545-2794 [Quaternary Lab] 611 North Pleasant Street tel: (413) 577-1168 [SEM Lab] University of Massachusetts fax: (413) 545-1200 Amherst, MA 01003 http://ostracod.geo.umass.edu/besonen -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- |
In reply to this post by F Javier Díez Guerra
On Tuesday 05 June 2007 16:11:20 F Javier Diez Guerra wrote:
> Thanks for your input. However, I do not manage > to get the ring ROI after selecting it with the > magic wand. I imagine that since the selection is > closed, the magic wand takes the whole area of > the bigger ROI again and not the difference. This does it: makeOval(81, 72, 286, 286); setKeyDown("alt"); makeOval(163, 167, 126, 129); Cheers, G. |
In reply to this post by F Javier Díez Guerra
This is better. If the ROIs (0 and 1) are in the ROI manager:
roiManager("Select", 0); setKeyDown("alt"); roiManager("Select",1); setKeyDown("none") Cheers, Gabriel |
In reply to this post by F Javier Díez Guerra
Mark Besonen idea works, i've tried to record it as a macro...
Can someone help me, as I do not want to use ROI no 3 and 4, but the last and the penultimate (n th and n-1 th)? Philippe Rosay // macro sur une idée de Mark Besonen // soustraire deux régions donc une incluse dans l'autre if (roiManager("Count")!=4) exit("il n'y a pas exactement 4 ROI"); // test car on utilise la ROI 3 et 4 roiManager("Select", 2); run("Create Mask"); // on prends la partie la plus grande dans un masque ici hilus et supra roiManager("Select", 3); run("Clear"); // on selectionne la petite partie, ici le hilus et on retranche de la grande run("Create Selection"); roiManager("Add"); close(); // on selectionne le résultat, et ajoute au ROI. On ferme la fenetre masque roiManager("Select", 4); roiManager("Rename", "supra"); // simple renommage |
Philippe Rosay wrote:
> Mark Besonen idea works, i've tried to record it as a macro... > Can someone help me, as I do not want to use ROI no 3 and 4, but the last > and the penultimate (n th and n-1 th)? > Philippe Rosay > > > // macro sur une idée de Mark Besonen > // soustraire deux régions donc une incluse dans l'autre > > if (roiManager("Count")!=4) > exit("il n'y a pas exactement 4 ROI"); > // test car on utilise la ROI 3 et 4 > > roiManager("Select", 2); > run("Create Mask"); > // on prends la partie la plus grande dans un masque ici hilus et supra > > roiManager("Select", 3); > run("Clear"); > // on selectionne la petite partie, ici le hilus et on retranche de la grande > > run("Create Selection"); > roiManager("Add"); > close(); > // on selectionne le résultat, et ajoute au ROI. On ferme la fenetre masque > > roiManager("Select", 4); > roiManager("Rename", "supra"); > // simple renommage > You can use the "count" method for roiManager to get objects near the end of the roi list. roiManager("select", roiManager("count")-1); = n th roiManager("select", roiManager("count")-2); = n-1 th Cheers, Ben |
In reply to this post by F Javier Díez Guerra
I'm curious as to what the goal is; it may make the problem simpler or harder; it appears that the suggestions in this thread have all been retracted. ;-)
If it's just to visually show the subtracted area (donut) then there's really no need to subtract. If the area if the donut is needed, just to 'measure' on the roi's subtract the areas. If the goal is to actually read and/or manipulate the pixels in the donut -- well this seems really hard. First, it doesn't seem possible to represent the donut as an ROI in ImageJ as it cannot be represented as list of vertices (which, I believe, is the data held internally to represent the ROI; you would need 2 such lists. If one wanted to write some code, one could do isPixelInDonut() by traversing all the pixels in the bounding rectangle of the outer ROI and asking if the pixel was contained in the outer and not contained in the inner ROI. This would give the correct set of pixels which you would than have to handle individually. One could draw an approximation of the donut by 1. outlining the inner ROI clockwise but just as you get back to the start, 2. move to a point on the outer ROI and 3. outline it in the counter-clockwise direction and as you get back to the start of the outer, 4. move to the start of the inner. This will give a conventional ROI that will be a donut with a cut in it. If you can make the cut small enough, this might be workable. Again, if you wanted to write some code, you could take the 2 ring ROIs, get the list of vertices from each, and create a 'donut with cut' roi that would include exactly the pixels in the donut. Hope this helps <quote author="F Javier Diez Guerra"> How can I make a ROI that is the result of the subtraction between two ROIs? Searching docs and list archives I've only found how to make "composite selections", which are created by hand (by drawing a ROI inside another, while pressing the alt key). I have two ROIs in the ROI manager, one ROI inside the other one. I want to select the area within the bigger ROI, excluding the area of the smaller ROI. If we were talking of two circles (one inside the other), I want select the area defined by the ring between them. |
On Thursday 07 June 2007, Jim Cant wrote:
> I'm curious as to what the goal is; it may make the problem simpler or > harder; it appears that the suggestions in this thread have all been > retracted. ;-) No, the one I suggested last works fine. Did you try it? > If it's just to visually show the subtracted area (donut) then there's > really no need to subtract. > If the area if the donut is needed, just to 'measure' on the roi's subtract > the areas. ROIs are not only used to measure things inside, you can filter inside, do operations, etc. > First, it doesn't seem possible to represent the donut as an ROI in ImageJ > as it cannot be represented as list of vertices (which, I believe, is the > data held internally to represent the ROI; you would need 2 such lists. It is possible, this is what composite ROIs are for. Cheers, G. |
In reply to this post by Jim Cant
Thanks to everybody that has shown interest in the subtraction of ROIs thread.
The goal was to compare the distribution of several fluorescent proteins (FP) in the nucleus and cytoplasm of cells that were labelled with To-Pro3 and were imaged in a confocal microscope. From the To-Pro3 image, the image was thresholded (Image>adjust>threshold) and the relevant ROI (nucleus ) was selected with the wand tool and added to the ROI manager (ROI 0). From the FP image the contour of the relevant cell was delineated in the same way and added to the ROI manager (ROI 1). To calculate the ROI that defines the cytoplasm (cell contour minus nucleus), the following simple macro (ROI_donut.txt) is very useful: roiManager("Select", 1); setKeyDown("alt"); roiManager("Select",0); setKeyDown("none"); roiManager("Add"); You end up with a third ROI (1-1) in the ROI manager that corresponds to the cytoplasm. Then you can measure in the different ROIs. Thanks to Mark and especially to Gabriel for their contribution. I hope that this could be useful to others. At 02:29 07/06/2007, you wrote: >I'm curious as to what the goal is; it may make the problem simpler or >harder; it appears that the suggestions in this thread have all been >retracted. ;-) > >If it's just to visually show the subtracted area (donut) then there's >really no need to subtract. >If the area if the donut is needed, just to 'measure' on the roi's subtract >the areas. > >If the goal is to actually read and/or manipulate the pixels in the donut -- >well this seems really hard. >First, it doesn't seem possible to represent the donut as an ROI in ImageJ >as it cannot be represented as list of vertices (which, I believe, is the >data held internally to represent the ROI; you would need 2 such lists. > >If one wanted to write some code, one could do isPixelInDonut() by >traversing all the pixels in the bounding rectangle of the outer ROI and >asking if the pixel was contained in the outer and not contained in the >inner ROI. This would give the correct set of pixels which you would than >have to handle individually. > >One could draw an approximation of the donut by 1. outlining the inner ROI >clockwise but just as you get back to the start, 2. move to a point on the >outer ROI and 3. outline it in the counter-clockwise direction and as you >get back to the start of the outer, 4. move to the start of the inner. This >will give a conventional ROI that will be a donut with a cut in it. If you >can make the cut small enough, this might be workable. > >Again, if you wanted to write some code, you could take the 2 ring ROIs, get >the list of vertices from each, and create a 'donut with cut' roi that would >include exactly the pixels in the donut. > >Hope this helps > > >How can I make a ROI that is the result of the subtraction between two ROIs? > >Searching docs and list archives I've only found >how to make "composite selections", which are >created by hand (by drawing a ROI inside another, while pressing the alt >key). > >I have two ROIs in the ROI manager, one ROI >inside the other one. I want to select the area >within the bigger ROI, excluding the area of the >smaller ROI. If we were talking of two circles >(one inside the other), I want select the area >defined by the ring between them. > >-- >View this message in context: >http://www.nabble.com/subtraction-of-ROIs-tf3872158.html#a10999925 >Sent from the ImageJ mailing list archive at Nabble.com. F Javier Diez-Guerra, PhD Profesor Titular Centro de Biologia Molecular Severo Ochoa Facultad de Ciencias, Universidad Autónoma Ctra Colmenar Viejo Km 15 Cantoblanco, 28049 Madrid SPAIN phone: +34 91 4978051 Fax: +34 91 4978087 e-mail: [hidden email] |
Hello List,
I may be a bit late on this particular topic but I have been trying outside of ImageJ ie with Excel after all the ImageJ results is dumped to a txt file to subtract measurements for ROIs contained within ROI's. How would you do what ROI_donut.txt does below for one cell on a collection of cells within the same image? Or put another way ... How do you associate the larger ROI(cell cytoplasma) with the smaller ROI (nucleus) that share the same center of mass x,y when you have more than one cell, ie a list of greater than 300 ROIs? Also because the objects I am measuring are sometimes near to each other to prevent segmentation, the outer/larger ROI can contain more that one internal ROI. A situation like this can also genuinely arise when a cell contains two nuclei. Under those circumstances the larger ROI (cytoplasm) now has a centre of mass x,y that does not correspond to the centre of mass coordinates for the two smaller internal ROI's(nuclei). Given a big list of ROIs how would these two smaller ROIs be correctly added to the larger ROI? Many thanks Declan -----Original Message----- From: ImageJ Interest Group [mailto:[hidden email]] On Behalf Of F Javier Diez Guerra Sent: 07 June 2007 05:03 To: [hidden email] Subject: Re: subtraction of ROIs Thanks to everybody that has shown interest in the subtraction of ROIs thread. The goal was to compare the distribution of several fluorescent proteins (FP) in the nucleus and cytoplasm of cells that were labelled with To-Pro3 and were imaged in a confocal microscope. From the To-Pro3 image, the image was thresholded (Image>adjust>threshold) and the relevant ROI (nucleus ) was selected with the wand tool and added to the ROI manager (ROI 0). From the FP image the contour of the relevant cell was delineated in the same way and added to the ROI manager (ROI 1). To calculate the ROI that defines the cytoplasm (cell contour minus nucleus), the following simple macro (ROI_donut.txt) is very useful: roiManager("Select", 1); setKeyDown("alt"); roiManager("Select",0); setKeyDown("none"); roiManager("Add"); You end up with a third ROI (1-1) in the ROI manager that corresponds to the cytoplasm. Then you can measure in the different ROIs. Thanks to Mark and especially to Gabriel for their contribution. I hope that this could be useful to others. >How can I make a ROI that is the result of the subtraction between two ROIs? > >Searching docs and list archives I've only found >how to make "composite selections", which are >created by hand (by drawing a ROI inside another, while pressing the alt >key). > >I have two ROIs in the ROI manager, one ROI >inside the other one. I want to select the area >within the bigger ROI, excluding the area of the >smaller ROI. If we were talking of two circles >(one inside the other), I want select the area >defined by the ring between them. > >-- >View this message in context: >http://www.nabble.com/subtraction-of-ROIs-tf3872158.html#a10999925 >Sent from the ImageJ mailing list archive at Nabble.com. F Javier Diez-Guerra, PhD Profesor Titular Centro de Biologia Molecular Severo Ochoa Facultad de Ciencias, Universidad Autónoma Ctra Colmenar Viejo Km 15 Cantoblanco, 28049 Madrid SPAIN phone: +34 91 4978051 Fax: +34 91 4978087 e-mail: [hidden email] |
Hi Declan,
In my particular case, confocal images were captured with a 63x objective, choosing isolated cells with well defined edges and moderate expression. We only had one cell or two (max) in each image. So we run the whole procedure for each cell at a time. You can analyze cells with two or more nuclei by combining the ROIs (in the ROI Manager) before running the macro. Finally the data collected (measure cmd) were copy-pasted to an excel sheet especially designed to make the subtractions and statistics. Hope it helps. At 08:15 13/06/2007, you wrote: >Hello List, > >I may be a bit late on this particular topic but I have been trying outside >of ImageJ ie with Excel after all the ImageJ results is dumped to a txt file >to subtract measurements for ROIs contained within ROI's. > >How would you do what ROI_donut.txt does below for one cell on a collection >of cells within the same image? Or put another way ... >How do you associate the larger ROI(cell cytoplasma) with the smaller ROI >(nucleus) that share the same center of mass x,y when you have more than one >cell, ie a list of greater than 300 ROIs? > >Also because the objects I am measuring are sometimes near to each other to >prevent segmentation, the outer/larger ROI can contain more that one >internal ROI. A situation like this can also genuinely arise when a cell >contains two nuclei. Under those circumstances the larger ROI (cytoplasm) >now has a centre of mass x,y that does not correspond to the centre of mass >coordinates for the two smaller internal ROI's(nuclei). Given a big list >of ROIs how would these two smaller ROIs be correctly added to the larger >ROI? > >Many thanks > >Declan >-----Original Message----- >From: ImageJ Interest Group [mailto:[hidden email]] On Behalf Of F >Javier Diez Guerra >Sent: 07 June 2007 05:03 >To: [hidden email] >Subject: Re: subtraction of ROIs > >Thanks to everybody that has shown interest in the subtraction of ROIs >thread. > >The goal was to compare the distribution of >several fluorescent proteins (FP) in the nucleus >and cytoplasm of cells that were labelled with >To-Pro3 and were imaged in a confocal microscope. > > From the To-Pro3 image, the image was >thresholded (Image>adjust>threshold) and the >relevant ROI (nucleus ) was selected with the >wand tool and added to the ROI manager (ROI 0). > From the FP image the contour of the relevant >cell was delineated in the same way and added to the ROI manager (ROI 1). > >To calculate the ROI that defines the cytoplasm >(cell contour minus nucleus), the following >simple macro (ROI_donut.txt) is very useful: > >roiManager("Select", 1); >setKeyDown("alt"); >roiManager("Select",0); >setKeyDown("none"); >roiManager("Add"); > >You end up with a third ROI (1-1) in the ROI >manager that corresponds to the cytoplasm. Then >you can measure in the different ROIs. > >Thanks to Mark and especially to Gabriel for their contribution. > >I hope that this could be useful to others. > > > > >How can I make a ROI that is the result of the subtraction between two >ROIs? > > > >Searching docs and list archives I've only found > >how to make "composite selections", which are > >created by hand (by drawing a ROI inside another, while pressing the alt > >key). > > > >I have two ROIs in the ROI manager, one ROI > >inside the other one. I want to select the area > >within the bigger ROI, excluding the area of the > >smaller ROI. If we were talking of two circles > >(one inside the other), I want select the area > >defined by the ring between them. > > > >-- > >View this message in context: > >http://www.nabble.com/subtraction-of-ROIs-tf3872158.html#a10999925 > >Sent from the ImageJ mailing list archive at Nabble.com. > >F Javier Diez-Guerra, PhD >Profesor Titular >Centro de Biologia Molecular Severo Ochoa >Facultad de Ciencias, Universidad Autónoma >Ctra Colmenar Viejo Km 15 >Cantoblanco, 28049 Madrid >SPAIN > >phone: +34 91 4978051 >Fax: +34 91 4978087 >e-mail: [hidden email] F Javier Diez-Guerra, PhD Profesor Titular Centro de Biologia Molecular Severo Ochoa Facultad de Ciencias, Universidad Autónoma Ctra Colmenar Viejo Km 15 Cantoblanco, 28049 Madrid SPAIN phone: +34 91 4978051 Fax: +34 91 4978087 e-mail: [hidden email] |
Free forum by Nabble | Edit this page |