Apply overlays programmaticly.

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

Apply overlays programmaticly.

Robert Lockwood
> Create an Overlay, add a rectangular ROI to it using overlay.add(),
assign it to the image using
> imp.setOverlay(), and update the display using imp.draw(), where
'overlay' is an overlay and 'imp' > is an ImagePlus. Remove the overlay by
using imp.setHideOverlay(true).


Thanks, Wayne, I've added this to my code:
    private Overlay overlay = new Overlay();
    private Roi imageRoi = null;
...
        imageRoi = new Roi(colStart, rowStart, numCols, numRows);
        overlay.add(imageRoi);
        imageRoi.setFillColor(Color.BLACK);
        ejip.imp.draw();
        ejip.repaint();
        pnlImageBase.validate();

Where ejip is a JImagePanel. and pnlImageBase is the JPanel container for
ejip.

Nothing appears on my contrast enhanced image with a "Fire" LUT added so
I'm missing something.


--
When I was 12 I thought I would live forever.
So far, so good.

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

Re: Apply overlays programmaticly.

Robert Lockwood
Thank you, Jim, I did indeed not include "imp.setOverlay()" although it's
also in my notes!  It's working perfectly for me now.

Nate


On Sat, Nov 23, 2013 at 6:42 PM, Jim Passmore <[hidden email]> wrote:

> Hmm.  Your code snippet doesn't use imp.setOverlay() as Wayne says in
> his instructions.  (You have to associate the overlay with a
> particular ImagePlus.)
>
> Overlooked?
>
> Jim
>
>
> On Fri, Nov 22, 2013 at 5:29 PM, Robert Lockwood <[hidden email]>
> wrote:
> >> Create an Overlay, add a rectangular ROI to it using overlay.add(),
> > assign it to the image using
> >> imp.setOverlay(), and update the display using imp.draw(), where
> > 'overlay' is an overlay and 'imp' > is an ImagePlus. Remove the overlay
> by
> > using imp.setHideOverlay(true).
> >
> >
> > Thanks, Wayne, I've added this to my code:
> >     private Overlay overlay = new Overlay();
> >     private Roi imageRoi = null;
> > ...
> >         imageRoi = new Roi(colStart, rowStart, numCols, numRows);
> >         overlay.add(imageRoi);
> >         imageRoi.setFillColor(Color.BLACK);
> >         ejip.imp.draw();
> >         ejip.repaint();
> >         pnlImageBase.validate();
> >
> > Where ejip is a JImagePanel. and pnlImageBase is the JPanel container for
> > ejip.
> >
> > Nothing appears on my contrast enhanced image with a "Fire" LUT added so
> > I'm missing something.
> >
> >
> > --
> > When I was 12 I thought I would live forever.
> > So far, so good.
> >
> > --
> > ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>
>
>
> --
> Jim Passmore
> Research Associate
> Sealed Air Corporation
>



--
When I was 12 I thought I would live forever.
So far, so good.

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