LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Live imaging Interface for Andor EMCCD camera with event structure and while loop problem

Hi everyone,

 

Currently I have managed to do live viewing of the samples. However, my approach requires using of while loop in the event structure. This causes the both the "Live" and "Shut down" button to hang. From some of the previous thread I read, it seems that we should not use while loop in an event structure. Any idea how do we update the latest images on the screen without using while loop?I have attached me vi as below. Thanks again for all your feedback.

 

Kind regards,

Han Yen

 

0 Kudos
Message 1 of 12
(4,369 Views)

It sounds like your program may benefit from a Producer/Consumer design structure. This design will separate the user interface from the program execution and allow the user to click buttons on the front panel without any hanging. The link below gives a basic overview of how it works.

 

http://zone.ni.com/devzone/cda/tut/p/id/3023

 

Jake H

Jake H | Product Manager
0 Kudos
Message 2 of 12
(4,341 Views)

Thanks a lot Jake. I will check out the Producer/Consumer design structure. I actually tried a solution suggested by altenbach in the link below but there is live image viewing is not smooth. It seems the frame rate is quite bad.

 

http://forums.ni.com/t5/LabVIEW/How-to-stop-While-Loop-in-Event-Structure-with-same-button/m-p/85628...

 

Hope the producer/consumer structure will work well. Thanks again.

 

Kind regards,

Han Yen

0 Kudos
Message 3 of 12
(4,330 Views)

Hi Jake,

 

I am not sure if I understood the Producer/Consumer design correctly. I haven't been able to implement the Producer/Consumer successfully with the SNAP and LIVE button. It seems that when I click SNAP, the enum 2 indicator is ok. But when I click LIVE, the enum 2 doesn't seems to be able to identify the LIVE button activity. I have attached my code. Wondering would you have any clue where could I have made a mistake? Thanks again for all your help and feedback.

 

Kind regards,

Han Yen

0 Kudos
Message 4 of 12
(4,276 Views)

Hi Han Yen, 

 

First thing first, what version of LabVIEW are you using?  You may want to look into using Event Structure if its available in your version of LabVIEW. From what I can tell from looking at your code, you are just traying to change behavior based on button clicks on your front panels. This may prove useful.  

Also, I got enum2 to update to the Live button activity. Could you tell me more about your problem exactly? Maybe walk me through what you are trying to do? I just want to make sure that we are both on the same page and sometimes explaining your end goal would be helpful in me understanding your overall code.

 

Allie F. 

 

0 Kudos
Message 5 of 12
(4,249 Views)

HI Allie

 

Thanks a lot for your time. I am actually using Labview 2009. I do have event structure.

 

Currently I am trying to write a program to control a high speed EMCCD camera by Andor. At the moment there are 7 basics functional that I am trying to implement on the GUI.

 

1) Snap - to snap image

2) Live - to grab live images of cells on microscope

3) Stop - stop live imaging

4) Gain modes - user can change normal gain or EMCCD gain on run-time (value from 1 to 1000)

5) Frequency - changes the frequency of camera during run-time using slider (value from 1MHz to 16Mhz)

6) Frame rate (1ms - 10s)

7) Temperature (20 to -70 deg C)

 

I did try Event Structure to check for events on value change. It was ok if I am just snapping images. When I need to do live imaging, Event Structure (without Producer/Consumer approach) requires me to use 2 while loops which caused my buttons to hang. I think it was due to 2 while loops that I used for live imaging in Event Structure (Inner loop to grab the latest image and update into the array of the outer loop before displaying using windraw). I guess I have to use 2 while loops because Andor did not have Grab function in their Labview library.

 

So, that's when Jake referred me to Producer/Consumer approach. With the producer/consumer approach, it does prevent the buttons from hanging. I plan to use enum2 to update Live button so that I can use the 2 while loops inside the "Live" case structure. I do get Live button signal sometimes too but sometimes it becomes Snap button signal which is strange.

 

If all goes well, I plan to use the Producer/Consumer approach to implement all the functionality too. I hope I am on the right track. Do let me know if you need any additional information from me. Again, thank you very much for your time and feedback. Greatly appreciate them.

 

Kinds regards,

Han Yen

 

P.S. perhaps it may not be a good idea to write the whole program in one VI? or should I break it down into small sections?

0 Kudos
Message 6 of 12
(4,243 Views)

Han Yen,

 

It is usually better to try to break your VI's into subVIs when possible, especially if you're performing the same operation in a bunch of different cases to allow for easier rebuilding by just dropping in the subVI and wiring it up. Also, the producer/consumer method seems like the way to go with this application so I'd run with it and just post back if you have any more troubles with it.

 

Have a great day!

Peter W.

0 Kudos
Message 7 of 12
(4,208 Views)

Thank you very much Peter. I'll try break it down into sub-vi and implement the producer/consumer method. Hope it will go well.

You have a great day too. 🙂

 

Kind regards,

Han Yen

0 Kudos
Message 8 of 12
(4,206 Views)

Hi,

 

Have you been able to produce a good VI for Andor imaging? 

 

Thanks,

mw

0 Kudos
Message 9 of 12
(3,580 Views)

Hi erop,

 

I'm not sure you will get a response in this thread because it hasn't been replied to since March of 2011.

 

As a suggestion, I reccoment opening a new thread with this question to get a quicker/better response.

Justin M.
Applications Engineering
National Instruments
0 Kudos
Message 10 of 12
(3,559 Views)