Table Of Contents

Cast Image (G Dataflow)

Last Modified: October 24, 2017

Converts the current image type to a user-specified image type.

If you specify a lookup table, the Cast Image node converts the image using a lookup table. If converting from a 16-bit image to an 8-bit image, the node executes this conversion by shifting the 16-bit pixel values to the right by the specified number of shift operations and then truncating to get an 8-bit value.

Refer to Casting Images to learn how the node casts pixel values when the image src type and the image type.gtype parameter are not the same.

connector_pane_image
datatype_icon

image src

Reference to the source image.

datatype_icon

image dst

Reference to the destination image.

datatype_icon

image type

Image type into which the input image is converted.

The following values are valid:

Name Value Description
Grayscale (U8) 0

8 bits per pixel (unsigned, standard monochrome)

Grayscale (16) 1

16 bits per pixel (signed)

Grayscale (SGL) 2

32 bits per pixel (floating point)

Complex (CSG) 3

2 × 32 bits per pixel (floating point)

RGB (U32) 4

32 bits per pixel (red, green, blue, alpha)

HSL (U32) 5

32 bits per pixel (hue, saturation, luminance, alpha)

RGB (U64) 6

64 bits per pixel (red, green, blue, alpha)

Grayscale (U16) 7

16 bits per pixel (unsigned)

datatype_icon

lookup table

Array containing a maximum of 256 elements if image src is an 8-bit image or a maximum of 65,536 elements if image src is a 16-bit image.

The array contains values equal to the index if there are fewer than the amount determined by the image type in image src. You can use lookup table to calculate a node that gives a relation between a gray-level value and a user value. This input is valid only when converting from an 8-bit image to a 16-bit image, from a 16-bit image to an 8-bit image, or from an 8-bit or 16-bit image to a 32-bit floating-point image.

After converting image src into a floating-point type image, you can quantify the image or regions in the image using nodes capable of analyzing floating-point type images.

datatype_icon

error in

Error conditions that occur before this node runs.

The node responds to this input according to standard error behavior.

Standard Error Behavior

Many nodes provide an error in input and an error out output so that the node can respond to and communicate errors that occur while code is running. The value of error in specifies whether an error occurred before the node runs. Most nodes respond to values of error in in a standard, predictable way.

error in does not contain an error error in contains an error
If no error occurred before the node runs, the node begins execution normally.

If no error occurs while the node runs, it returns no error. If an error does occur while the node runs, it returns that error information as error out.

If an error occurred before the node runs, the node does not execute. Instead, it returns the error in value as error out.

Default: No error

datatype_icon

number of shifts

Number of right shifts by which each pixel value in the input image is shifted.

This is valid only when converting from a 16-bit image to an 8-bit image. The node executes this conversion by shifting the 16-bit pixel values to the right by the specified number of shift operations, up to a maximum of 8 shift operations, and then truncating to get an 8-bit value. Enter a value of -1 to ignore the bit depth and shift 0. Enter a value of 0 to use the bit depth to cast the image. Refer to the Get Set Image Bit Depth node for information about bit depth.

datatype_icon

image dst out

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.

datatype_icon

error out

Error information.

The node produces this output according to standard error behavior.

Standard Error Behavior

Many nodes provide an error in input and an error out output so that the node can respond to and communicate errors that occur while code is running. The value of error in specifies whether an error occurred before the node runs. Most nodes respond to values of error in in a standard, predictable way.

error in does not contain an error error in contains an error
If no error occurred before the node runs, the node begins execution normally.

If no error occurs while the node runs, it returns no error. If an error does occur while the node runs, it returns that error information as error out.

If an error occurred before the node runs, the node does not execute. Instead, it returns the error in value as error out.

Where This Node Can Run:

Desktop OS: Windows

FPGA: Not supported

Web Server: Not supported in VIs that run in a web application


Recently Viewed Topics