Moving and Sizing an Object Drawing Layer

Hi,

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
I think the built-in window resizing GUI tools are less complex and more intuitive than all the drawing options, so I wonder whether it might require less coding if the user resized a window in order to select the ROI (rather than altered a drawn ROI). Your code would just have to run GetAxis commands to get their selected ROI. Though it wouldn't be strictly necessary, you could also make a simple window hook catching axis range changes, which would update a drawRect in a second window that also contains the image. This would still allow them to see their ROI in the context of the full image. Of course, this is no solution if the ROIs might be polygonal with more than 4 sides.
Hi AC,

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
Also request for version 8. Add the axis capability to setmarquee.

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)


Function SetROI(ba) : ButtonControl
    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
I've used the GraphWaveEdit and friends functionality to define a line scan in an image. Not exactly straightforward as you have to support enabling/disabling this mode, and setup the wave dependency properly. I'm sorry I cant share the code.