Vr Mapping

ON-LINE REFERENCE DOCUMENTATION

CARDINAL SYSTEMS, LLC

www.cardinalsystems.net

Image Manager Class Reference (PyVrImgMgr)

VrOne/Python image management routines More...

Members

Open (FileName, MakePyra, ReadWorld)
IsOpen (FileName)
CloseByIdx (ImgNum)
CloseByName (FileName)
CloseAll ()
GetIndexColorMap (ImgNum)
GetColor (ImgNum, Idx)
IsIndexed (ImgNum)
GetImgCount ()
GetImgDepth (ImgNum)
GetImgSizeInt (ImgNum, PixIncr)
GetImgSizeFloat (ImgNum, PixIncr)
Clamp (ImgNum, PixIncr, StartX, StartY, Wdt, Hgt)
GetImgPixelSize (ImgNum)
GetImgFileName (ImgNum)
GetImgNum (FileName)
GetImgOffset (ImgNum)
GroundToImage (ImgNum, gx, gy)
ImageToGround (ImgNum, ix, iy)
GetImgCorner (ImgNum, Corner)
GetImgCenter (ImgNum)
GetImgWin (ImgNum, StartX, StartY, SizeX, SizeY, PixIncr)
SetWorld (ImgNum, ScaleX, ScaleY, RotX, RotY, UpLeftX, UpLeftY, FileName, WriteFile, Centered)
GetWorld (ImgNum, ReadFile)
GetRotation (ImgNum)
ShiftWorld (ImgNum, ShiftX, ShiftY, WriteFile)
GetBrightContrast (ImgNum)
SetBrightContrast (ImgNum, Bright, Contrast)
AddColorMap (ImgNum, ColorMap, Type)
RemoveColorMap (ImgNum, Type)
SetColorMap (ImgNum, ColorMap)
ColorMapOff (ImgNum)
ColorMapOn (ImgNum)
ClearColorMap (ImgNum)
IsColorMapOn (ImgNum)
IsColorMapSet (ImgNum)
SetViewFlags (ImgNum)
GetViewFlags (ImgNum)
SetViewFlag (ImgNum, Win, Viewable)
GetViewFlag (ImgNum, Win)
GetPhotoInterp (ImgNum)
GetType (ImgNum)
MoveImg (ImgNum, MoveTo)
MoveImgTop (ImgNum)
MoveImgBottom (ImgNum)
MoveImgUp (ImgNum)
MoveImgDown (ImgNum)
ImgSetDisplayOffsetMode (ImgNum, Mode)

Description

Allows management of images in VrOne. Images can be opened and closed. Information about currently open images can be queried. Settings for images, such as brightness, color maps, and location, can be changed. Provides methods for converting between ground and image coordinates and for reading image data.

 


Member Function Documentation

Open (FileName, MakePyra, ReadWorld)

Allocates an image object and opens an image.

FileName

Image file name.

MakePyra

Make image pyramids? 0=No, 1=Yes(default)

ReadWorld

Read world file? 0=No, 1=Yes(default)

returns

(ret)

 

ret

Image sequence number (0-MaxImgs-1)

-1 Could not open file.

IsOpen (FileName)

Checks if an image is open.

FileName

Image name to check.

returns

(ret)

 

ret

0=Image not open.

1=Image is open.

CloseByIdx (ImgNum)

Closes an image using index number.

ImgNum

Image to close.

CloseByName (FileName)

Closes an image using image name.

FileName

File name used to open the image.

CloseAll ()

Closes all open images.

GetIndexColorMap (ImgNum)

Gets index color map for a simgle image This is the internal colormap for index-based images.

ImgNum

Image index number.

returns

(ret)

 

ret

List of 255 RGB color values.

GetColor (ImgNum, Idx)

Gets RGB color for a single index value.

ImgNum

Image index number.

Idx

Color index (0-255)

returns

(Red, Green, Blue)

 

Red

0-255.

 

Green

0-255.

 

Blue

0-255.

IsIndexed (ImgNum)

Returns whether an image index is color-based.

ImgNum

Image index number to check.

