v4.vx images Tutorial

This tutorital demonstrates how v4 images and their metedata are maintained in python. The following topics are presentaed.

1. Creating small implicit images

2. Displaying small grey level images

3. Dipslaying small color images

4. Image embedding

The vx.Vx class is used for image mamagement. The class member Vx.i contains the image data in a numpy array; the other elements maintain the image meta data.

A VX class may be created with the contents of vx image file by:

        <python-image> = vx.Vx(<image-file-name>)

A VX class can also be copied or cloned from an existing class:

        <python-image2> = vx.Vx(<python-image>)

1. Implicit Image Creation

A vx image may also be implicitly created by:

        <python-image> = vx.Vx(<pixel-type>, <bounding-box>, <#-channels>)
Where:

        <bounding-box> is a 2D or 3D specification (tuple or list) of the image size and 
        <#-channels> is the number of elements in each pixel; i.e., for a color image 
        <#-channels> = 3

2. Displaying small grey level images

See vd.dispmvx for more details; the third example below shows the outcome for fixed scaling. Since in this case the highest pixel value is just 20 on some displays nothing will be seen.

The pixel-type may be set to one of: uint8, int8, int16, int32, float32, or float64. The 2D bounding box has the format (xlo, xhi, ylo, yhi). xlo and xhi may be given v4 offset values; however, numpy arrays always have a lowest index value of 0. Therefore, the range of x-index values will be 0 to (xhi - xlo - 1).

3. Creating and displaying Color images

A color image with the same dimensions as x may be created by specifying three channels. For traditional v4 commands the channels are interpreted as 0 = Red, 1 = Green, and 2 = blue.

3. Creating 3D images

3D imges are specified implicitly by providing a 3D bounding box specification: [xlo, xhi, ylo, yhi, zlo, zhi]

As with 2D images for 3D images, you can specify color or mutispecrtal pixels by setting the channel parameter

4. Image embedding

There is a Vx class utility called emedim that is similar to the C progrmming language emebed funtion that facilitates padding the border of images witht zeros when convenient. Unlike the C version the indexing cannot be matched to be the same as for the initial array as all numpy arrays start at (0,0). It tis the responsbility of teh programmer to make appropriate offset indexing when necessary. Gor numpy arrays the pad() function may also be used.