ImgToMat

Overview

ImgToMat writes the sections of a Priism data stack as separate matrices in a MATLAB workspace file. This file can be read from MATLAB using the load command. The user interface uses the typical set of controls for selecting an input file, selecting a region from that file, and stopping or starting the conversion. Besides MAT file for specifying the name of the generated work file, the controls specific to ImgToMat are Scale to 255, MATLAB 4 format, MATLAB type, and Complex values.

Each variable, of the form A# in the created workspace references the data from one section in the input (the one exception is the option to split complex data into real and imaginary parts). The numbering of the variable names is the numbering of the sections as they would appear when interleaved as z, time, and wave (i.e. the contiguous z sections for the first time point and first wave have the lowest numbers (0, ...) followed by the z sections for the second time point and first wave and so on).

ImgToMat uses the MATLAB shared libraries and those will have to present on your computer for ImgToMat to be able to convert files. For Linux and Mac OS X, ImgToMat expects the MATLAB 6 libraries; for IRIX, ImgToMat expects the MATLAB 5 libraries (a patch is available that will allow it to work with the MATLAB 6 libraries). The easiest way to configure ImgToMat so that it finds the shared libraries is to rerun the post-installation script for Priism; that script will ask you the location of the directory that contains MATLAB.

Topics

Overview | Dialog | Scaling | MATLAB 4 | MATLAB type | Complex values | Command line

Related Priism Topics

Priism | MatToImg


Scaling

When Scale to 255 is selected, the data values in the output are linearly scaled to lie in the range of 0 to 255 inclusive. The range of input values in each wave mapped is specified by the first two scaling parameters for that wave if a window is used as input or the minimum and maximum for the wave recorded in the Priism header. Points outside the range are mapped to the endpoints.

Topics

Overview | Dialog | Scaling | MATLAB 4 | MATLAB type | Complex values | Command line


MATLAB 4

When MATLAB 4 format is selected, the workspace files generated are readable by MATLAB version 4; otherwise, the workspaces are for MATLAB 5 or 6.

Topics

Overview | Dialog | Scaling | MATLAB 4 | MATLAB type | Complex values | Command line


MATLAB Type

You can specify the encoding for values in the workspace file. By default, values will be encoded as 64-bit floating-point values. The other choices are 32-bit floating-point values, 8-bit signed integers, 16-bit signed integers, 32-bit signed integers, 8-bit unsigned integers, 16-bit unsigned integers, and 32-bit signed integers. The conversion will round to the nearest integer when converting floating-point types to integral ones. Values beyond the range of the destination type are changed to the closest value that the destination type can represent.

Topics

Overview | Dialog | Scaling | MATLAB 4 | MATLAB type | Complex values | Command line


Complex Values

When working with complex valued input data, you can select the "interleaved" option in the "Complex values" menu to write the sections as complex-valued matrices, or you can select the "planar" option in the "Complex values" menu to write a section of complex-valued data with one real-valued matrix for the real components and another real-valued matrix for the imaginary components. When written as complex numbers, the matrices in the output follow the naming convention described in the overview. When the components are split, I is used in place of the initial A in matrix names for the matrices holding the imaginary components.

Topics

Overview | Dialog | Scaling | MATLAB 4 | MATLAB type | Complex data output | Command line


Command Line

ImgToMat accepts the command-line arguments described in Region.html. In addition, ImgToMat has the following options:

-format=fmt
Sets the type used to store valeus in the MATLAB workspace file. fmt may be i8 (for signed 8-bit integer), i16 (for signed 16-bit integers), i32 (for signed 32-bit integers), u8 (for unsigned 8-bit integers), u16 (for unsigned 16-bit integers), u32 (for unsigned 32-bit integers), f32 (for 32-bit floating-point values), or f64 (for 64-bit floating-point values). By default, 64-bit floating-point values are used.
-matlab4
Causes the output to be a MATLAB workspace compatible with MATLAB 4. The default behavior is to generate workspaces compatible with MATLAB 5 or 6.
-noscale
Disables the scaling the input data values to a range of 0 to 255 (as described in the Scaling topic) before writing the values to the output file.
-out=filename
Sets the name of the output file to be filename.
-split
If the input data is complex-valued, causes ImgToMat to generate separate real matrices for the real and imaginary components. The default behavior is to store complex-valued data as complex-valued matrices.

As an example, the command-line below stores all the sections from a.dat as matrices in the MATLAB workspace file, a.mat. The data values are not scaled to the range of 0 to 255.

    ImgToMat a.dat -out=a.mat -noscale

Topics

Overview | Dialog | Scaling | MATLAB 4 | MATLAB type | Complex values | Command line