LatticeAsRaster.h

Classes

LatticeAsRaster -- Class to manage the drawing of raster images of slices from AIPS++ Lattices (full description)

template <class T> class LatticeAsRaster : public LatticePADisplayData<T>

Interface

Public Members
LatticeAsRaster(Array<T> *array, const uInt xAxis, const uInt yAxis, const uInt mAxis, const IPosition fixedPos)
LatticeAsRaster(Array<T> *array, const uInt xAxis, const uInt yAxis)
LatticeAsRaster(ImageInterface<T> *image, const uInt xAxis, const uInt yAxis, const uInt mAxis, const T fixedPos)
LatticeAsRaster(ImageInterface<T> *image, const uInt xAxis, const uInt yAxis)
virtual ~LatticeAsRaster()
virtual void setupElements()
virtual void setDefaultOptions()
virtual Bool setOptions(Record &rec, Record &recOut)
virtual Record getOptions()
virtual Display::DisplayDataType classType()
virtual String className()

Description

Review Status

Date Reviewed:
yyyy/mm/dd

Prerequisite

Etymology

The purpose of this class is to draw "raster" images of data that is "lattice"-based.

Synopsis

This class should be used to display raster images--- ie. filled, pseudo-color pixel images where each screen (or device) pixel is shaded with a color from a look-up table that is assigned to be proportional in some way to the intensity of the data pixel---of two-dimensional slices of data extracted from AIPS++ Lattices or Arrays having two or more dimensions. Thus, this is the class to use to display standard channel maps of position-velocity cubes, or Digitized Sky Survey images, for example.

At construction, any axes in the data can be mapped to the X and Y axes of the display device (see the PrincipalAxesDD class). For data with more than two dimensions, a third axis in the dataset can be selected for generating a sequence of images along: this is known as the "movie" axis. Animation (see the Animator class) will cause different slices of the data to be selected from along this axis. After construction, the axis settings of a LatticeAsRaster object can be modified at a later stage.

The LatticeAsRaster object supports a number of options which can be set or retrieved using the setOptions and getOptions functions. These functions simply accept a Record, which can be converted from a GlishRecord: this is done in the GTkDisplayData class. The options for the LatticeAsRaster class are:

  • range: a Vector of two elements, being the minimum and maximum data values to map to the minimum and maximum color values.
  • power: a Float which specifies the deviation from linear of the scaling of the data onto the colormap. Increasingly negative values give increasingly severe logarithmic scaling: this scaling effectively allocates more color cells to the lowest data values (usually corresponding to the thermal noise and low surface brightness emission) in the image. Increasing positive power values give increasingly severe exponential scaling, thereby allocating more and more color cells to the highest data values (ie. signal and interference)in the image.
  • resample: a String which is either "nearest" for nearest neighbour pixel resampling, or "bilinear" for bilinear interpolation between adjacent groups of four pixels.
  • complexmode: this is a String, and is only relevant for LatticeAsRaster or LatticeAsRaster instantantiations. One of "phase", "real", "imaginary" or "magnitude" is appropriate for this option, and indicates how complex data values should be translated to real pixel values.

    LatticeAsRaster is templated, and can be used to draw Complex or Real Images or Arrays. For Complex data, the default complexmode is "magnitude." LatticeAsRaster objects can be registered on any WorldCanvasHolder, but will only draw on WorldCanvases having an attribute value of Display::Index for "colormodel."

    Example

    A LatticeAsRaster object could be constructed and used as follows:
        PagedImage<Float> *pimage = new PagedImage<Float>(String("test.im"));
        DisplayData *dd;
        uInt ndim = pimage->ndim();
        if (ndim < 2) {
          throw(AipsError(String("Image has less than two dimensions")));
        } else if (ndim == 2) {
          dd = (DisplayData *)(new LatticeAsRaster<Float>(pimage, 0, 1));
        } else {
          IPosition fixedPos(ndim);
          fixedPos = 0;
          dd = (DisplayData *)(new LatticeAsRaster<Float>(pimage, 0, 1, 2,
                                                          fixedPos));
        }
        // wcHolder is an existing WorldCanvasHolder *...
        wcHolder->addDisplayData(ddata);
        wcHolder->refresh();
        

    Motivation

    Displaying 2-dimensional slices of a lattice-based data volume is a standard display requirement for astronomical data visualization and presentation.

    Template Type Argument Requirements (T)

    Thrown Exceptions

    To Do

    Member Description

    LatticeAsRaster(Array<T> *array, const uInt xAxis, const uInt yAxis, const uInt mAxis, const IPosition fixedPos)
    LatticeAsRaster(Array<T> *array, const uInt xAxis, const uInt yAxis)

    Array-based constructors: >2d and 2d. xAxis and yAxis specify which axis in the array (0-based) should be mapped to X and Y on the display device: ie. 2-d slices of the data to be displayed have these axes. mAxis specifies the "movie" axis, which is the axis along which different slices are taken. fixedPos is an IPosition having the same length as the number of dimensions in the array, and indicate the fixed axis values for axes in the data that are not specified as xAxis, yAxis or mAxis.

    LatticeAsRaster(ImageInterface<T> *image, const uInt xAxis, const uInt yAxis, const uInt mAxis, const T fixedPos)
    LatticeAsRaster(ImageInterface<T> *image, const uInt xAxis, const uInt yAxis)

    Image-based constructors: >2d and 2d. xAxis and yAxis specify which axis in the image (0-based) should be mapped to X and Y on the display device: ie. 2-d slices of the data to be displayed have these axes. mAxis specifies the "movie" axis, which is the axis along which different slices are taken. fixedPos is an IPosition having the same length as the number of dimensions in the image, and indicate the fixed axis values for axes in the data that are not specified as xAxis, yAxis or mAxis.

    virtual ~LatticeAsRaster()

    Destructor

    virtual void setupElements()

    Create the various elements in the sequence of displayable images. This is called upon construction as well as whenever the display and/or movie axes are changed via a call to PrincipalAxesDD::setAxes. virtual void setupElements(IPosition fixedPos = IPosition(uInt(2)));

    virtual void setDefaultOptions()

    Install the default options for display.

    virtual Bool setOptions(Record &rec, Record &recOut)

    Apply the options stored in the provided Record to the LatticeAsRaster object. If the return value is True, then some options have changed, and a refresh is needed to update the display.

    virtual Record getOptions()

    Retrieve the currently set options, and their types, default values, and any help text associated with each parameter. This information can be used to generate form-type graphical user interfaces or command-line interfaces to set the options with prompts.

    virtual Display::DisplayDataType classType()

    Return the DisplayData type; used by the WorldCanvasHolder to determine the order of drawing.

    virtual String className()

    class name