LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

intensity graph filled sectional circle draw - LabVIEW 8.2

Hi:

I've working on a subVI in which circles are drawn on an existing intensity graph in order to demarcate regions of the intensity graph.  A mouse click on a region should result in a filled region (selection) overlay, and a subsequent click on the same region should result in unfilling the region (deselection).  I have created a VI to do this (at least the selection portion), but the method I am using requires repeated circular draws using the 'Draw Oval' command from the picture control pallette.  The drawn oval is then transferred to an intensity graph using the 'Plot Images.Front' property node. The number of circles drawn is based on the value of the 'Levels' control. I have not fully completed the deselection procedure yet, but can demonstrate it below.

If you would like to run the attached VI, mouse click inside the second circular region, and you can see the fill.  Mouse click on the same region again, and a deselection will occur.  The VI is somewhat complicated in terms of calculations for the circles, but in looking at the code, mainly see the "FFT: Mouse Down" case and you will see how this works.

I am wondering if there is a better (faster) way to do this using picture control mask function.  The container does not necessarily have to be the intensity graph (it can be the picture control), but I have mostly standardized on the intensity graph due to the massive number of property nodes that are available for that container.  But even using the mask function to develop the overlay concept, I have a question about how quickly the mask is generated - remember that the number of levels selected will change the nature of the overlay.

Any strategy ideas would be quite helpful.  Additionally, a way to provide some transparency to the overlay would be interesting such as one can do with the 'PlotImages.Middle' property node available for waveform graphs.

Thanks,

Don
Message 1 of 5
(4,495 Views)
Hi Don,
 
You are correct; there are a variety of methods to accomplish what you are trying to do here. I have run a quick test on my end to draw a filled circle on an Intensity Graph, Waveform Graph, and Picture Control. Off hand, none of them seem to perform significantly faster or slower than other methods.
 
I took a look at your application, and noticed that it appears to be very complex. When running the program, each circle that is drawn (and filled in) takes quite some time. Have you tried creating a very simple test application that simply overlays a single circle on your existing plot data? It is difficult for me to decode exactly what is going on in your program without comments, etc.
 
For simple graphics operations such as drawing a circle, we should be able to find a way to quickly fill in the selected region. Since the Picture Control is explicitly meant for drawing images, for complex applications it may be a bit faster than displaying directly on Waveform Graphs or Charts. Still, depending on the format of your graph data it may be more work for you to display that data on a Picture Control.
 
Please let me know if you would like to dive further into this issue; I think that the next logical step is to create a very simple test application that overlays circles (or ovals) on your existing data. At that point, we can explore which plotting method is most efficient and simplest to program.
 
Regards,
 
Casey Weltzin
Applications Engineer
National Instruments
0 Kudos
Message 2 of 5
(4,474 Views)

The issue is that we want to end up with some sections filled in, and some not. The user needs be able to select and deselect sections as needed, there needs to be some transparency to be able to see the underlying image. If the idea was just to draw circles or filled circles, this application would be simple.  I am going to show you where I am with this.  I think by you seeing the way it works, you can see what the goals are.  Since my last post, I was able to:

1) simulate transparency and increase speed by drawing fewer circles and using dashed line draws (and decimating image).

2) complete the deselection portion of the code

3) add an option for drawing either circles or squares

 

It works better and faster now - but I still look for creative ways for instantaneous draws of transparent sections.

0 Kudos
Message 3 of 5
(4,467 Views)
I took a look at your code and I don't understand all it is doing, but I can help you speed upi what you have.  First thing I would suggest is using the VI profiler if you have it to see in which VIs you are spending the most time.  Based off that I changed the attached VI. 
 
Basically you where getting the XY -> Coordinates a lot of times and everytime you called the grpah properties.  You don't really need to do that.  So notice in the attached I query the graph a single time and then from that point on I use the maps I created.  This should speed it up some.
 
The biggest time savings I can get you is by defering panel updates in your FFT Mouse Down Event.  Basically you don't need to draw the Image 100s of times per mouse down.  So at the begining of the event call the set panel property DeferPaneUpdates to true and then at the end reset it to false.  You will see a big improvement.  Along these lines is there a reason you set the image to the graph everytime you call "Draw_circle_on_intensity_graph_no_cursors.vi".  You are building up the end image you will want so only set it after the loops its called in are all done.
Message 4 of 5
(4,458 Views)
Thanks for your reply.  This is of great help.

Actually, it is your last lines that are the key here.  By utilizing the property node 'PlotImages.Front' AFTER the loop for multiple circle / rectangle draw, the circles are actually drawn instantaneously.  The Defer Panel Updates property is then not even needed since the draw occurs only one time after the picture is built up.

Sincerely,

Don
0 Kudos
Message 5 of 5
(4,442 Views)