returns

0=No

1= Yes

GetImgCount ()

Returns the number of images currently open.

returns

(ret)

 

ret

Number of images currently open.

GetImgDepth (ImgNum)

Returns the image bit depth for the image specified.

ImgNum

Image index number. Returns 0 if the image number is out of range.

returns

(ret)

 

ret

Image bit depth (8, 16, 24).

GetImgSizeInt (ImgNum, PixIncr=1)

Returns the image width and height for the image specified.

ImgNum

Image index number.

PixIncr

Pixel increment for which to retrieve size. 1,2,4,8,16,32,64.

returns

(ret, Width, Height)

 

ret

0 = OK

-1 = Image index number out of range

 

Width

Image width.

 

Height

Image height

GetImgSizeFloat (ImgNum, PixIncr=1)

Returns the image width and height for the image specified.

ImgNum

Image index number.

PixIncr

Pixel increment for which to retrieve size. 1,2,4,8,16,32,64

returns

(ret, Width, Height)

 

ret

0 = OK

-1 = Image index number out of range

 

Width

 

 

Height

 

Clamp (ImgNum, PixIncr, StartX, StartY, Wdt, Hgt)

Clamps values to image size at a given pixel increment.

ImgNum

Image index number.

PixIncr

Pixel increment. 1,2,4,8,16,32,64.

StartX

Minimum X of window to clamp.

StartY

Minimum Y of window to clamp.

Wdt

Width of window to clamp.

Hgt

Height of window to clamp.

returns

(ret, StartX, StartY, Wdt, Hgt)

 

ret

0=Invalid image index number.

1=Clamped.

 

StartX

New start X.

 

StartY

New start Y.

 

Wdt

New width of window.

 

Hgt

New height of window.

GetImgPixelSize (ImgNum)

Returns the image pixel size.

ImgNum

Image index number.

returns

(ret)

 

ret

Return pixel size. (ground)

GetImgFileName (ImgNum)

Returns the image filename of the image specified.

ImgNum

Image index number.

returns

(ret, FileName)

 

ret

0 = OK.

-1 = Image index number out of range.

 

FileName

Image file name.

GetImgNum (FileName)

Returns image index number based on file name.

FileName

Image file name.

returns

(ret, ImgNum)

 

ret

0 = OK.

-1 = Filename not found.

 

ImgNum

Return image index number.

GetImgOffset (ImgNum)

Returns the current image offset (if origin has been changed).

ImgNum

Image index number. Returns 0.0, 0.0 if the image number is out of range.

returns

(OfsX, OfsY)

 

OfsX

Offset X (ground).

 

OfsY

Offset Y (ground).

GroundToImage (ImgNum, gx, gy)

Converts ground coordinate to image coordinate.

ImgNum

Image index number.

gx

Input ground coordinate X.

gy

Input ground coordinate Y.

returns

(ix, iy)

 

ix

Output image coordinate X.

 

iy

Output image coordinate Y.

ImageToGround (ImgNum, ix, iy)

Converts ground coordinate to image coordinate.

ImgNum

Image index number.

ix

Input image coordinate X.

iy

Input image coordinate Y.

returns

(gx, gy)

 

gx

Output ground coordinate X.

 

gy

Output ground coordinate Y.

GetImgCorner (ImgNum, Corner)

ImgNum

Image index number.

Corner

Corner to get: 1 = Lower left.

                     2 = Lower right.

                     3 = Upper right.

                     4 = Upper left.

returns

(ret, x, y)

 

x

Corner X coordinate

 

y

Corner Y coordinate

GetImgCenter (ImgNum, x, y)

Returns the image center coordinate in ground units.

ImgNum

Image index number.

returns

(ret, x, y)

 

ret

0 = OK.

-1 = Image index number out of range.

 

x

Corner X coordinate.

 

y

Corner Y coordinate.

GetImgWin (ImgNum, StartX, StartY, SizeX, SizeY, PixIncr)

Reads a window of image data.

ImgNum

Image index number.

StartX

Minimum X (column) of window.

StartY

Minimum Y (row) of window.

