IMAQ ReadFile VI

LabView NI Vision

IMAQ ReadFile VI

Owning Palette: FilesInstalled With: NI Vision Development Module

Reads an image file. The file format can be a standard format (BMP, TIFF, JPEG, JPEG2000, PNG, and AIPD) or a nonstandard format known to the user. In all cases, the read pixels are converted automatically into the image type passed by Image.

Examples

IMAQ ReadFile

cpath.gif

File Path is the complete pathname, including drive, directory, and filename, of the file to read.

cgenclasstagrefflat.gif

Image is a reference to the image to which data from the image file is applied.

cbool.gif

Load Color Palette? (No) determines whether to load the color table present in the file, if the color table exists. If loaded, this table is read and returned by the output Color Palette. The default is FALSE.

cnclst.gif

File Options is a cluster of user-optional values that you can use to read nonstandard file formats. The structure must be known to the user. This cluster consists of the following elements:

ci32.gif

Read Raw File indicates whether the file to be read has a nonstandard file format. If so, the remaining options in this cluster describe how to read the data.

Note  If you are reading a nonstandard file format, you must set the size of Image to match the contents of the file before using IMAQ ReadFile.
Note  If you specify an unsigned 16-bit integer for File Data Type and Image is a signed 16-bit integer, all values greater than 32,767 are truncated to 32,767.
Don't Read Raw File (0)

Specifies that the file to be read has a standard file format.

Read Raw File (1)

Specifies that the file to be read has a nonstandard file format.

cu32.gif

File Data Type indicates how the image file is encoded.

ci32.gif

Offset to Data specifies the size, in bytes, of the file header. This part of the file is not taken into account when read. The pixel values are read from the byte immediately after the offset size. The default is 0.

cenum.gif

Use Min Max determines if the user is using a predetermined minimum and maximum. The technique to determine this minimum and maximum depends on the following input values:

Don't use min max (0)

Minimum and maximum are dependent on the type of image. For an 8-bit image, min = 0 and max = 255.

Use file values (1)

Pixel values from the file are scanned one time to determine the minimum and maximum, and a linear interpolation is performed before loading the image.

Use optional values (2)

Uses the optional values Optional Min Value and Optional Max Value.

csgl.gif

Optional Min Value is the minimum value of the pixels if Use Min Max is set to Use optional values. In this case, pixels with a smaller value are altered to match the chosen minimum. The default is 0.

csgl.gif

Optional Max Value is the maximum value of the pixels if Use Min Max is set to Use optional values. In this case, pixels with a greater value are truncated to match the chosen maximum. The default is 255.

cenum.gif

Byte Order determines if the byte weight is to be swapped (Intel or Motorola). The default is FALSE, which specifies big endian (Motorola). TRUE specifies little endian (Intel). This input is useful only if the pixels are encoded with more than 8 bits.

cerrcodeclst.gif

error in (no error) describes the error status before this VI or function runs. The default is no error. If an error occurred before this VI or function runs, the VI or function passes the error in value to error out. This VI or function runs normally only if no error occurred before this VI or function runs. If an error occurs while this VI or function runs, it runs normally and sets its own error status in error out. Use the Simple Error Handler or General Error Handler VIs to display the description of the error code. Use error in and error out to check errors and to specify execution order by wiring error out from one node to error in of the next node.

cbool.gif

status is TRUE (X) if an error occurred before this VI or function ran or FALSE (checkmark) to indicate a warning or that no error occurred before this VI or function ran. The default is FALSE.

ci32.gif

code is the error or warning code. If status is TRUE, code is a nonzero error code. If status is FALSE, code is 0 or a warning code.

cstr.gif

source describes the origin of the error or warning and is, in most cases, the name of the VI or function that produced the error or warning. The default is an empty string.

i1dnclst.gif

Color Palette out contains the RGB color table (if the file has one) read from the file when the user passes the value TRUE for the input Load Color Palette? (No).

iu8.gif

Red is the output red value.

iu8.gif

Green is the output green value.

iu8.gif

Blue is the output blue value.

igenclasstagrefflat.gif

Image Out is a reference to the destination image. If Image Dst is connected, Image Dst Out is the same as Image Dst. Otherwise, Image Dst Out refers to the image referenced by Image Src.

istr.gif

File Type out indicates the file type that is read. This string returns an identifier of the file format, which can be BMP, TIFF, JPEG, PNG, or AIPD (internal file format). File Type returns xxx if the file format is unknown.

ii32.gif

File Data Type out indicates the pixel size defined in the header for standard image file types. File Options are not necessary for reading standard image files. For other types of image files, the returned values are passed from File Options/File Data Type.

ierrcodeclst.gif

error out contains error information. If error in indicates that an error occurred before this VI or function ran, error out contains the same error information. Otherwise, it describes the error status that this VI or function produces. Right-click the error out indicator on the front panel and select Explain Error from the shortcut menu for more information about the error.

ibool.gif

status is TRUE (X) if an error occurred or FALSE (checkmark) to indicate a warning or that no error occurred.

ii32.gif

code is the error or warning code. If status is TRUE, code is a nonzero error code. If status is FALSE, code is 0 or a warning code.

istr.gif

source describes the origin of the error or warning and is, in most cases, the name of the VI or function that produced the error or warning. The default is an empty string.

Examples

Refer to the following for an example that uses this VI.

  • LabVIEW\examples\Vision\2. Functions\Analysis\Histogram Example.vi