lsst.afw  13.0-39-g3deb52d
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
interface.py
Go to the documentation of this file.
1 from __future__ import absolute_import, division, print_function
2 from builtins import range
3 from builtins import object
4 #
5 # LSST Data Management System
6 # Copyright 2008, 2009, 2010, 2015 LSST Corporation.
7 #
8 # This product includes software developed by the
9 # LSST Project (http://www.lsst.org/).
10 #
11 # This program is free software: you can redistribute it and/or modify
12 # it under the terms of the GNU General Public License as published by
13 # the Free Software Foundation, either version 3 of the License, or
14 # (at your option) any later version.
15 #
16 # This program is distributed in the hope that it will be useful,
17 # but WITHOUT ANY WARRANTY; without even the implied warranty of
18 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 # GNU General Public License for more details.
20 #
21 # You should have received a copy of the LSST License Statement and
22 # the GNU General Public License along with this program. If not,
23 # see <http://www.lsstcorp.org/LegalNotices/>.
24 #
25 
26 ##
27 # \file
28 # \brief Support for talking to image displays from python
29 
30 import re
31 import sys
32 import importlib
33 import lsst.afw.geom as afwGeom
34 import lsst.afw.image as afwImage
35 import lsst.log
36 
37 logger = lsst.log.Log.getLogger("afw.display.interface")
38 
39 __all__ = (
40  "WHITE", "BLACK", "RED", "GREEN", "BLUE", "CYAN", "MAGENTA", "YELLOW", "ORANGE",
41  "Display", "Event", "noop_callback", "h_callback",
42  "setDefaultBackend", "getDefaultBackend",
43  "setDefaultFrame", "getDefaultFrame", "incrDefaultFrame",
44  "setDefaultMaskTransparency", "setDefaultMaskPlaneColor",
45  "getDisplay", "delAllDisplays",
46 )
47 
48 #
49 # Symbolic names for mask/line colours. N.b. ds9 supports any X11 colour for masks
50 #
51 WHITE = "white"
52 BLACK = "black"
53 RED = "red"
54 GREEN = "green"
55 BLUE = "blue"
56 CYAN = "cyan"
57 MAGENTA = "magenta"
58 YELLOW = "yellow"
59 ORANGE = "orange"
60 
61 
62 def _makeDisplayImpl(display, backend, *args, **kwargs):
63  """!Return the DisplayImpl for the named backend
64 
65  \param display Name of device. Should be importable, either absolutely or relative to lsst.display
66  \param backend The desired backend
67  \param args Arguments passed to DisplayImpl.__init__
68  \param kwargs Keywords arguments passed to DisplayImpl.__init__
69 
70  E.g.
71  import lsst.afw.display as afwDisplay
72  display = afwDisplay.Display(display=1, backend="ds9")
73  would call
74  _makeDisplayImpl(..., "ds9", 1)
75  and import the ds9 implementation of DisplayImpl from lsst.display.ds9
76  """
77  _disp = None
78  exc = None
79  for dt in ("lsst.display.%s" % backend, backend, ".%s" % backend, "lsst.afw.display.%s" % backend):
80  exc = None
81  # only specify the root package if we are not doing an absolute import
82  impargs = {}
83  if dt.startswith("."):
84  impargs["package"] = "lsst.display"
85  try:
86  _disp = importlib.import_module(dt, **impargs)
87  break
88  except (ImportError, SystemError) as e:
89  # SystemError can be raised in Python 3.5 if a relative import
90  # is attempted when the root package, lsst.display, does not exist.
91  # Copy the exception into outer scope
92  exc = e
93 
94  if not _disp or not hasattr(_disp.DisplayImpl, "_show"):
95  if exc is not None:
96  # re-raise the final exception
97  raise exc
98  else:
99  raise ImportError(
100  "Could not load the requested backend: {}".format(backend))
101 
102  if display:
103  _impl = _disp.DisplayImpl(display, *args, **kwargs)
104  if not hasattr(_impl, "frame"):
105  _impl.frame = display.frame
106 
107  return _impl
108  else:
109  return True
110 
111 
112 class Display(object):
113  _displays = {}
114  _defaultBackend = None
115  _defaultFrame = 0
116  _defaultMaskPlaneColor = dict(
117  BAD=RED,
118  CR=MAGENTA,
119  EDGE=YELLOW,
120  INTERPOLATED=GREEN,
121  SATURATED=GREEN,
122  DETECTED=BLUE,
123  DETECTED_NEGATIVE=CYAN,
124  SUSPECT=YELLOW,
125  NO_DATA=ORANGE,
126  # deprecated names
127  INTRP=GREEN,
128  SAT=GREEN,
129  )
130  _defaultMaskTransparency = {}
131 
132  def __init__(self, frame=None, backend=None, *args, **kwargs):
133  """!Create an object able to display images and overplot glyphs
134 
135  \param frame An identifier for the display
136  \param backend The backend to use (defaults to value set by setDefaultBackend())
137  \param args Arguments to pass to the backend
138  \param kwargs Arguments to pass to the backend
139  """
140  if frame is None:
141  frame = getDefaultFrame()
142 
143  if backend is None:
144  if Display._defaultBackend is None:
145  try:
146  setDefaultBackend("ds9")
147  except RuntimeError:
148  setDefaultBackend("virtualDevice")
149 
150  backend = Display._defaultBackend
151 
152  self.frame = frame
153  self._impl = _makeDisplayImpl(self, backend, *args, **kwargs)
154  self.name = backend
155 
156  self._xy0 = None # the data displayed on the frame's XY0
157  self.setMaskTransparency(Display._defaultMaskTransparency)
158  self._maskPlaneColors = {}
159  self.setMaskPlaneColor(Display._defaultMaskPlaneColor)
160 
161  self._callbacks = {}
162 
163  for ik in range(ord('a'), ord('z') + 1):
164  k = "%c" % ik
165  self.setCallback(k, noRaise=True)
166  self.setCallback(k.upper(), noRaise=True)
167 
168  for k in ('Return', 'Shift_L', 'Shift_R'):
169  self.setCallback(k)
170 
171  for k in ('q', 'Escape'):
172  self.setCallback(k, lambda k, x, y: True)
173 
174  def _h_callback(k, x, y):
175  h_callback(k, x, y)
176 
177  for k in sorted(self._callbacks.keys()):
178  doc = self._callbacks[k].__doc__
179  print(" %-6s %s" % (k, doc.split("\n")[0] if doc else "???"))
180 
181  self.setCallback('h', _h_callback)
182 
183  Display._displays[frame] = self
184 
185  def __enter__(self):
186  """!Support for python's with statement"""
187  return self
188 
189  def __exit__(self, *args):
190  """!Support for python's with statement"""
191  self.close()
192 
193  def __del__(self):
194  self.close()
195 
196  def __getattr__(self, name, *args, **kwargs):
197  """Try to call self._impl.name(*args, *kwargs)"""
198 
199  if not (hasattr(self, "_impl") and self._impl):
200  raise AttributeError("Device has no _impl attached")
201 
202  try:
203  return getattr(self._impl, name)
204  except AttributeError:
205  raise AttributeError(
206  "Device %s has no attribute \"%s\"" % (self.name, name))
207 
208  def close(self):
209  if hasattr(self, "_impl") and self._impl:
210  del self._impl
211  self._impl = None
212 
213  if self.frame in Display._displays:
214  del Display._displays[self.frame]
215 
216  @property
217  def verbose(self):
218  """!The backend's verbosity"""
219  return self._impl.verbose
220 
221  @verbose.setter
222  def verbose(self, value):
223  if self._impl:
224  self._impl.verbose = value
225 
226  def __str__(self):
227  return "Display[%s]" % (self.frame)
228 
229  #
230  # Handle Displays, including the default one (the frame to use when a user specifies None)
231  #
232  @staticmethod
233  def setDefaultBackend(backend):
234  try:
235  _makeDisplayImpl(None, backend)
236  except Exception as e:
237  raise RuntimeError(
238  "Unable to set backend to %s: \"%s\"" % (backend, e))
239 
240  Display._defaultBackend = backend
241 
242  @staticmethod
244  return Display._defaultBackend
245 
246  @staticmethod
247  def setDefaultFrame(frame=0):
248  """Set the default frame for display"""
249  Display._defaultFrame = frame
250 
251  @staticmethod
253  """Get the default frame for display"""
254  return Display._defaultFrame
255 
256  @staticmethod
258  """Increment the default frame for display"""
259  Display._defaultFrame += 1
260  return Display._defaultFrame
261 
262  @staticmethod
263  def setDefaultMaskTransparency(maskPlaneTransparency={}):
264  if hasattr(maskPlaneTransparency, "copy"):
265  maskPlaneTransparency = maskPlaneTransparency.copy()
266 
267  Display._defaultMaskTransparency = maskPlaneTransparency
268 
269  @staticmethod
270  def setDefaultMaskPlaneColor(name=None, color=None):
271  """!Set the default mapping from mask plane names to colours
272  \param name name of mask plane, or a dict mapping names to colours
273  \param color Desired color, or None if name is a dict
274 
275  If name is None, use the hard-coded default dictionary
276  """
277 
278  if name is None:
279  name = Display._defaultMaskPlaneColor
280 
281  if isinstance(name, dict):
282  assert color is None
283  for k, v in name.items():
285  return
286  #
287  # Set the individual colour values
288  #
289  Display._defaultMaskPlaneColor[name] = color
290 
291  @staticmethod
292  def getDisplay(frame=None, backend=None, create=True, verbose=False, *args, **kwargs):
293  """!Return the Display indexed by frame, creating it if needs be
294 
295  \param frame The desired frame (None => use defaultFrame (see setDefaultFrame))
296  \param backend create the specified frame using this backend (or the default if None) \
297  if it doesn't already exist. If backend == "", it's an error to specify a non-existent frame
298  \param create create the display if it doesn't already exist.
299  \param verbose Allow backend to be chatty
300  \param args arguments passed to Display constructor
301  \param kwargs keyword arguments passed to Display constructor
302  """
303 
304  if frame is None:
305  frame = Display._defaultFrame
306 
307  if frame not in Display._displays:
308  if backend == "":
309  raise RuntimeError("Frame %s does not exist" % frame)
310 
311  Display._displays[frame] = Display(
312  frame, backend, verbose=verbose, *args, **kwargs)
313 
314  Display._displays[frame].verbose = verbose
315  return Display._displays[frame]
316 
317  @staticmethod
319  """!Delete and close all known display
320  """
321  for disp in list(Display._displays.values()):
322  disp.close()
323  Display._displays = {}
324 
325  def maskColorGenerator(self, omitBW=True):
326  """!A generator for "standard" colours
327 
328  \param omitBW Don't include Black and White
329 
330  e.g.
331  colorGenerator = interface.maskColorGenerator(omitBW=True)
332  for p in planeList:
333  print p, next(colorGenerator)
334  """
335  _maskColors = [WHITE, BLACK, RED, GREEN,
336  BLUE, CYAN, MAGENTA, YELLOW, ORANGE]
337 
338  i = -1
339  while True:
340  i += 1
341  color = _maskColors[i%len(_maskColors)]
342  if omitBW and color in (BLACK, WHITE):
343  continue
344 
345  yield color
346 
347  def setMaskPlaneColor(self, name, color=None):
348  """!Request that mask plane name be displayed as color
349 
350  \param name Name of mask plane or a dictionary of name -> colourName
351  \param color The name of the colour to use (must be None if name is a dict)
352 
353  Colours may be specified as any X11-compliant string (e.g. <tt>"orchid"</tt>), or by one
354  of the following constants defined in \c afwDisplay: \c BLACK, \c WHITE, \c RED, \c BLUE,
355  \c GREEN, \c CYAN, \c MAGENTA, \c YELLOW.
356 
357  The advantage of using the symbolic names is that the python interpreter can detect typos.
358 
359  """
360 
361  if isinstance(name, dict):
362  assert color is None
363  for k, v in name.items():
364  self.setMaskPlaneColor(k, v)
365  return
366 
367  self._maskPlaneColors[name] = color
368 
369  def getMaskPlaneColor(self, name):
370  """!Return the colour associated with the specified mask plane name"""
371 
372  return self._maskPlaneColors.get(name)
373 
374  def setMaskTransparency(self, transparency=None, name=None):
375  """!Specify display's mask transparency (percent); or None to not set it when loading masks"""
376 
377  if isinstance(transparency, dict):
378  assert name is None
379  for k, v in transparency.items():
380  self.setMaskTransparency(k, v)
381  return
382 
383  if transparency is not None and (transparency < 0 or transparency > 100):
384  print(
385  "Mask transparency should be in the range [0, 100]; clipping", file=sys.stderr)
386  if transparency < 0:
387  transparency = 0
388  else:
389  transparency = 100
390 
391  if transparency is not None:
392  self._impl._setMaskTransparency(transparency, name)
393 
394  def getMaskTransparency(self, name=None):
395  """!Return the current display's mask transparency"""
396 
397  return self._impl._getMaskTransparency(name)
398 
399  def show(self):
400  """!Uniconify and Raise display. N.b. throws an exception if frame doesn't exit"""
401  return self._impl._show()
402 
403  def mtv(self, data, title="", wcs=None):
404  """!Display an Image or Mask on a DISPLAY display
405 
406  Historical note: the name "mtv" comes from Jim Gunn's forth imageprocessing
407  system, Mirella (named after Mirella Freni); The "m" stands for Mirella.
408  """
409  if hasattr(data, "getXY0"):
410  self._xy0 = data.getXY0()
411  else:
412  self._xy0 = None
413 
414  # it's an Exposure; display the MaskedImage with the WCS
415  if isinstance(data, afwImage.Exposure):
416  if wcs:
417  raise RuntimeError(
418  "You may not specify a wcs with an Exposure")
419  data, wcs = data.getMaskedImage(), data.getWcs()
420  elif isinstance(data, afwImage.DecoratedImage): # it's a DecoratedImage; display it
421  data, wcs = data.getImage(), afwImage.makeWcs(data.getMetadata())
422  self._xy0 = data.getXY0() # DecoratedImage doesn't have getXY0()
423 
424  if isinstance(data, afwImage.Image): # it's an Image; display it
425  self._impl._mtv(data, None, wcs, title)
426  # it's a Mask; display it, bitplane by bitplane
427  elif isinstance(data, afwImage.Mask):
428  #
429  # Some displays can't display a Mask without an image; so display an Image too,
430  # with pixel values set to the mask
431  #
432  self._impl._mtv(afwImage.ImageU(data.getArray()), data, wcs, title)
433  # it's a MaskedImage; display Image and overlay Mask
434  elif isinstance(data, afwImage.MaskedImage):
435  self._impl._mtv(data.getImage(), data.getMask(True), wcs, title)
436  else:
437  raise RuntimeError("Unsupported type %s" % repr(data))
438  #
439  # Graphics commands
440  #
441 
442  class _Buffering(object):
443  """A class intended to be used with python's with statement"""
444 
445  def __init__(self, _impl):
446  self._impl = _impl
447 
448  def __enter__(self):
449  self._impl._buffer(True)
450 
451  def __exit__(self, *args):
452  self._impl._buffer(False)
453  self._impl._flush()
454 
455  def Buffering(self):
456  """Return a class intended to be used with python's with statement
457  E.g.
458  with display.Buffering():
459  display.dot("+", xc, yc)
460  """
461  return self._Buffering(self._impl)
462 
463  def flush(self):
464  """!Flush the buffers"""
465  self._impl._flush()
466 
467  def erase(self):
468  """!Erase the specified DISPLAY frame
469  """
470  self._impl._erase()
471 
472  def dot(self, symb, c, r, size=2, ctype=None, origin=afwImage.PARENT, *args, **kwargs):
473  """!Draw a symbol onto the specified DISPLAY frame at (col,row) = (c,r)
474  [0-based coordinates]
475 
476  Possible values are:
477  + Draw a +
478  x Draw an x
479  * Draw a *
480  o Draw a circle
481  @:Mxx,Mxy,Myy Draw an ellipse with moments (Mxx, Mxy, Myy) (argument size is ignored)
482  An object derived from afwGeom.ellipses.BaseCore Draw the ellipse (argument size is ignored)
483  Any other value is interpreted as a string to be drawn. Strings obey the fontFamily (which may be
484  extended with other characteristics, e.g. "times bold italic". Text will be drawn rotated by
485  textAngle (textAngle is ignored otherwise).
486 
487  N.b. objects derived from BaseCore include Axes and Quadrupole.
488  """
489  if isinstance(symb, int):
490  symb = "%d" % (symb)
491 
492  if origin == afwImage.PARENT and self._xy0 is not None:
493  x0, y0 = self._xy0
494  r -= y0
495  c -= x0
496 
497  if isinstance(symb, afwGeom.ellipses.BaseCore) or re.search(r"^@:", symb):
498  try:
499  mat = re.search(r"^@:([^,]+),([^,]+),([^,]+)", symb)
500  except TypeError:
501  pass
502  else:
503  if mat:
504  mxx, mxy, myy = [float(_) for _ in mat.groups()]
505  symb = afwGeom.ellipses.Quadrupole(mxx, myy, mxy)
506 
507  symb = afwGeom.ellipses.Axes(symb)
508 
509  self._impl._dot(symb, c, r, size, ctype, **kwargs)
510 
511  def line(self, points, origin=afwImage.PARENT, symbs=False, ctype=None, size=0.5):
512  """!Draw a set of symbols or connect the points, a list of (col,row)
513  If symbs is True, draw points at the specified points using the desired symbol,
514  otherwise connect the dots. Ctype is the name of a colour (e.g. 'red')
515 
516  If symbs supports indexing (which includes a string -- caveat emptor) the
517  elements are used to label the points
518  """
519  if symbs:
520  try:
521  symbs[1]
522  except:
523  symbs = len(points)*list(symbs)
524 
525  for i, xy in enumerate(points):
526  self.dot(symbs[i], *xy, size=size, ctype=ctype)
527  else:
528  if len(points) > 0:
529  if origin == afwImage.PARENT and self._xy0 is not None:
530  x0, y0 = self._xy0
531  _points = list(points) # make a mutable copy
532  for i, p in enumerate(points):
533  _points[i] = (p[0] - x0, p[1] - y0)
534  points = _points
535 
536  self._impl._drawLines(points, ctype)
537  #
538  # Set gray scale
539  #
540 
541  def scale(self, algorithm, min, max=None, unit=None, *args, **kwargs):
542  """!Set the range of the scaling from DN in the image to the image display
543  \param algorithm Desired scaling (e.g. "linear" or "asinh")
544  \param min Minimum value, or "minmax" or "zscale"
545  \param max Maximum value (must be None for minmax|zscale)
546  \param unit Units for min and max (e.g. Percent, Absolute, Sigma; None if min==minmax|zscale)
547  \param *args Optional arguments
548  \param **kwargs Optional keyword arguments
549  """
550  if min in ("minmax", "zscale"):
551  assert max is None, "You may not specify \"%s\" and max" % min
552  assert unit is None, "You may not specify \"%s\" and unit" % min
553  elif max is None:
554  raise RuntimeError("Please specify max")
555 
556  self._impl._scale(algorithm, min, max, unit, *args, **kwargs)
557  #
558  # Zoom and Pan
559  #
560 
561  def zoom(self, zoomfac=None, colc=None, rowc=None, origin=afwImage.PARENT):
562  """!Zoom frame by specified amount, optionally panning also"""
563 
564  if (rowc and colc is None) or (colc and rowc is None):
565  raise RuntimeError(
566  "Please specify row and column center to pan about")
567 
568  if rowc is not None:
569  if origin == afwImage.PARENT and self._xy0 is not None:
570  x0, y0 = self._xy0
571  rowc -= x0
572  colc -= y0
573 
574  self._impl._pan(colc, rowc)
575 
576  if zoomfac is None and rowc is None:
577  zoomfac = 2
578 
579  if zoomfac is not None:
580  self._impl._zoom(zoomfac)
581 
582  def pan(self, colc=None, rowc=None, origin=afwImage.PARENT):
583  """!Pan to (rowc, colc); see also zoom"""
584 
585  self.zoom(None, colc, rowc, origin)
586 
587  def interact(self):
588  """!Enter an interactive loop, listening for key presses in display and firing callbacks.
589  Exit with q, \c CR, \c ESC, or any other callback function that returns a ``True`` value.
590  """
591  interactFinished = False
592 
593  while not interactFinished:
594  ev = self._impl._getEvent()
595  if not ev:
596  continue
597  k, x, y = ev.k, ev.x, ev.y # for now
598 
599  if k not in self._callbacks:
600  logger.warn("No callback registered for {0}".format(k))
601  else:
602  try:
603  interactFinished = self._callbacks[k](k, x, y)
604  except Exception as e:
605  logger.error(
606  "Display._callbacks[{0}]({0},{1},{2}) failed: {3}".format(k, x, y, e))
607 
608  def setCallback(self, k, func=None, noRaise=False):
609  """!Set the callback for key k to be func, returning the old callback
610  """
611 
612  if k in "f":
613  if noRaise:
614  return
615  raise RuntimeError(
616  "Key '%s' is already in use by display, so I can't add a callback for it" % k)
617 
618  ofunc = self._callbacks.get(k)
619  self._callbacks[k] = func if func else noop_callback
620 
621  self._impl._setCallback(k, self._callbacks[k])
622 
623  return ofunc
624 
625  def getActiveCallbackKeys(self, onlyActive=True):
626  """!Return all callback keys
627  \param onlyActive If true only return keys that do something
628  """
629 
630  return sorted([k for k, func in self._callbacks.items() if
631  not (onlyActive and func == noop_callback)])
632 
633 #
634 # Callbacks for display events
635 #
636 
637 
638 class Event(object):
639  """!A class to handle events such as key presses in image display windows"""
640 
641  def __init__(self, k, x=float('nan'), y=float('nan')):
642  self.k = k
643  self.x = x
644  self.y = y
645 
646  def __str__(self):
647  return "%s (%.2f, %.2f)" % (self.k, self.x, self.y)
648 #
649 # Default fallback function
650 #
651 
652 
653 def noop_callback(k, x, y):
654  """!Callback function: arguments key, x, y"""
655  return False
656 
657 
658 def h_callback(k, x, y):
659  print("Enter q or <ESC> to leave interactive mode, h for this help, or a letter to fire a callback")
660  return False
661 
662 #
663 # Handle Displays, including the default one (the frame to use when a user specifies None)
664 #
665 # If the default frame is None, image display is disabled
666 #
667 
668 
669 def setDefaultBackend(backend):
670  Display.setDefaultBackend(backend)
671 
672 
674  return Display.getDefaultBackend()
675 
676 
677 def setDefaultFrame(frame=0):
678  return Display.setDefaultFrame(frame)
679 
680 
682  """Get the default frame for display"""
683  return Display.getDefaultFrame()
684 
685 
687  """Increment the default frame for display"""
688  return Display.incrDefaultFrame()
689 
690 
691 def setDefaultMaskTransparency(maskPlaneTransparency={}):
692  return Display.setDefaultMaskTransparency(maskPlaneTransparency)
693 
694 
695 def setDefaultMaskPlaneColor(name=None, color=None):
696  """!Set the default mapping from mask plane names to colours
697  \param name name of mask plane, or a dict mapping names to colours
698  \param color Desired color, or None if name is a dict
699 
700  If name is None, use the hard-coded default dictionary
701  """
702 
703  return Display.setDefaultMaskPlaneColor(name, color)
704 
705 
706 def getDisplay(frame=None, backend=None, create=True, verbose=False, *args, **kwargs):
707  """!Return the Display indexed by frame, creating it if needs be
708 
709  See Display.getDisplay
710 
711  \param frame The desired frame (None => use defaultFrame (see setDefaultFrame))
712  \param backend create the specified frame using this backend (or the default if None) \
713  if it doesn't already exist. If backend == "", it's an error to specify a non-existent frame
714  \param create create the display if it doesn't already exist.
715  \param verbose Allow backend to be chatty
716  \param args arguments passed to Display constructor
717  \param kwargs keyword arguments passed to Display constructor
718  """
719 
720  return Display.getDisplay(frame, backend, create, verbose, *args, **kwargs)
721 
722 
724  """!Delete and close all known display
725  """
726  return Display.delAllDisplays()
def getMaskTransparency
Return the current display&#39;s mask transparency.
Definition: interface.py:394
def getDisplay
Return the Display indexed by frame, creating it if needs be.
Definition: interface.py:292
def setMaskTransparency
Specify display&#39;s mask transparency (percent); or None to not set it when loading masks...
Definition: interface.py:374
def interact
Enter an interactive loop, listening for key presses in display and firing callbacks.
Definition: interface.py:587
A class to contain the data, WCS, and other information needed to describe an image of the sky...
Definition: Exposure.h:76
def setMaskPlaneColor
Request that mask plane name be displayed as color.
Definition: interface.py:347
def zoom
Zoom frame by specified amount, optionally panning also.
Definition: interface.py:561
def delAllDisplays
Delete and close all known display.
Definition: interface.py:318
def mtv
Display an Image or Mask on a DISPLAY display.
Definition: interface.py:403
def __enter__
Support for python&#39;s with statement.
Definition: interface.py:185
def pan
Pan to (rowc, colc); see also zoom.
Definition: interface.py:582
def verbose
The backend&#39;s verbosity.
Definition: interface.py:217
def __init__
Create an object able to display images and overplot glyphs.
Definition: interface.py:132
def getMaskPlaneColor
Return the colour associated with the specified mask plane name.
Definition: interface.py:369
A class to handle events such as key presses in image display windows.
Definition: interface.py:638
Represent a 2-dimensional array of bitmask pixels.
Definition: Mask.h:83
def dot
Draw a symbol onto the specified DISPLAY frame at (col,row) = (c,r) [0-based coordinates].
Definition: interface.py:472
A class to manipulate images, masks, and variance as a single object.
Definition: MaskedImage.h:81
def scale
Set the range of the scaling from DN in the image to the image display.
Definition: interface.py:541
def delAllDisplays
Delete and close all known display.
Definition: interface.py:723
def show
Uniconify and Raise display.
Definition: interface.py:399
def line
Draw a set of symbols or connect the points, a list of (col,row) If symbs is True, draw points at the specified points using the desired symbol, otherwise connect the dots.
Definition: interface.py:511
def setCallback
Set the callback for key k to be func, returning the old callback.
Definition: interface.py:608
def erase
Erase the specified DISPLAY frame.
Definition: interface.py:467
def getDisplay
Return the Display indexed by frame, creating it if needs be.
Definition: interface.py:706
def flush
Flush the buffers.
Definition: interface.py:463
def __exit__
Support for python&#39;s with statement.
Definition: interface.py:189
std::shared_ptr< Wcs > makeWcs(std::shared_ptr< daf::base::PropertySet > const &_metadata, bool stripMetadata)
Definition: makeWcs.cc:37
def getActiveCallbackKeys
Return all callback keys.
Definition: interface.py:625
def noop_callback
Callback function: arguments key, x, y.
Definition: interface.py:653
def maskColorGenerator
A generator for &quot;standard&quot; colours.
Definition: interface.py:325
A class to represent a 2-dimensional array of pixels.
Definition: Image.h:486
def setDefaultMaskPlaneColor
Set the default mapping from mask plane names to colours.
Definition: interface.py:695
def setDefaultMaskPlaneColor
Set the default mapping from mask plane names to colours.
Definition: interface.py:270
A container for an Image and its associated metadata.
Definition: Image.h:760