How to define Region of Interest in an image with mouse

N

news.rcn.com

I need to find a way to allow a user to trace an arbitrary region of a
displayed image with a mouse and capture the outlined area as a 'region of
interest' (ROI) I've looked at the Java Advanced Imaging classes and they
seem to have what I need to manage the data.

But is is not clear how to handle the UI part where the user defines the
ROI. I would appreciate any pointers, code snippets, etc on how to
accomplish this. Is there a Java class that will handle the acquisition?

Thanks in advance.
jim cant
 
O

Oliver Wong

news.rcn.com said:
I need to find a way to allow a user to trace an arbitrary region of a
displayed image with a mouse and capture the outlined area as a 'region of
interest' (ROI) I've looked at the Java Advanced Imaging classes and they
seem to have what I need to manage the data.

But is is not clear how to handle the UI part where the user defines the
ROI. I would appreciate any pointers, code snippets, etc on how to
accomplish this. Is there a Java class that will handle the acquisition?

Is the user to click on the vertex of every polygon defining the ROI, or
is the user to click and hold down the button to continuously draw the edge
of the shape?

In either cases, you basically need to think of the Polygon class as a
List of Points, and the solution should fall into place. (I wonder why
java.awt.Polygon doesn't implement List<Point> actually).

- Oliver
 
R

Roedy Green

But is is not clear how to handle the UI part where the user defines the
ROI. I would appreciate any pointers, code snippets, etc on how to
accomplish this. Is there a Java class that will handle the acquisition?

paint the image on a Canvas on JPanel. Then capture mouse move events
You then have the problem of cleaning that up into a polygon. Perhaps
you draw a line as you go making a node at each click and removing the
last one at each right click.

Java In A Nutshell in the Introduction to AWT does a little drawing
program. I'm not sure if it still there in the latest edition.

see http://mindprod.com/jgloss/who.html under Flanagan
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top