Hello all, I need some help here
I'm trying to draw some ovals on image, based on a list, so the code just like this Vector Points, each element is an object contains position and color w=5; for(int i = 0; i < Points.size(); i++){ Object o = Points.elementAt(i); x=o.getx(); y=o.gety(); color=o.getcolor(); ip.drawOval(x-w/2, y-w/2, w,w); imp.updateAndDraw(); } I can get all the ovals I want, but can't set color, use ip.setColor(color) was not working. On another hand, if I use OvalRoi oval = new OvalRoi((x-w/2, y-w/2, w,w, imp); oval.setColor(color); imp.setRoi(oval); I can get the color I wanted but found only one oval on the image. What's the correct way to draw multiple ovals with different color? Thanks Hao ************************************************************************* PRIVILEGE AND CONFIDENTIALITY NOTICE: The information in this email is intended for the named recipients only. It may contain privileged and confidential information. If you have received this communication in error, any use, copying or dissemination of its contents is strictly prohibited. Please erase all copies of the message along with any included attachments and notify Intermap Technologies or the sender immediately by telephone at the number indicated on this page. ************************************************************************* |
I'm afraid yes, what can I do? -----Original Message----- From: Wayne Rasband [mailto:[hidden email]] Sent: Wednesday, June 18, 2008 1:00 PM To: Hao Jiang Subject: Re: draw multiple ovals with color Hao, Are you drawing the ovals on a color image? The ip.setColor() method will not cause ovals to be in color on a grayscale image. -wayne On Jun 18, 2008, at 12:44 PM, Hao Jiang wrote: > Hello all, I need some help here > > I'm trying to draw some ovals on image, based on a list, so the code > just like this > > Vector Points, each element is an object contains position and color > > w=5; > for(int i = 0; i < Points.size(); i++){ > > Object o = Points.elementAt(i); > > x=o.getx(); > > y=o.gety(); > > color=o.getcolor(); > > ip.drawOval(x-w/2, y-w/2, w,w); > > imp.updateAndDraw(); > > } > > > > I can get all the ovals I want, but can't set color, use > ip.setColor(color) was not working. > > > > On another hand, if I use > > OvalRoi oval = new OvalRoi((x-w/2, y-w/2, w,w, imp); > > oval.setColor(color); > > imp.setRoi(oval); > > > > I can get the color I wanted but found only one oval on the image. > > > > What's the correct way to draw multiple ovals with different color? > > > > Thanks > > > > Hao > > > > > ********************************************************************** > * > ** > PRIVILEGE AND CONFIDENTIALITY NOTICE: > > The information in this email is intended for the named recipients > only. > It may contain privileged and confidential information. If you have > received this communication in error, any use, copying or > dissemination of its contents is strictly prohibited. Please erase > all copies of the message along with any included attachments and > notify Intermap Technologies or the sender immediately by telephone at > the number indicated on this page. > > ********************************************************************** > * > ** ************************************************************************* PRIVILEGE AND CONFIDENTIALITY NOTICE: The information in this email is intended for the named recipients only. It may contain privileged and confidential information. If you have received this communication in error, any use, copying or dissemination of its contents is strictly prohibited. Please erase all copies of the message along with any included attachments and notify Intermap Technologies or the sender immediately by telephone at the number indicated on this page. ************************************************************************* |
> I'm afraid yes, what can I do?
You can create a display list of ROIs, each in a different color, and display it as a graphic overlay. w=5; Vector displayList = new Vector(); for(int i = 0; i < Points.size(); i++){ Object o = Points.elementAt(i); x=o.getx(); y=o.gety(); color=o.getcolor(); Roi circle = new OvalRoi(x-w/2, y-w/2, w,w); circle.setInstanceColor(color); displayList.add(circle); } ImageCanvas ic = imp.getCanvas(); ic.setDisplayList(displayList); Here are some example plugins that use display lists: http://rsb.info.nih.gov/ij/plugins/graphic-overlay.html http://rsb.info.nih.gov/ij/plugins/download/Concentric_Circles.java http://rsb.info.nih.gov/ij/plugins/grid.html http://rsb.info.nih.gov/ij/plugins/download/misc/MultiColor_ROIs.java -wayne > > -----Original Message----- > From: Wayne Rasband [mailto:[hidden email]] > Sent: Wednesday, June 18, 2008 1:00 PM > To: Hao Jiang > Subject: Re: draw multiple ovals with color > > Hao, > > Are you drawing the ovals on a color image? The ip.setColor() method > will not cause ovals to be in color on a grayscale image. > > -wayne > > On Jun 18, 2008, at 12:44 PM, Hao Jiang wrote: > >> Hello all, I need some help here >> >> I'm trying to draw some ovals on image, based on a list, so the code >> just like this >> >> Vector Points, each element is an object contains position and color >> >> w=5; >> for(int i = 0; i < Points.size(); i++){ >> >> Object o = Points.elementAt(i); >> >> x=o.getx(); >> >> y=o.gety(); >> >> color=o.getcolor(); >> >> ip.drawOval(x-w/2, y-w/2, w,w); >> >> imp.updateAndDraw(); >> >> } >> >> >> >> I can get all the ovals I want, but can't set color, use >> ip.setColor(color) was not working. >> >> >> >> On another hand, if I use >> >> OvalRoi oval = new OvalRoi((x-w/2, y-w/2, w,w, imp); >> >> oval.setColor(color); >> >> imp.setRoi(oval); >> >> >> >> I can get the color I wanted but found only one oval on the image. >> >> >> >> What's the correct way to draw multiple ovals with different color? >> >> >> >> Thanks >> >> >> >> Hao >> >> >> >> >> ********************************************************************** >> * >> ** >> PRIVILEGE AND CONFIDENTIALITY NOTICE: >> >> The information in this email is intended for the named recipients >> only. >> It may contain privileged and confidential information. If you have >> received this communication in error, any use, copying or >> dissemination of its contents is strictly prohibited. Please erase >> all copies of the message along with any included attachments and >> notify Intermap Technologies or the sender immediately by telephone at > >> the number indicated on this page. >> >> ********************************************************************** >> * >> ** > > > > > > *********************************************************************** > ** > PRIVILEGE AND CONFIDENTIALITY NOTICE: > > The information in this email is intended for the named recipients > only. > It may contain privileged and confidential information. If you have > received this communication in error, any use, copying or dissemination > of its contents is strictly prohibited. Please erase all copies of the > message along with any included attachments and notify Intermap > Technologies or the sender immediately by telephone at the number > indicated on this page. > > *********************************************************************** > ** |
Thanks very much, now I got it
Just a small thing, if I set w < 10, I don't really get a circle. Hao -----Original Message----- From: ImageJ Interest Group [mailto:[hidden email]] On Behalf Of Wayne Rasband Sent: Wednesday, June 18, 2008 2:06 PM To: [hidden email] Subject: Re: draw multiple ovals with color > I'm afraid yes, what can I do? You can create a display list of ROIs, each in a different color, and display it as a graphic overlay. w=5; Vector displayList = new Vector(); for(int i = 0; i < Points.size(); i++){ Object o = Points.elementAt(i); x=o.getx(); y=o.gety(); color=o.getcolor(); Roi circle = new OvalRoi(x-w/2, y-w/2, w,w); circle.setInstanceColor(color); displayList.add(circle); } ImageCanvas ic = imp.getCanvas(); ic.setDisplayList(displayList); Here are some example plugins that use display lists: http://rsb.info.nih.gov/ij/plugins/graphic-overlay.html http://rsb.info.nih.gov/ij/plugins/download/Concentric_Circles.java http://rsb.info.nih.gov/ij/plugins/grid.html http://rsb.info.nih.gov/ij/plugins/download/misc/MultiColor_ROIs.java -wayne > > -----Original Message----- > From: Wayne Rasband [mailto:[hidden email]] > Sent: Wednesday, June 18, 2008 1:00 PM > To: Hao Jiang > Subject: Re: draw multiple ovals with color > > Hao, > > Are you drawing the ovals on a color image? The ip.setColor() method > will not cause ovals to be in color on a grayscale image. > > -wayne > > On Jun 18, 2008, at 12:44 PM, Hao Jiang wrote: > >> Hello all, I need some help here >> >> I'm trying to draw some ovals on image, based on a list, so the code >> just like this >> >> Vector Points, each element is an object contains position and color >> >> w=5; >> for(int i = 0; i < Points.size(); i++){ >> >> Object o = Points.elementAt(i); >> >> x=o.getx(); >> >> y=o.gety(); >> >> color=o.getcolor(); >> >> ip.drawOval(x-w/2, y-w/2, w,w); >> >> imp.updateAndDraw(); >> >> } >> >> >> >> I can get all the ovals I want, but can't set color, use >> ip.setColor(color) was not working. >> >> >> >> On another hand, if I use >> >> OvalRoi oval = new OvalRoi((x-w/2, y-w/2, w,w, imp); >> >> oval.setColor(color); >> >> imp.setRoi(oval); >> >> >> >> I can get the color I wanted but found only one oval on the image. >> >> >> >> What's the correct way to draw multiple ovals with different color? >> >> >> >> Thanks >> >> >> >> Hao >> >> >> >> >> ********************************************************************* >> * >> * >> ** >> PRIVILEGE AND CONFIDENTIALITY NOTICE: >> >> The information in this email is intended for the named recipients >> only. >> It may contain privileged and confidential information. If you have >> received this communication in error, any use, copying or >> dissemination of its contents is strictly prohibited. Please erase >> all copies of the message along with any included attachments and >> notify Intermap Technologies or the sender immediately by telephone >> at > >> the number indicated on this page. >> >> ********************************************************************* >> * >> * >> ** > > > > > > ********************************************************************** > * > ** > PRIVILEGE AND CONFIDENTIALITY NOTICE: > > The information in this email is intended for the named recipients > only. > It may contain privileged and confidential information. If you have > received this communication in error, any use, copying or > dissemination of its contents is strictly prohibited. Please erase > all copies of the message along with any included attachments and > notify Intermap Technologies or the sender immediately by telephone at > the number indicated on this page. > > ********************************************************************** > * > ** ************************************************************************* PRIVILEGE AND CONFIDENTIALITY NOTICE: The information in this email is intended for the named recipients only. It may contain privileged and confidential information. If you have received this communication in error, any use, copying or dissemination of its contents is strictly prohibited. Please erase all copies of the message along with any included attachments and notify Intermap Technologies or the sender immediately by telephone at the number indicated on this page. ************************************************************************* |
Free forum by Nabble | Edit this page |