Draw a Roi with a dot in center


during my master thesis i developed DS4H Image Alignment, a tool for 2d co-registration of histologic images.
The plugin works quite well for its intended use, however, i am requested to do some small modifications to the plugin.

With the following code

if(dialogEvent instanceof AddRoiEvent) {
	AddRoiEvent event = (AddRoiEvent)dialogEvent;
	int roiWidth = Toolkit.getDefaultToolkit().getScreenSize().width > image.getWidth() ? Toolkit.getDefaultToolkit().getScreenSize().width : image.getWidth() ;
	roiWidth = (int)(roiWidth * 0.03);
	OvalRoi roi = new OvalRoi (event.getClickCoords().x - (roiWidth / 2), event.getClickCoords().y - (roiWidth/2), roiWidth, roiWidth);

	// get roughly the 0,25% of the width of the image as stroke width of th rois added.
	// If the resultant value is too small, set it as the minimum value
	int strokeWidth = (int) (image.getWidth() * 0.0025) > 3 ? (int) (image.getWidth() * 0.0025) : 3;


	image.getManager().add(image, roi, image.getManager().getRoisAsArray().length + 1);

i am able to add an oval roi to the screen, like this:

However, i now need to draw the same OvalRoi with a visible dot (small circle) in its center.
i would like to get a result similar to this:

How can i achieve this result with Java and org.scijava 29.2.1.


Hello Luxor -

One approach would be to create a PointRoi. You can then add
it to the RoiManager, and when selected, it will appear on the
displayed image.

If you don’t want your dot to be an Roi, you could add the
PointRoi to an Overlay and display that. If you want the
dot to become part of the image, you could then “flatten” the
Overlay onto the image.

(You could also draw a dot directly on the image, but given what
you’re already doing with Rois in your code, the PointRoi
approach might be the easiest.)

Thanks, mm