VrOne/Python Programming

ON-LINE REFERENCE DOCUMENTATION

CARDINAL SYSTEMS, LLC

386-439-2525    

www.cardinalsystems.net   
 

 

PyVrImgMgr Class Reference

VrOne/Python image management routines. More...

Members


Detailed Description

Allows management of images in VrOne. Images can be opened and closed. Information about currently open images can be queried. Settings for images can be changed, such as brightness, color maps, and location. 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 to see 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 that was used to open the image.

CloseAll ()

Closes all open images

GetIndexColorMap (ImgNum)

Get 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)

Is image index color based.

ImgNum

Image index number to check

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. if the image number is out of range, 0 is returned.

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 to retrieve size for. 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 to retrieve size for. 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)

Clamp values to image size at a give pixel increment

ImgNum

Image index number.

PixIncr

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

StartX

Start X of window to clamp

StartY

Start 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. If the image number is out of range, 0.0, 0.0 is returned.

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

 

y

Corner Y

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

 

y

Corner Y

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

Reads a window of image data based on window parameters sent.

ImgNum

Image index number.

StartX

Start pixel column.

StartY

Start pixel row.

SizeX

Number of columns to read.

SizeY

Number or rows to read.

PixIncr

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

returns

(ret, ImageMemory)

 

ret

0 = O -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 will be reversed, send as positive)

RotX

X rotation

RotY

Y rotation

UpLeftX

Upper left coordinate (ground)

UpLeftY

Upper left coordinate (ground)

WriteFile

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

returns

(ret)

 

ret

0 = OK -1 = Image index number out of range

GetWorld (ImgNum)

Get 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 coordinate (ground)

 

UpLeftY

Upper left coordinate (ground)

GetRotation (ImgNum)

Get 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 current brightness and contrast of image

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 (-1=All=default)

returns

(ret)

 

ret

0 = OK -1 = Image index number out of range

AddColorMap (ImgNum, ColorMap, Type)

Set 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

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)

Set 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)

Turn 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)

Set 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)

Set 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 Interpertation

 
0     = PHOTOMETRIC_MINISWHITE - min value is white
1     = PHOTOMETRIC_MINISBLACK - min 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 image was moved to

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 up in viewing order (displayed later)

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.