Moving and Sizing an Object Drawing Layer
hegedus
I am creating an interface for image analysis and I need to allow the user a limited scope of setting an ROI box. The interface has multiple images including one that will have an ROI box. I need to allow the user to move the box in X and Y and to scale it in X and Y. What I was thinking was using the arrow keys to move similar to what is done when the drawing tools are active and an object has been selected. Arrow keys move and shift arrow moves faster. I would like to use option/alt arrow to size. I would prefer not to have the drawing tools active because it would open up too many options for mischief on behalf of the user.
Is there some existing code someone can share as a starting point before I struggle in writing my own?
Andy
March 2, 2018 at 06:04 am - Permalink
March 2, 2018 at 06:43 am - Permalink
I like your suggestion. I was going down an alternate route using a wave to create a boundary and using imageBoundaryToMask and creating controls to adjust the values in the wave. The marquee is a more direct way.
Thank you for the suggestion.
Andy
March 2, 2018 at 08:16 am - Permalink
Also here is what I put together
BoundBox wave holds the global positions so I can retrieve them
BoxX,BoxY is wave to feed imageBoundaryToMask width=4608, height=3288, xwave=boxx,ywave=boxy, seedx= mean(boxX), seedy=mean(boxY)
STRUCT WMButtonAction &ba
switch( ba.eventCode )
case 2: // mouse up
// click code here
Wave BB = boundBox //global coordinates
GetMarquee/Z
If(V_Flag)
roiwave()
else
SetMarquee BB[0],BB[1],BB[2],BB[3]
endif
break
case -1: // control being killed
break
endswitch
return 0
End
Function ROIWave()
Wave BoxX,BoxY,BoundBox
// save global coordinates
Getmarquee
BoundBox[0] = V_left
BoundBox[1] = V_Top
BoundBox[2] = V_Right
BoundBox[3] = V_bottom
//get axis specific coordinates
Getmarquee/K Flat_Top,Flat_Left
BoxX[0] = V_Left
BoxY[0] = V_Top
BoxX[1] = V_Right
BoxY[1] = V_Top
BoxX[2] = V_Right
BoxY[2] = V_Bottom
BoxX[3] = V_left
BoxY[3] = V_Bottom
BoxX[4] = BoxX[0]
BoxY[4] = BoxY[0]
end
Andy
March 2, 2018 at 08:59 am - Permalink
March 2, 2018 at 10:56 am - Permalink