取消
显示结果 
搜索替代 
您的意思是: 

Updating Intensity Plot Live

This VI generates confocal images by iterating voltage values through the points a 2D raster waveform, and collecting fluorescence data at each point using the DAQ counter. The problem I'm having now is that the array of data plots only after it is entirely collected. I would like to be able to see it update live. I have seen some posts about using control references, but I'm not sure how to implement.

 

Attached are the VIs I'm referring to. GPScanTEST.vi is the main program.

 

Thank you for any feedback on this matter.

 

 

0 项奖励
1 条消息(共 7 条)
3,257 次查看

Posting from phone so haven't seen your VIs (yet - will post again later but not sure when) but to update a graph during acquisition, put the graph inside the Acquisition loop.

 

If there's lots of processing (sounds likely) you might use (or already be using) a Producer/Consumer design. In that case, keep the graph in the consumer loop. This also works if your producer and consumer are in different VIs (but may require multiple steps):

  • Produce acquired data in one loop in one VI 
  • Process in another loop in another VI
  • Enqueue processed data back to top VI for display.

Or similar. The flow above would usually use two queues and create them in the top level VI and pass them to the appropriate SubVIs (producer gets first queue, processing loop gets both queues).


GCentral
0 项奖励
2 条消息(共 7 条)
3,206 次查看

Hi aerickson,

 

unfortunately you are using the latest LabVIEW version (2019) to attach your VIs, so I cannot look at them right now…

 


@aerickson5 wrote:

The problem I'm having now is that the array of data plots only after it is entirely collected. I would like to be able to see it update live.


Place the intensity graph inside the loop collecting samples for the 2D array of pixels. Everytime you write a pixel into the array you can also update the graph (if needed):

check.png

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 项奖励
3 条消息(共 7 条)
3,194 次查看

Hi aerickson,

 

I took a look at your VIs now and have the following comments and questions. Hopefully you can give a bit more insight and then we could give better suggestions:

  • You have a VI to generate your 2D raster, and this produces an array of waveforms. I didn't closely check the functionality, but I guess this works how you want it to?
  • You want to view the "results" (here I'm a bit unclear on what exactly forms a result) for each of the waveforms in the array.
  • Your "Scan" VI acquires a set of points from the AI task, and perhaps the "Counter Task(s) out" tasks. Note these are labelled "out" but you're acquiring - might be worth relabelling this in your cluster.
  • The Main VI calls Scan in a loop, and produces a 2D array for 4 different outputs each iteration. I assume these are your results, but it's not clear how the waveform you generate is related to a set of results.
  • Based on what I can see, it seems like you probably aren't getting data in the way you expect/desire (although I'm not sure a) what you desire and b) what you're getting).
  • I'd recommend splitting Scan.vi into smaller VIs that you can call from your main VI, with clearer purposes. In particular, I don't think that the Generate_2D_Raster should be a part of Scan (if I understood correctly) and this should instead be called in the main VI and then you want to scan once for each waveform (which might imply/require a nested For loop).
  • I'd strongly recommend using a much smaller connector pane pattern for Scan.vi You don't need all of those connections and having so many either 
    • tempts you to add too many inputs/outputs, or
    • makes it difficult to work out where to connect something.

 

Please let me know if I was wrong about the intention, or if you can clarify any of these questions.

Otherwise, perhaps you could make some of the suggested changes and see if that improves matters for you.


GCentral
0 项奖励
4 条消息(共 7 条)
3,179 次查看

Thanks very much for the reply,

 

I think I was a bit vague in the last message. I wasn't sure how much of the hardware side/application I should include in this description, but it probably helps so it's clear what I'm interested in. Things are working as I want them too at the moment, besides the intensity plots not updating in real time. I'll just try to address each of the points you brought up

 

  • The sub vi (Gen 2D Raster creates the scanning pattern based on the input scanning parameters. It generates two waveforms, one for each analog output. This part is working fine. 
  •   The results are the matrices of counts or analog input data that form the images. In this case, I'm mostly interested in the "counts" data coming from the Scan VI, which are then plotted in the "fluorescence" indicator. 
  • Within the "Scan" vi is the sub-vi (Gen 2D raster) which generates the set of points. The scan VI writes these points to AO0 and AO1 (moving galvanometer mirrors and laser position) and counts for a certain duration of time at each point. This forms the confocal image. For sure the "counter task out" is a bit confusing.
  •  The 4 different results are 2 counter images, and 2 AI images. An image being a matrix of counts or voltage at each point on an m by n grid. Right now, I'm only interested in the first counter image, formed by using counter 2 on the DAQ. This data is plotted on the "fluorescence" intensity graph.
  • Here's an image I took using using a calibration slide. Each pixel corresponds to a certain number of counts (single photon counter) at that location.aerickson5_0-1584638447655.png

    The only problem is that I cant figure out how to make it plot as it scans.

  • I think part of the problem I'm having is that due to the structure of the program, data gets trapped within sub vi's and cant move forward until the entire process is finished. 
  • Definitely this is a very messy program and I need to refine it, but I was very curious about this problem.

Thanks again for the response. I hope this helps to clear up my intentions and the bigger idea regarding what this program is being used to do.

 

Best regards,

Adam

0 项奖励
5 条消息(共 7 条)
3,160 次查看

I moved the plot inside the for loop which collects the data. Still, the graph displays only after the entire array of data is collected. Here's what it looks like now. 

aerickson5_0-1584720321485.png

Can you see from this picture why the points don't plot in real time? Is there some property of DAQmx I can change which would help

 

Thanks,

Adam

 

0 项奖励
6 条消息(共 7 条)
3,131 次查看

Hi aerickson,

 


@aerickson5 wrote:

I moved the plot inside the for loop which collects the data. Still, the graph displays only after the entire array of data is collected.


The VI does what you want it to do: read data from DAQmx, then plot the data in the graph.

When you want to plot parts of data step by step then you need to read the data in smaller parts step by step...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
7 条消息(共 7 条)
3,118 次查看