Example Code

Pass Image Data Between VI's on the Same Computer

Products and Environment

This section reflects the products and operating system used to create the example.

To download NI software, including the products shown below, visit ni.com/downloads.

    Software

  • Vision Development Module
  • LabVIEW

Code and Documents

Attachment

Overview

This example demonstrates how to transfer an IMAQ image from one VI to another with a queue.

 

Description

These two VI's illustrate how to pass image data between two different VI's on the same computer. Since the image data type is actually a pointer to the image, rather than the image data itself, we will be passing the reference to the buffer that holds the image.

In this example, queues are used.

By using the same queue name for each "Obtain Queue", we can have access to the same queue.  (This works as long as both VI's are on the same machine). Once we have read the image from a file on the host machine, we pass the image into the queue.  In the second "receiver" VI, we read from the queue, and then dequeue the image element. Once we've dequeued the image, all we need to do is call "refresh image" and the image will update.  We do not need to keep dequeing and enqueing the image, because we are just reading from the location in memory.

Note that this is different from other LabVIEW datatypes. 

 

Requirements

 Software

  • LabVIEW Base Development System 2012 (or compatible)
  • NI Vision Development Module 2012 (or compatible)
  • If running in a Real-Time context, you will need the LabVIEW Real-Time Module 2012 (or compatible)

 Hardware

  • No hardware is necessary to use this example VI

 

Steps to Implement or Execute Code

  1. Download and open the attached ZIP-file
  2. Open the [Main]...VI and follow the instructions in this VI

 

Additional Information or References

IMAQ Transmitter - Front Panel.png

 

IMAQ Transmitter - Block Diagram.png

 

Note
Please keep in mind, that this example doesn't provide any synchronization between the transmitter and the receiver.
The receiving VI shows sometimes no overlay. This happens, if the receiving VI reads the image after the overlay was cleared but not written again (if the read happens between the steps 3 in the block diagram).

 

**The code for this example has been edited to meet the new Community Example Style Guidelines. The edited copy is marked with the text ‘NIVerified’. Read here for more information about the new Example Guidelines and Community Platform.**

Marti C
Applications Engineer
National Instruments
NI Medical

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.