Freehand ROI not 'closing'

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

Freehand ROI not 'closing'

Jim Cant
I am trying to create a FreehandRoi on a image and the ROI is not closing (automatically connect the last point - where the mouse key was released - to the initial point.

I am doing this withing my own application and not using the ImageJ GUI.

I am able to draw the ROI just fine.  When I release the key, the ImageCanvas.mouseReleased method gets called.
PolygonRoi.finishPolygon() and FreehandROI.handleMouseUp() get called.  

When I go trace through calls when run from the ImageJ GUI, I see the same code path but the roi gets closed.

Is there something going on outside of the ImageCanvas.mouseReleased() method?
Is there some setup I'm omitting that needs to be done for the mouseRelased handler to work right?

I'd really appreciate some advice on this.  I've spent more that a (loonnngg) day on this.

Thanks a lot,
jim
Reply | Threaded
Open this post in threaded view
|

Re: Freehand ROI not 'closing'

Jim Cant
Solved this.  For the curious, here's the answer.

An ROI gets 'closed' when drawn only if isArea() returns true.  This is so for Roi type FREEROI but not for FREELINE.
When Roi is created with a call to 'createNewRoi()' it decides what type to create by looking at the selected tool in the Toolbar object.

This works fine if one is using the ImageJ front end but pretty convoluted when using the package as a toolkit. (Mostly because none of the information I discovered is in the JavaDoc).

jim


<quote author='Jim Cant'>
I am trying to create a FreehandRoi on a image and the ROI is not closing (automatically connect the last point - where the mouse key was released - to the initial point.

<snip>