From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

Changing default new ROI selection from replacement to addition

Solved!
Go to solution
I am trying to get a Vision control to change the default behavior of *replacing* any previous ROIs (unless the Ctrl key is pressed down) to *adding* a new ROI.

I came to the conclusion that by looking at the previous ROI you could make a good guess as to whether the user had added an ROI or simply moved the last one, but there's no way of telling if the user adds a new ROI that is the exact same size as the previous (the status is inherently undefined if all you have access to is when a drawing event has already occurred and what the current/previous ROI list is). The chance that someone would draw a new ROI the EXACT same size as the last one, but I'm a stickler for little loopholes like that so I'm forcing the user to use a point ROI and am programmatically adding a square ROI surrounding (and replacing) the point ROI.

My solution aside (which works for me, but might not work for everyone), does anyone else know of a way to change the behavior to actually ADD an ROI without using the Ctrl key?

Now if only the 'clear/delete ROI' would register as a shortcut menu event...
0 Kudos
Message 1 of 5
(4,243 Views)
As you mentioned,  the easiest way to add multiple ROI's on your image is to hold down the Ctrl key when you while you add a new ROI. This will allow you to draw new ROI's without removing the previous ROI's that you had drawn already on the image.
 
Your other option is to programmatically draw multiple ROI's where you want them to be. Please refer to the following KnowledgeBase called Common Questions and Issues with the IMAQ Overlay Functions. There is a section in that document called Displaying an Image with Overlays Without Purchasing NI-Vision. This explains that "If you need to add crosshairs, lines, rectangles, or oval overlays to your image, you can programmatically draw ROI's on the image using property nodes in your LabVIEW code. These ROI's will not affect the actual image values, so they will work just like overlays." The property node you will want to use is a property node of the Image Display.
 
I hope this answers your questions. Please let me know if you have further questions. Thanks, and have a great day.
 
Respectfully,
0 Kudos
Message 2 of 5
(4,235 Views)
So there's no way for the USER to select a whole bunch of ROIs w/o the ctrl key? Image management programs have the option of changing the default selection mode (click to add/remove instead of replace selection) and that's what I'm looking for. After selecting 9 ROIs if your ctrl-key finger gets a little lazy, then all of a sudden instead of being done at 10 ROIs, you have to start all over.
0 Kudos
Message 3 of 5
(4,233 Views)
Lanmat,
 
Correct!  For the USER, the CTRL key must be used to select multiple ROI's. 
 
Thanks,
0 Kudos
Message 4 of 5
(4,212 Views)
Solution
Accepted by topic author McQuillan

This is an old thread, but perhaps this will help someone in the future...

 

I also wanted the user to be able to select mROIs without holding down CTRL. A simple trick is using the "Mouse Down?" filter event.

 

With this filter event, you can make windows "think" ctrl was pressed by modifying the PlatMods.Ctrl node.

In the image, I'm just showing a TRUE constant. However, I recommend you do some conditional logic to enable and disable "multiple ROI mode"

 

McQuillan_0-1669109397696.png

 

Anyway, this probably isn't useful to you now, but maybe it will be helpful to someone else 😊

 

Message 5 of 5
(1,576 Views)