ima - Image handling

 

Name

ima — Image handling

Syntax

ima map | mtp | rea | sto | sav | sel | rem | gsn | val | rgb | cvi | cvd | ins | sla | slc | pgr | der2 | qua | lst | ext | mag | view | del | grid | combine | alpha value |

Description

The ima command can read and store image files; display the image and manipulate images. A three component image has RGB values for each node. Some image options are only valid for one component grids.

Arguments

map [z zval] [noint]

Map the image. 
z zval - Map the image at zval position. 
noint - Map the image with no interpolation.

mtp

Map the image to Postscript. Will reproduce the bitmap for Postscript only.

rea file

Read image of various format from disk file. The command ima map will display the image.

sto tiff | bmp | ppm | png | jpg | jpeg | vtk | psc file

Store the image into a disk file in tiff or bitmap (bmp) or ppm or jpeg or vtk or postscript format.

sav

Convert screen image to image dataset. Save it to disk or into the project.

gsn ik jk il jl

Select nodes in rows (ik il) and columns (jk jl) given by the index number. Lowest index is 0.

sel ir ic

Select every point number ir and ic in each x and y direction.

rem pixel_number

Removes any island that has less than pixel_number pixels.

val

Convert an image to a grid after a value formula.

rgb [rng r1 r2] [map]

Convert a grid to an rgb image. 
rng r1 r2 - Convert and using range r1 r2. 
map - Convert a grid and use a map color table.

cvi new_image_type_number

Convert to another image type new_image_type_number 1-10. 5=unsigned short, 10=float, see below.

cvd new_data_type_number

Convert image and grids to another data type new_data_type_number 1-10.

Number code for image formats

0 = VTK_VOID
1 = VTK_BIT
2 = VTK_CHAR
3 = VTK_UNSIGNED_CHAR
4 = VTK_SHORT
5 = VTK_UNSIGNED_SHORT
6 = VTK_INT
7 = VTK_UNSIGNED_INT
8 = VTK_LONG
9 = VTK_UNSIGNED_LONG
10 = VTK_FLOAT
11 = VTK_DOUBLE

ins layer_number worspace_cubename

Insert an image into an image cube in workspace worspace_cubename at layer layer_number.

sla layer_number | top | bot | mid

Select an image layer from an image cube at layer layer_number or specify the top, bottom or middle layer of the cube.

slc x y | cur

Select column at x,y values or at cursor position.

pgr x | y | z | xy

Calculate point gradient of a grid in selected direction.

der2

Second derivative for a grid based on double tangent calculation.

qua

Quantize rgb to index. The filter takes a 3 component RGB image as input and produces a one component index image as output, along with a lookup table that contains the color definitions for the index values.

lst

List image data.

ext 0 | 1 | 2

Extract image component to make a grid.

mag

Image magnitude calculation.

view

Display the bitmap in a separate image window. Usefull for large images.

del

Delete image window mapped by ima view.

grid

Will transfer an image with one component per grid node into a grid, also called structured points.

combine image1 image2 image3

An image is generated by combing RGB from three images. R from first, G from second and B from third.

alpha value r g b [delta number]

Set transparency to images. r, g and b are integers range 1-255, representing intensity of red, green and blue of the color(s) that are to be transparent. E.g. ima alpha value 255 255 255 will set 100% white to be transparent. The delta number argument is for setting transparency to fit a  range of rgb colors at a distance (D) away from the given rgb values. If number is set to 10, then

D = sqrt[102 + 102 + 102] = sqrt[300] = 17.32.

This is then compared to a difference, d, calculated in each pixel, calculated this way:

d = sqr [(r-r')2 + (g-g')2 + (b-b')2] where (r-r') etc. the pixel value (r') and the given value (r). So if d is less than 17.32, transparency will be applied.

E.g. ima alpha value 255 255 255 delta 10 will set transperancy to a point that has pix-values somewhat lower than 255 255 255, e.g. 245 255 255, but not more than that formula adds up to 17.32.

 

 

 

 

 

 

 

Examples

Ex.1: Image to grid

z                 ;# Erase screen
win demo          ;# Get demo window (450000 460000 6450000 6460000 1000 4000)
spe bgc whi       ;# Specify background color to white
mak ran 11        ;# Make 11 random points
grp 222 222       ;# Make grid of dimension 222 x 222
map               ;# Map the grid
ima sav           ;# Save image 
ima qua           ;# Quantize the image
ssc               ;# Scale data
d2                ;# Set screen in 2D mode
map               ;# Map the grid

The above example produces this image.


Image to grid example

See also

map - Map display , psc bmp , tma - Texture mapping