I am trying to create a program which allows the user to draw a series of ROIs (lines and rectangles) on a sample image, then generate line profiles or histograms etc for each of the ROIs drawn. I know you can use CTRL+mouse down to draw multiple ROIs but my issue is in storing each of these ROI (descriptors) in an array and then re-using each collection of pixels for analysis.
I managed to find some code here which begins fairly close to what I need to do: http://forums.ni.com/t5/LabVIEW/Multiple-ROIs/m-p/1830029/highlight/true#M626558
So far, I have TiTou's code (attached) and I have been messing with Ungroup ROIs. I think my issue is how exactly to use the ROI Descriptors - how do I use the array of them to find each of the line profiles?
If anyone can give me some guidance that would be much appreciated 🙂
Solved! Go to Solution.
Midway through an istall so havn't seen your code, but from the top of my head:
Get your array of ROIs via the ROI property node on the image control. Index this array, and these are the different ROI descriptors that are drawn on your image control.
As far as I remember, the ROI property node gives out an array of clusters, the cluster being the ROI descriptor.
This might be a silly answer. I will have alook once my install completes.
This is how I have used multiple ROIs in the past....
Each ROI has a place in the array that is being indexed. (so only two ROIs in this example)
When using the "ungroup ROI" vi you get an array of cluster, each cluster represents one ROI. The global rectangle array has 4 values (Left, top, Right, Bottom), it is the containing horizontal rectangle of the ROI and the contour array has only one item, in the cluster, the "type" enum / u32 tells you the type of ROI.
0 : No selection
1 : point
2 : line
3 : rectangle
4 : Oval
5 : Polygon
6 : freehand
7 : annulus
8 : not used
9 : not used
10 : broken line
11 : freehand line
12 : rotated rectangle
hope this helps
We have two ears and one mouth so that we can listen twice as much as we speak.
Thank you Phil and TiTou for your replies!
I actually didn't use Ungroup ROIs - I'm not sure what the advantage in this would be?
I've attached my latest program. I unbundled the contours from the ROI descriptors and then unbundled the points for each line end/startpoint. I think I need to wrap the contour indexing in a for loop to access each of the drawn line ROIs rather than just the first one.