Package stsci :: Package numdisplay :: Module overlay
[hide private]
[frames] | no frames]

Module overlay

source code

Functions [hide private]
 
_open_display(frame=1)
Open the device.
source code
 
close_display(frame=1)
Close the device.
source code
 
set(color=None, radius=None)
Specify the color or the radius.
source code
 
_transformPoint(x, y, tx, ty)
Convert image pixel coords to frame buffer coords (IIS convention).
source code
 
_checkColor(color=None)
Return a valid color.
source code
 
_update_save(fd, x, y, list_of_points, last_overlay, undo=True)
Save info in local lists list_of_points and last_overlay.
source code
 
point(**kwargs)
Draw a point.
source code
 
marker(**kwargs)
Draw a character.
source code
 
rectangle(**kwargs)
Draw a rectangle.
source code
 
circle(**kwargs)
Draw a circle.
source code
 
polyline(**kwargs)
Draw a series of connected line segments.
source code
 
undo()
Restore the values before the last overlay was written.
source code
Variables [hide private]
  C_BLACK = 202
  C_WHITE = 203
  C_RED = 204
  C_GREEN = 205
  C_BLUE = 206
  C_YELLOW = 207
  C_CYAN = 208
  C_MAGENTA = 209
  C_CORAL = 210
  C_MAROON = 211
  C_ORANGE = 212
  C_KHAKI = 213
  C_ORCHID = 214
  C_TURQUOISE = 215
  C_VIOLET = 216
  C_WHEAT = 217
  global_save = []
  global_byte_buf = array([0], dtype=uint8)
  global_color = array([208], dtype=uint8)
  global_radius = 3
  __package__ = 'stsci.numdisplay'

Imports: math, struct, N, numdisplay, ichar


Function Details [hide private]

set(color=None, radius=None)

source code 

Specify the color or the radius.

Parameters:
  • color (int) - color code to use for graphic overlays; the allowed values (202..217) are: C_BLACK, C_WHITE, C_RED, C_GREEN, C_BLUE, C_YELLOW, C_CYAN, C_MAGENTA, C_CORAL, C_MAROON, C_ORANGE, C_KHAKI, C_ORCHID, C_TURQUOISE, C_VIOLET, C_WHEAT
  • radius (int) - radius to use when drawing circles

_transformPoint(x, y, tx, ty)

source code 

Convert image pixel coords to frame buffer coords (IIS convention).

Parameters:
  • x (float) - image X coordinate of point
  • y (float) - image Y coordinate of point
  • tx (float) - X offset of frame buffer in image (positive if image is larger)
  • ty (float) - image coordinate corresponding to top line of frame buffer

_checkColor(color=None)

source code 

Return a valid color.

Parameters:
  • color (int) - color code to use; if color=None, use default

_update_save(fd, x, y, list_of_points, last_overlay, undo=True)

source code 

Save info in local lists list_of_points and last_overlay.

Parameters:
  • fd (file handle) - for reading from image display
  • x (int) - X coordinate (IIS convention, not image coordinates)
  • y (int) - Y coordinate (IIS convention, not image coordinates)
  • list_of_points (list of (x,y) tuples) - pixels that have been written to by the graphic overlay that called this function (updated by this function)
  • last_overlay (list of (x,y,value) tuples) - pixel coordinates and current value of display (updated by this function)

point(**kwargs)

source code 
Draw a point.

@param x: image X coordinate of point
@type x: int
@param y: image Y coordinate of point
@type y: int
@param center: (x,y) coordinates of point
@type center: tuple
@param color: color code to use; if not specified, use default
@type color: int
@param undo: if specified [default=True], keep track of overlays for undo()
@type undo: bool

syntax:
    overlay.point (x=x0, y=y0)
    overlay.point (center=(x0,y0))
    overlay.point (x=x0, y=y0, color=overlay.C_<color>)

marker(**kwargs)

source code 
Draw a character.

@param x: image X coordinate of point
@type x: int
@param y: image Y coordinate of point
@type y: int
@param mark: character to be drawn
@type mark: string
@param size: magnification to be used in drawing the character
@type size: int
@param color: color code to use; if not specified, use default
@type color: int
@param undo: if specified [default=True], keep track of overlays for undo()
@type undo: bool

syntax:
    overlay.marker (x=x0, y=y0, mark='+')
    overlay.marker (x=x0, y=y0, mark='+', size=2)
    overlay.marker (x=x0, y=y0, mark='+', color=overlay.C_<color>)

rectangle(**kwargs)

source code 
Draw a rectangle.

@param left: image X coordinate of left edge
@type left: int
@param right: image X coordinate of right edge
@type right: int
@param lower: image Y coordinate of lower edge
@type lower: int
@param upper: image Y coordinate of upper edge
@type upper: int
@param center: (x,y) coordinates of middle of rectangle
@type center: tuple
@param width: width of rectangle (X direction)
@type width: int
@param height: height of rectangle (Y direction)
@type height: int
@param color: color code to use; if not specified, use default
@type color: int
@param undo: if specified [default=True], keep track of overlays for undo()
@type undo: bool

syntax:
    overlay.rectangle (left=x1, right=x2, lower=y1, upper=y2)
    overlay.rectangle (center=(x0,y0), width=w, height=h)
    overlay.rectangle (left=x1, lower=y1, center=(x0,y0))
    overlay.rectangle (left=x1, lower=y1, width=w, height=h)
    overlay.rectangle (right=x2, upper=y2, width=w, height=h)
    overlay.rectangle (right=x2, upper=y2, center=(x0,y0))
    overlay.rectangle (left=x1, right=x2, lower=y1, upper=y2,
                       color=overlay.C_<color>)

circle(**kwargs)

source code 
Draw a circle.

@param x: image X coordinate of center
@type x: int
@param y: image Y coordinate of center
@type y: int
@param center: (x,y) coordinates of center
@type center: tuple
@param radius: radius of circle
@type radius: int
@param color: color code to use; if not specified, use default
@type color: int
@param undo: if specified [default=True], keep track of overlays for undo()
@type undo: bool

syntax:
    overlay.circle (x=x0, y=y0, radius=r)
    overlay.circle (center=(x0,y0), radius=r)
    overlay.circle (x=x0, y=y0, radius=r, color=overlay.C_<color>)

polyline(**kwargs)

source code 
Draw a series of connected line segments.

@param points: (x,y) points to connect with line segments
@type points: list of tuples
@param vertices: (x,y) points to connect with line segments
@type vertices: list of tuples
@param color: color code to use; if not specified, use default
@type color: int
@param undo: if specified [default=True], keep track of overlays for undo()
@type undo: bool

syntax:
    overlay.polyline (points=[(x1,y1), (x2,y2), (x3,y3)])
    overlay.polyline (vertices=[(x1,y1), (x2,y2), (x3,y3)])
    overlay.polyline (points=[(x1,y1), (x2,y2), (x3,y3)],
                      color=overlay.C_<color>)