Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

ROIs and Images

Hello,

I am attempting to keep a running display of all loaded ROIs in an image created with the line drawing tool. I can do this one at a time, and use the image property node "ROI" to extract the ROI cluster for the line that was just drawn. However, when trying to reload the ROI into the image, to keep a runner display of ROIs, I can only get the most recent one. Is there a way to do this with an image property node (I imagine) without purchasing an upgrade to Vision, for $1300? Attached is the VI. Look in the "Add ROI" case and you'll see where the property node generates the ROI cluster.
0 Kudos
Message 1 of 4
(3,588 Views)
Hi Mike,
 
It sounds like what you are trying to do is use multiple Region of interests in a single image.  Rather than do it by repeatedly adding ROIs, there may be a better way.
 
Specifically, each ROI is made of a number of contours.  What you would probably like to do is keep track of multiple contours.  The first array in an ROI is comprised of 4 numbers: the top, left, bottom and right co-ordinates that would surround all contours in your image.  The next array contains all the contours in your image.  Each contour has a type (line, circle, square, etc) that describes how it is formatted, and an array that contains the important points for that contour.
 
Finally, I wasn't sure if it was common knowledge, so I thought I would add that you can add multiple contours to a single ROI by holding down Ctrl while drawing the additional contour.
 
 
Hope this helps!
 
Robert
0 Kudos
Message 2 of 4
(3,574 Views)
Hi Robert,

Thank you very much for your reply. I am able to manipulate the contents of the ROI cluster, ie, strip out the corrdinates and style, etc, as well as recreating an ROI cluster from data stored in a file.  To simplify the matter, I am using only the Line tool for generating ROIs.

My specific problem is in overlaying all of the stored ROIs on top of an image. I have not yet been able to work that out. If you look at the code that I posted, in the Add ROI case, I update a running list of ROIs by placing them into an array of ROIs. Also in the Add ROI case, I extract each ROI in the ROI array and write them to the ROI property node for the displayed image. What shows up on the image screen is each ROI sequentially popping up and turning off so that when the For-loop completes I am left with no ROIs on the screen, just a blank image. You mentioned adding the ROIs. Will that work?

I appreciate your response and hope that you can shed some light on this aspect of the problem.

Mike
0 Kudos
Message 3 of 4
(3,569 Views)
Hey Mike,
 
To display all of the lines you have drawn, you should only have to treat each line as a contour.  In other words, rather than load ROI after ROI, keep only one ROI and add multiple contours.  Each time you add a line to the image, instead of adding it to your array of ROIs, strip out the contour you have just created and add it to your master ROI.  When you redraw the master ROI, the VI will then display all of them at the same time.
 
Hope this helps,
 
Robert
0 Kudos
Message 4 of 4
(3,565 Views)