Mosaic

class lsst.afw.display.Mosaic(gutter=3, background=0, mode='square')

Bases: object

A class to handle mosaics of one or more identically-sized images (or Mask or MaskedImage)

Notes

Note that this mosaic is a patchwork of the input images; if you want to make a mosaic of a set images of the sky, you probably want to use the coadd code

Examples

m = Mosaic()
m.setGutter(5)
m.setBackground(10)
m.setMode("square")                     # the default; other options are "x" or "y"

mosaic = m.makeMosaic(im1, im2, im3)    # build the mosaic
display = afwDisplay.getDisplay()
display.mtv(mosaic)                         # display it
m.drawLabels(["Label 1", "Label 2", "Label 3"], display) # label the panels

# alternative way to build a mosaic
images = [im1, im2, im3]
labels = ["Label 1", "Label 2", "Label 3"]

mosaic = m.makeMosaic(images)
display.mtv(mosaic)
m.drawLabels(labels, display)

# Yet another way to build a mosaic (no need to build the images/labels lists)
for i in range(len(images)):
    m.append(images[i], labels[i])
# You may optionally include a colour, e.g. afwDisplay.YELLOW, as a third argument

mosaic = m.makeMosaic()
display.mtv(mosaic)
m.drawLabels(display=display)

Or simply:

mosaic = m.makeMosaic(display=display)

You can return the (ix, iy)th (or nth) bounding box (in pixels) with getBBox()

Attributes Summary

nImage Number of images

Methods Summary

append(image[, label, ctype]) Add an image to the list of images to be mosaiced
drawLabels([labels, display, frame]) Draw the list labels at the corners of each panel.
getBBox(ix[, iy]) Get the BBox for a panel
makeMosaic([images, display, mode, …]) Return a mosaic of all the images provided.
reset() Reset the list of images to be mosaiced
setBackground(background) Set the value in the gutters
setGutter(gutter) Set the number of pixels between panels in a mosaic
setMode(mode) Set mosaicing mode.

Attributes Documentation

nImage

Number of images

Methods Documentation

append(image, label=None, ctype=None)

Add an image to the list of images to be mosaiced

Returns:
index

the index of this image (may be passed to getBBox())

Notes

Set may be cleared with Mosaic.reset()

drawLabels(labels=None, display='deferToFrame', frame=None)

Draw the list labels at the corners of each panel.

Notes

If labels is None, use the ones specified by Mosaic.append()

getBBox(ix, iy=None)

Get the BBox for a panel

Parameters:
ix : int

If iy is not None, this is the x coordinate of the panel. If iy is None, this is the number of the panel.

iy : int, optional

The y coordinate of the panel.

makeMosaic(images=None, display='deferToFrame', mode=None, background=None, title='')

Return a mosaic of all the images provided.

If none are specified, use the list accumulated with Mosaic.append().

If display is specified, display the mosaic

reset()

Reset the list of images to be mosaiced

setBackground(background)

Set the value in the gutters

setGutter(gutter)

Set the number of pixels between panels in a mosaic

setMode(mode)

Set mosaicing mode.

Parameters:
mode : {“square”, “x”, “y”}

Valid options:

square

Make mosaic as square as possible

x

Make mosaic one image high

y

Make mosaic one image wide