SizeX

Width (columns) of window.

SizeY

Height (rows) of window.

PixIncr

Pixel increment used for downsampling (2 = read every other pixel)

returns

(ret, ImageMemory)

 

ret

0 = OK.

-1 = Image index number out of range

 

ImageMemory

List of pixel rows and values. List is in [rows][cols] format. Each item in rows is 1 or 3 item list of pixel values.

SetWorld (ImgNum, ScaleX, ScaleY, RotX, RotY, UpLeftX, UpLeftY, WriteFile)

Sets the world file transformation parameters and, optionally, writes the file.

ImgNum

Image index number.

ScaleX

X direction pixel size (ground).

ScaleY

Y direction pixel size (ground, sign is reversed and sent as positive).

RotX

X rotation.

RotY

Y rotation.

UpLeftX

Upper left X coordinate (ground).

UpLeftY

Upper left Y coordinate (ground).

FileName

File name to write (File name or 0=No file name)

WriteFile

0=Don't write file 1=Write file.

Centered

Is coordinate of the upper left pixel centered? (0=No 1=Yes) (Vr Mapping is No)

returns

(ret)

 

ret

0 = OK.

-1 = Image index number out of range

GetWorld (ImgNum)

Gets the current world file transformation parameters.

ImgNum

Image index number.

returns

(ret, ScaleX, ScaleY, RotX, RotY, UpLeftX, UpLeftY)

 

ret

0 = OK.

-1 = ImgNum invalid

 

ScaleX

X direction pixel size (ground).

 

ScaleY

Y direction pixel size (ground).

 

RotX

X rotation.

 

RotY

Y rotation.

 

UpLeftX

Upper left X coordinate (ground).

 

UpLeftY

Upper left Y coordinate (ground).

GetRotation (ImgNum)

Gets the current world file rotation.

ImgNum

Image index number.

returns

(ret)

 

ret

World file rotation

ShiftWorld (ImgNum, ShiftX, ShiftY, WriteFile)

Shifts the world file transformation parameters and, optionally, writes file.

ImgNum

Image index number.

ShiftX

X direction shift value (ground).

ShiftY

Y direction shift value (ground).

WriteFile

0=Don't write file.

1=Write file.

returns

(ret)

 

ret

0 = OK.

-1 = Image index number out of range.

GetBrightContrast (ImgNum)

Gets current brightness and contrast of image.

ImgNum

Image index number to get.

returns

(ret, Bright, Contrast)

 

ret

0 = OK .

-1 = Image index number out of range.

 

Bright

Brightness index 0-100 (50=None).

 

Contrast

Contrast index 0-100 (50=None).

SetBrightContrast (ImgNum, Bright, Contrast)

Sets image brightness and contrast.

Bright

Brightness index 0-100 (50=None, -1= No Change)

Contrast

Contrast index 0-100 (50=None, -1= No Change)

ImgNum

Image index number to adjust (defaults to -1= All)

returns

(ret)

 

ret

0 = OK

-1 = Image index number out of range

AddColorMap (ImgNum, ColorMap, Type)

Sets color map to apply whenever pixels are read from the image.

ImgNum

Image index number this applies to or -1 for all images.

ColorMap

3x256 list of values for colormap.

Type

Color map type. User-defined value. Should start at 1000 or greater to avoid conflict with Vr types. For each type added, there can only be one colormap. If a colormap with the same type already exists, it will be replaced.

RemoveColorMap (ImgNum, Type)

Add color map to be applied whenever pixels are read from the image.

ImgNum

Image index number this applies to or -1 for all images.

Type

Color map type.

SetColorMap (ImgNum, ColorMap)

Sets default color map to be applied whenever pixels are read from the image.

ImgNum

Image index number this applies to or -1 for all images.

ColorMap

3x256 list of values for colormap.

 

 

ColorMapOff (ImgNum)

Turn color mapping off for an image. If a color map was set it will still remain with the image, it will just not be active.

ImgNum

Image index number this applies to or -1 for all images.

ColorMapOn (ImgNum)

