11-20-2010 11:53 AM
I'm using tIhe XY graph to plot a Pointcare representation of RR intervals (heart beat). I would like to use the mouse to draw a polygone surrounding the points of interest and get their indexes from the original array. Thank you to oriented me to some strategy!
Olivier
Solved! Go to Solution.
11-20-2010 12:38 PM
OK your question might be "just a little bit vague" for the average forum member!
I realize that you have a time record of a EEG and are looking at Atrial depolarizations. Here is where you should provide some sample data sets and exactly what information you want to observe within that data set. The rest is simply proposing algorythims for you to implement (we are pretty good at that). Mind reading s a skill that most of us are poorly equiped for (but Ben seems to occasionally manage it)
11-20-2010 02:38 PM
OK, I wasn't clear enough but got your attention..Thanks. Let's say that I have a series of data {x1,x2...xi...xn} that represents the duration of time between two adjacent heart beats. The pointcare plot is the representation of the points [xi,x(i+1)] and that can be achieved to by the XYGraph function. Using this graphic, it is expected that adjacent intervals with almost similar values will form a cloud (circular, eliptic or with more complex shapes) centered around the average values of the xi. Now, unusual changes between adjacent xi values in the time series (lower or higher x(i+1)) will result in points outside of the primary cloud. This is an easy way to identify abrupt changes in a time series.
The step I'm blocked with is that, after I used the XY graph, I would like to use the mouse the visually draw the border of the primary cloud and extract the indexes of the point in or and points outside the border separately. Is that make more sens?
Again, I really appreciate your help for that.
Olivier
11-22-2010 07:44 AM
This can be done, but unfortunately is not trivial. Since this is the second request I have seen in the last week for this type of functionality, I would encourage you to post the idea to the LabVIEW Idea Exchange.
All graphs have a front, middle, and back image, which is set using a picture control data type. You can use this to draw your cursor using an unfilled rectangle. You can capture mouse events on the XY graph using the event structure, and update your enclosed rectangle (or ellipse, or whatever you would like to draw) when the mouse moves. You can extract the enclosed data points from your original data set when a mouse up event occurs or when the user clicks inside the rectangle after drawing it. You may also want to include ways to tweak the boundaries of the rectangle.
This is relatively straightforward if you have used the event structure before, but could be very confusing if not. Let us know if you need more information or help.
11-22-2010 08:32 AM
If you only really need to designate the "low" and "high" values on the X-axis and similar values on the Y-axis thus describing a rectangle that is aligned with the axes (no rotation), then using the graph cursors would be an easy way to do this. You can place two cursors on each axis and lock their vertical or horizontal axes and allow the user to drag them to the visual boundaries of the cloud. You can even select the cursor's appearance so that there are vertical/horizontal lines to help with the visualization. It is then easy to read the cursor positions programmatically to determine the rectangle's position (in the graph units).
You could something a little bit more complicated by using the graph cursors and not locking them at all, but allow the user to drag several of them around to describe a more complex shape enclosing the point cloud and then read the cursor positions to do some shape fitting.
11-22-2010 10:34 AM
Thanks for your inputs. The option of max and min on each axis may not work in my case since the boundary to determine can have complex shapes.
I put the post at the Labview Idea forume:
I don't think it will be easy for me to use the structure event right now....I'll try to work on it in the following days but any VI as an example for the use of mouse in XY graph will be greatly appreciated.
Olivier
11-22-2010 09:43 PM
It seems harder to describe in words than to just post a simple example. Simply click on the graph to add cursors, drag around as desired and see the included points. I use a 1-bit bitmap to detect interior points, and the draw multiple points VI for the polygon image.
I sort the points so that the polygon is fully filled, so sometimes you will see it switch shape suddenly. Not a full-blown solution, but a good start.
11-23-2010 03:58 PM
This is really impressive and almost exactly what I was looking for ! The writing is somewhat upon my skills in labview so I may be completely wrong in my following observation. By using the pixel system (which is a cool strategy) we loose the direct connection to the initial array (time amplitude). Therefore, it didn't seem strait full to me to get the indexes of the points that are in and out the polygon in reference to the array feeding the XY graph.
Thanks for helping!
O
11-23-2010 04:21 PM
When I cooked up the pixel system yesterday I knew it should work, but I was still surprised to see that it actually did. I will see if I can add a little to the example for you, or you may be able to find some simple examples of conditional autoindexing on the forum.
11-24-2010 04:20 PM
Thanks, I got the indexes based on your info. This is really a great VI for people dealing with clusters. I really wish this function be added in the next update!
Thanks for your brain-time !
Olivier