OpenDX - Documentation
Full Contents QuickStart Guide User's Guide User's Reference
Previous Page Next Page Table of Contents Partial Table of Contents Index Search

ReadImage

Category

Import and Export

Function

Reads an image from an image file.

Syntax


image = ReadImage(name, format, start, end, delta, width, height);

Inputs
Name Type Default Description
name string "image" file name
format string "rgb" or input dependent file format
start integer first frame first movie frame
end integer last frame last movie frame
delta integer 1 delta of images to be read
width integer input dependent width of image
height integer input dependent height of image
delayed flag environment dependent use delayed colors if present in file
colortype string environment dependent data type for colors

Outputs
Name Type Description
image image or image series resulting image

Functional Details

This module supports four basic file formats: RGB and TIFF (Tag Image File Format), GIF (Graphics Interchange Format), and MIFF.

name

is the name of the image file.

If name contains a series, the parameters start, end, and delta can be used to read a subset of the images (see parameter descriptions).

format

specifies the format of the image file. This parameter is not required if name includes a file extension defining the format (see following table). If name is specified without the appropriate extension, then the file format must be specified. If format is specified as "rgb," and name is "image," the module will first try to open image.rgb. If that fails, it will then try to open image.
File Type Format Specifier Expected File Extension(s) Multiframe/Series Data
RGB "rgb"
"r+g+b"
.rgb and .size
.r, .g, .b, .size,
Yes
TIFF "tiff" .tiff Yes
MIFF "miff" .miff Yes
many different "ImageMagick supported format" many different First frame only

start  and  end

specify the first and last frame to be read from an image file containing a series.

delta

specifies the increment in counting the frames in the range from start to end. For example, if the first and last frames are 10 and 20 respectively, and delta = 2, the output (image) is a series group with six members (indexed from 0 to 5). Frame numbers (10, 12,..., 20 in this example) are preserved as the series position number.

width  and  height

are used only for RGB format files. The module obtains information about the size and number of images from name.size, an ASCII file containing the string "w×h×f," (where w and h are pixel width and height of image respectively, and f is the number of frames).

If the .size file is not available, then width and height can be used to specify the size of the image(s).

delayed

specifies whether ReadImage should create a "delayed color" image if the image file is stored in an "image with colormap" format. By default, ReadImage will create a "delayed color" image if possible, unless the environment variable DXDELAYEDCOLORS is set to 0, or the delayed parameter is set to 0.

colortype

specifies whether the colors in the image should be byte or floating point. By default, ReadImage will create byte colors unless the DXPIXELTYPE environment variable is set to DXFloat, or colortype is set to "float".

Notes:

  1. RGB format files can be either "rgb" or "r+g+b." The file format "rgb" contains the image with the bytes for the red, green, and blue values interleaved. An alternate file format is "r+g+b," where three output files contain the non-interleaved image: "name.r," "name.g," and "name.b."

  2. TIFF format files must be either full color RGB images (TIFF Class R) or palette color RGB images (TIFF Class P), uncompressed ("Compression=1"), and interleaved ("PlanarConfiguration=1"). If the extension is not part of the name, the format must be set to "tiff." Information about the size of the image is obtained from the file itself, since TIFF files are self-describing. (For more information on file formats, see WriteImage.)

  3. With the ImageMagickTM libraries configured and compiled with DX, ReadImage can read and write a large number of image file formats. ImageMagick is a robust collection of tools and libraries to read, write, and manipulate an image in many image formats (over 68 major formats) including popular formats like TIFF, JPEG, PNG, PDF, PhotoCD, and GIF. The formats that can be read by ReadImage will depend on what functionality is compiled into ImageMagick. The ImageMagick option supports:

  4. If you do not specify the environment variable DXPIXELTYPE as "DXFloat", ReadImage will create byte colors internally. This will result in reduced storage required for the image, and will only affect networks that require the colors to be of type float, in which case the ReadImage parameter "colortype" should be set to "float", or the DXPIXELTYPE environment variable should be set to "DXFloat".

  5. ReadImage will also maintain the delayed color status of an image, as will be the case for GIF, some TIFF, and some MIFF format files. If the visualization program requires full colors for each pixel, set the ReadImage "delayed" parameter to false (0) or set the environment variable DXDELAYEDCOLORS to 0.

  6. If you want to convert an image file that does not already have delayed colors to one that does, use ReadImage to load it in and then use QuantizeImage to make it delayed color.

Components

Creates an output with "positions," "connections," and "colors" components.

Example Visual Programs

ReadImage.net
UsingFilter.net

See Also

 WriteImage


Full Contents QuickStart Guide User's Guide User's Reference

[ OpenDX Home at IBM | OpenDX.org ]