Showing results for 
Search instead for 
Did you mean: 

Global Rectangle in Imaq functions

Hi all, can somebody tell me the purpose of global rectangle in the ROI cluster.

0 Kudos
Message 1 of 5

Have you looked up the Help for ROI, where the Global Rectangle is defined?  Have you typed "NI Global Rectangle" into a Web search and looked at the material presented there?


A Region of Interest (ROI) can take many forms based on how you define it.  In every case, it defines some region of the Image space.  For any ROI, you can draw a rectangle with horizontal and vertical lines (so that you need only 4 coordinates, the upper left and lower right, to define it) such that (a) it completely surrounds the ROI and (b) each side "touches" the ROI at one or more points on the side.  This "unrotated" Rectangle is the Global Rectangle.


Bob Schor

0 Kudos
Message 2 of 5

Thanks, Bob

I was asking me the same question as mahalakshmi05

and still not all is clear for me.


I think the question is: When and in which algorithms (vi's from the palette) it is used and what for?


I'm doing pattern matching and I'm realizing that the global rectangle seems to be completly ignored by the algorithm: I can define a global rectangle arbitrarily even smaller than the region of interest or an empty array for the global rectangle in the ROI cluster and the pattern match works with no error.

0 Kudos
Message 3 of 5

It has been a while since I did much Image Processing, so I'll have to look through old code to find where I called these functions.  If I don't reply in a few days, send me a Private Message to remind me to look.


Bob Schor

0 Kudos
Message 4 of 5

The Good News is I located the Project where I did some manipulations of video IR images to help a colleague studying flow of lymph in lymph vessels.  This was done almost a decade ago and the project was never finished (they had trouble getting good images), so my memory is a little fuzzy about the details.


Imagine an ROI.  Bound it from above and below with horizontal lines, and from left to right with vertical lines.  These lines form the boundary of the Global Rectangle -- you can ignore the rest of the image if you are only interested in your ROI.  It comes in handy when creating ROIs from existing ROIs.


In the "flow" analysis we were attempting, we created rectangular ROIs that enclosed a length of a lymph vessel.  This ROI, in addition to having a Global Rectangle, had ROI parameters that described the long skinny rectangle as a "rotated rectangle".  I wanted to create two new ROIs that were square regions at the ends of the skinny rectangle, and compare the "moving images" passing through these two "square" ROIs, hoping to estimate the velocity of flow.


To calculate the new ROIs, I used the "angle" parameter of the skinny ROI (drawn from one image of the video) to "untwist" the ROI, then defined two new ROIs as square (hence "rectangular, with zero "twist") that fit in the left and right ends (so the Global Rectangle now becomes the same as the ROI), then "retwisted" the two ROIs back to their original position.  Now we can calculate the time course of image intensity at the left and right ends of the vessel (defined by our little square ROIs).  We can calculate the distance between the ROIs, and if we can estimate the time (or # of frames) difference between the intensity curves, we can estimate the velocity of the flow.  That's the theory, anyway.  I don't know what happened with this project -- I think the student doing it went on to do other things, as did I.


So, bottom line, the Global Rectangle allows you to focus in on a rectangular area of a 2D image that contains your ROI.  It's of interest, and of use, when you go about programmatically creating new ROIs from existing ones, and may have other uses that I don't know about.


Bob Schor


Now, imagine a long skinny rectangle and looking at a video of fluid flowing through it.  How fast is the flow?  That was our question.  One way to answer this is to create two square ROIs that "fit" into the two ends of the rectangle, look at the intensity of the image as a function of time (= frames of the video) at the two ends and see if you can estimate the time you need to shift one intensity curve (say, at the left square ROI) so that it matches the intensity curve at the other ROI.  If you know the distance between the ROIs, and the time difference in image intensity of the flow past them, you have velocity (delta d / delta t).  My contribution was figuring out how to "untwist" the Global Rectangle so that it was horizontal (or vertical), define new "end square" ROIs that fit into the ends of the Rectangle (thus defining two new ROIs), then "retwist" the new ROIs so they appear at the ends of the original ROI and can be used for the analysis.



0 Kudos
Message 5 of 5