// f.setRefreshingPeriod(500);
// f.setAxisRangeX(50, 200);
// f.setAxisRangeY(100, 200);
final ImageViewer viewer = ((RotaryImageViewer) f.widget).getImageViewer();
viewer.addViewerListener(new IIJViewerListener() {
int index = 1;
@Override
public void valueChanged(IJViewerEvent event) {
// nothing to do
}
@Override
public void pixelSizeChanged(IJViewerEvent event) {
// nothing to do
}
@Override
public void mouseClicked(IJViewerEvent event) {
if (viewer != null) {
Point2D.Double point = viewer.getAxisPosition();
IJCanvas canvas = viewer.getImageCanvas();
if ((point != null) && (canvas != null)) {
// XXX strange IJ hack that should be done in ImageViewer
int x = (canvas.screenXD(point.x));
int y = (canvas.screenYD(point.y));
f.addRoi("MyRoi" + ++index + ",point,1," + x + "," + y + "," + 5 + "," + 5 + ",GREEN");