Turns color mapping on for an image. This is useful if ImgColorMapOff has been called and you want to make the color map active again.

ImgNum

Image index number this applies to or -1 for all images.

ClearColorMap (ImgNum)

Clears the color map data that has been previously set and turns color mapping off for image.

ImgNum

Image index number this applies to or -1 for all images

IsColorMapOn (ImgNum)

Returns status of color mapping.

ImgNum

Image index number this applies to or -1 for all images.

returns

(ret)

 

ret

TRUE = Color mapping is active.

FALSE = Color mapping is not active (although it may be set).

IsColorMapSet (ImgNum)

Returns whether color map has been set or not.

ImgNum

Image index number this applies to or -1 for all image.

returns

(ret)

 

ret

TRUE = Color map has been set (but not necessarily active).

FALSE = Color map has not been set.

SetViewFlags (ImgNum)

Sets view flag for one window.

ImgNum

Image to set view flag.

returns

(ViewFlags)

 

ViewFlags

List of flags, one for each window. Each entry is 0 or 1 indicating if image is viewable or not in a particular window.

GetViewFlags (ImgNum)

Gets images view flags for all windows.

ImgNum

Image index number.

returns

(ret)

 

ret

List of flags, one for each window. Each entry is 0 or 1 indicating if image is viewable or not in a particular window.

SetViewFlag (ImgNum, Win, Viewable)

Sets view flag for one window.

ImgNum

Image index number.

Win

Window number 0 to MAX_WINS

Viewable

0=Image not viewable.

1=Image viewable.

GetViewFlag (ImgNum, Win)

Gets the opacity for an image.

ImgNum

Image index number.

Win

Window number 0 to MAX_WINS.

returns

(ret)

 

ret

0=Image not viewable.

1=Image viewable.

GetPhotoInterp (ImgNum)

Gets the photometric interpretation for the image.

ImgNum

Image index number.

returns

(ret)

 

ret

Photometric Interpretation:

     0     = PHOTOMETRIC_MINISWHITE - Minimum value is white.

     1     = PHOTOMETRIC_MINISBLACK - Minimum value is black.

     2     = PHOTOMETRIC_RGB                  - RGB color model.

     3     = PHOTOMETRIC_PALETTE          - color map indexed

     5     = PHOTOMETRIC_SEPARATED    - color separations

     6     = PHOTOMETRIC_YCBCR             - CCIR 601

     8     = PHOTOMETRIC_CIELAB             - 1976 CIE L*a*b*

     9     = PHOTOMETRIC_ICCLAB            - ICC L*a*b* [Adobe TIFF Technote 4]

     10    = PHOTOMETRIC_ITULAB            - ITU L*a*b*

     32844 = PHOTOMETRIC_LOGL             -  CIE Log2(L)

     32845 = PHOTOMETRIC_LOGLUV       - CIE Log2(L) (u',v')

 

 

 

GetType (ImgNum)

Gets the image type.

ImgNum

Image index number.

returns

(ret)

 

ret

Image Type:

     0 = Unknown.

     1 = Tiff Scanline.

     2 = Tiff Strip.

     3 = Tiff Tiled.

     4 = Jpeg.

     5 = Mr Sid.

     6 = Jpeg 2000.

     7 = Ecw.

MoveImg (ImgNum, MoveTo)

Moves image to specific place in display order.

ImgNum

Image index number.

MoveTo

0...ImgCount-1

returns

(ret)

 

ret

Location to which image moved.

MoveImgTop (ImgNum)

Moves image to top of viewing order (displayed last).

ImgNum

Image index number.

MoveImgBottom (ImgNum)

Moves image to bottom of viewing order (displayed first).

ImgNum

Image index number.

MoveImgUp (ImgNum)

Moves image up in viewing order (displayed later).

ImgNum

Image index number.

MoveImgDown (ImgNum)

Moves image down in viewing order (displayed earlier).

ImgNum

Image index number.

SetDisplayOffsetMode (ImgNum, Mode)

Sets image display mode.

ImgNum

Image index number.

Mode

0= Display at original location.

1= Display at offset location.