How to fill a selection with a different color while still keep the line color?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

How to fill a selection with a different color while still keep the line color?

WangPing
 Dear List,
 
I drew an ROI with red color, now I filled it with a different color (for example green), then I found the red boundary line of the ROI was not shown any more.  I wonder if anyone knows how to keep the line color for the ROI?
Thanks.
ping wang
     

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: How to fill a selection with a different color while still keep the line color?

Peter van Loon
Hi Ping Wang,

Use enlarge selection with a negative value. The selection will shrink then. After this fill this selection and the boundary line will be preserved.

Regards,
Peter
Reply | Threaded
Open this post in threaded view
|

Re: How to fill a selection with a different color while still keep the line color?

WangPing
Thank you peter, let me try this out, I will get back to you if there is a question.  kindest regards, ping
 

> Date: Tue, 7 Jul 2015 13:14:51 -0700
> From: [hidden email]
> Subject: Re: How to fill a selection with a different color while still keep the line color?
> To: [hidden email]
>
> Hi Ping Wang,
>
> Use enlarge selection with a negative value. The selection will shrink then.
> After this fill this selection and the boundary line will be preserved.
>
> Regards,
> Peter
>
>
>
> --
> View this message in context: http://imagej.1557.x6.nabble.com/How-to-fill-a-selection-with-a-different-color-while-still-keep-the-line-color-tp5013457p5013458.html
> Sent from the ImageJ mailing list archive at Nabble.com.
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
     

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: How to fill a selection with a different color while still keep the line color?

CARL Philippe (LBP)
In reply to this post by WangPing
Dear Ping Wang,
I'm not sure whether I misunderstood what you are looking for.
But is the feature you are interested not just the Edit->Draw (or Ctrl + D)
feature.
It will draw a line which color is the active one and thickness can be
defined in Edit->Options->Line_width...
My best regards,
Philippe

-----Message d'origine-----
De : ImageJ Interest Group [mailto:[hidden email]] De la part de
WangPing
Envoyé : mardi 7 juillet 2015 21:07
À : [hidden email]
Objet : How to fill a selection with a different color while still keep the
line color?

 Dear List,
 
I drew an ROI with red color, now I filled it with a different color (for
example green), then I found the red boundary line of the ROI was not shown
any more.  I wonder if anyone knows how to keep the line color for the ROI?
Thanks.
ping wang
     

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: How to fill a selection with a different color while still keep the line color?

WangPing
Dear Philippe,
 
Thank you for your response, but my question is slightly different.  I draw an ROI (for example an oval, or a polygon) it should have a color of its boundary.  Then I fill the ROI with one color (press Y), then the ROI boundary disappears.  My question was how to still display the boundary when the ROI is filled with some color.
 
Best,
Ping
 

> Date: Wed, 8 Jul 2015 11:14:24 +0200
> From: [hidden email]
> Subject: Re: How to fill a selection with a different color while still keep the line color?
> To: [hidden email]
>
> Dear Ping Wang,
> I'm not sure whether I misunderstood what you are looking for.
> But is the feature you are interested not just the Edit->Draw (or Ctrl + D)
> feature.
> It will draw a line which color is the active one and thickness can be
> defined in Edit->Options->Line_width...
> My best regards,
> Philippe
>
> -----Message d'origine-----
> De : ImageJ Interest Group [mailto:[hidden email]] De la part de
> WangPing
> Envoyé : mardi 7 juillet 2015 21:07
> À : [hidden email]
> Objet : How to fill a selection with a different color while still keep the
> line color?
>
>  Dear List,
>  
> I drew an ROI with red color, now I filled it with a different color (for
> example green), then I found the red boundary line of the ROI was not shown
> any more.  I wonder if anyone knows how to keep the line color for the ROI?
> Thanks.
> ping wang
>      
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
     
--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: How to fill a selection with a different color while still keep the line color?

Rasband, Wayne (NIH/NIMH) [E]
On Jul 8, 2015, at 12:20 PM, WangPing <[hidden email]<mailto:[hidden email]>> wrote:

Dear Philippe,

Thank you for your response, but my question is slightly different.  I draw an ROI (for example an oval, or a polygon) it should have a color of its boundary.  Then I fill the ROI with one color (press Y), then the ROI boundary disappears.  My question was how to still display the boundary when the ROI is filled with some color.

A single selection cannot be filled and have a boundary at the same time, but you can use an overlay as a work around. The following macro creates an overlay containing a blue filled oval with a red boundary and transparent magenta filled polygon with a yellow boundary.

  newImage("Untitled", "8-bit ramp", 512, 512, 1);
  makeOval(86, 70, 162, 116);
  Overlay.addSelection("", 0, "blue");
  makeOval(86, 70, 162, 116);
  Overlay.addSelection("red", 3);
  makePolygon(312,195,187,335,440,387,417,240);
  Overlay.addSelection("", 0, "22ff00ff");
  makePolygon(312,195,187,335,440,387,417,240);
  Overlay.addSelection("yellow", 7);
  run("Select None");

