Hook function on graph marquee interaction

Is it possible to call a hook function when the graph marquee is moved or interacted with?

If not is there another solution?
I would like to move (optional: resize, rotate, etc) a region of interest on an image and call  imagestats/G={rowMin, rowMax, colMin, colMax} for every interaction.
There isn't a hook function for this, but you can add a menu item to the marquee menu. You can get marquee information using the GraphMarquee operation. For more info on the marquee menu see:

DisplayHelpTopic "Marquee Menus"

John Weeks
WaveMetrics, Inc.
support@wavemetrics.com

Bump!

I request a window hook function return variable:

26        "marqueeaction"    a marquee has been added, removed, or moved in position

This will remove the need to set and track global variables. My specific need is to track the movement of a marquee and keep users from extending it beyond the bounds of an image window.

The marquee is being drawn within an image to set an RoI. I'm not clear how cross hair cursors will be easier or even doable to achieve what I need?

In the meantime, I have a window hook function that, on a mouse-up event, does a cross-check to reset the marquee when it has been dragged outside the image bounding. It works. It would just seem more effective/cleaner to only have to grab the specific event code I need.

Thanks!

Cross-hair cursors are just normal graph cursors but instead of just the circle or square icon, they have lines that extend across the plot area. With a combination of two cursors (you can even use cursors beyond the standard A and B so that you won't use up the most-used cursors) you can enclose a box on the graph, just like using a marquee. Further, you can make them free cursors so that they don't stick to specific data points in your image.

I've attached a screen shot of an image with cross-hair cursors.

One advantage is that a window hook gets notified when they move.

One possible disadvantage is that you might need to write some tricky code to create a mode where they move together, though if they are both selected the arrow keys will do that. I think you might still need your cross-check code if the cursors are on a zoomed-in graph.

There are lots of things you can do to change the appearance/behavior of graph cursors.

GraphHairCursors.png

> One possible disadvantage is that you might need to write some tricky code to create a mode where they move together, though if they are both selected the arrow keys will do that. I think you might still need your cross-check code if the cursors are on a zoomed-in graph.

Thanks. Those two words "tricky code" throw me off. Also, the Marquee draws more efficiently for my applications.

Here is the the code to check and reset.

// image window hook function
Function Hf_imgTImageHook(iwH)      // WindowHookFunction
    STRUCT WMWinHookStruct &iwH
   
    variable hookResult = 0
   
    switch(iwH.eventCode)
        case 5:     // mouseup
            if (f_HasMQ())
                ResetMQCoordinates(force=1)
            endif
            ...
            hookResult = 1
            break
    endswitch
   
    return hookResult
end

// has marquee
Function f_HasMQ()

    GetMarquee/W=$k_imgDisplay/Z
    return (v_flag)
end

Here's what I might prefer.

// image window hook function
Function Hf_imgTImageHook(iwH)      // WindowHookFunction
    STRUCT WMWinHookStruct &iwH
   
    variable hookResult = 0
   
    switch(iwH.eventCode)
        case 26:        // marquee altered, added, or removed
            if (f_HasMQ())
                ResetMQCoordinates(force=1)
            endif
        case 5:     // handle Marquee BEFORE mouse up
            ...
            hookResult = 1
            break
    endswitch
   
    return hookResult
end

// has marquee
Function f_HasMQ()

    GetMarquee/W=$k_imgDisplay/Z
    return (v_flag)
end

But, I guess this is akin to splitting hairs at some point since I need to handle the mouse up AFTER the marquee anyway. Oh well.

I will soon have to figure out how to reset the marquee positions with zoomed graph scales.

ExampleMQonGraph.png

Well, there's tricky and there's tricky. If you don't need a move-together mode, then you don't need that tricky code. And it's not all that tricky- just respond to the cursor event with a computation that moves the other cursor in the pair.

I personally like the appearance of the hair cursors (you don't have to have the circle and square icons, either). I have used hair cursors myself for similar sorts of things. But to each his own.

I do have cases where I want the entire box to move, not just move the one side or the other side. For example, I would like to set an exact square or circular region as the RoI.

I'll reconsider the idea to switch to cross-hairs (*). This could solve my other annoying problem -- I need to get the RoI location in image pixel coordinates not in window point coordinates.

(*) ---> Ha! You have a Demo for that! Thanks.