And here is a Javascript version:

  imp = IJ.createImage("Untitled", "8-bit ramp", 512, 512, 1);
  overlay = new Overlay();
  oval1 = new OvalRoi(86, 70, 162, 116);
  oval1.setFillColor(Color.blue);
  overlay.add(oval1);
  oval2 = oval1.clone();
  oval2.setStrokeColor(Color.red);
  oval2.setStrokeWidth(3);
  overlay.add(oval2);
  xpoints = [312,187,440,417];
  ypoints = [195,335,387,240];
  polygon1 = new PolygonRoi(xpoints,ypoints,Roi.POLYGON);
  polygon1.setFillColor(new Color(1,0,1,0.13));
  overlay.add(polygon1);
  polygon2 = polygon1.clone();
  polygon2.setStrokeColor(Color.yellow);
  polygon2.setStrokeWidth(7);
  overlay.add(polygon2);
  imp.setOverlay(overlay);
  imp.show();


[cid:042A939B-279C-4341-A0C0-BDCA4A074449@home]

-wayne


Date: Wed, 8 Jul 2015 11:14:24 +0200
From: [hidden email]<mailto:[hidden email]>
Subject: Re: How to fill a selection with a different color while still keep the line color?
To: [hidden email]<mailto:[hidden email]>

Dear Ping Wang,
I'm not sure whether I misunderstood what you are looking for.
But is the feature you are interested not just the Edit->Draw (or Ctrl + D)
feature.
It will draw a line which color is the active one and thickness can be
defined in Edit->Options->Line_width...
My best regards,
Philippe

-----Message d'origine-----
De : ImageJ Interest Group [mailto:[hidden email]] De la part de
WangPing
Envoyé : mardi 7 juillet 2015 21:07
À : [hidden email]<mailto:[hidden email]>
Objet : How to fill a selection with a different color while still keep the
line color?

Dear List,

I drew an ROI with red color, now I filled it with a different color (for
example green), then I found the red boundary line of the ROI was not shown
any more.  I wonder if anyone knows how to keep the line color for the ROI?
Thanks.
ping wang

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html

RampWithOverlay.png (22K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: How to fill a selection with a different color while still keep the line color?

CARL Philippe (LBP)
In reply to this post by WangPing
Dear Ping,

Please try the following macro:

run("Clown (14K)");

makeOval(149, 58, 69, 44);
setForegroundColor(0, 0, 255);
run("Fill", "slice");
setForegroundColor(70, 255, 0);
run("Draw");
run("Select None");

makePolygon(54,30,85,32,94,41,101,51,99,58,81,58,63,54,60,46);
setForegroundColor(255, 57, 0);
run("Fill", "slice");

run("Select None");
run("Restore Selection");

setForegroundColor(255, 255, 0);
run("Draw");
run("Select None");

It downloads the clown picture,
then draws an oval ROI that is filled with blue and its bondary with green
then it draws a polygonal ROI that is filled with red, its selection deselected and selected again and the ROI boundary drawn in yellow.

Isn't this what you are looking for ?

My best regards,

Philippe

Le Mercredi 8 Juillet 2015 18:20 CEST, WangPing <[hidden email]> a écrit:

> Dear Philippe,
>
> Thank you for your response, but my question is slightly different.  I draw an ROI (for example an oval, or a polygon) it should have a color of its boundary.  Then I fill the ROI with one color (press Y), then the ROI boundary disappears.  My question was how to still display the boundary when the ROI is filled with some color.
>
> Best,
> Ping
>
> > Date: Wed, 8 Jul 2015 11:14:24 +0200
> > From: [hidden email]
> > Subject: Re: How to fill a selection with a different color while still keep the line color?
> > To: [hidden email]
> >
> > Dear Ping Wang,
> > I'm not sure whether I misunderstood what you are looking for.
> > But is the feature you are interested not just the Edit->Draw (or Ctrl + D)
> > feature.
> > It will draw a line which color is the active one and thickness can be
> > defined in Edit->Options->Line_width...
> > My best regards,
> > Philippe
> >
> > -----Message d'origine-----
> > De : ImageJ Interest Group [mailto:[hidden email]] De la part de
> > WangPing
> > Envoyé : mardi 7 juillet 2015 21:07
> > À : [hidden email]
> > Objet : How to fill a selection with a different color while still keep the
> > line color?
> >
> >  Dear List,
> >
> > I drew an ROI with red color, now I filled it with a different color (for
> > example green), then I found the red boundary line of the ROI was not shown
> > any more.  I wonder if anyone knows how to keep the line color for the ROI?
> > Thanks.
> > ping wang
> >    
> >
> > --
> > ImageJ mailing list: http://imagej.nih.gov/ij/list.html
> >
> > --
> > ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>      --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html





--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html