next up previous contents
Next: Configuring the ImageDisplayMap Object Up: The Viewer: Getting and Previous: The Viewer: Getting and

The ImageDisplayMap Class

The input to the Viewable class's displaySlice() method is, of course, a Slice object. This indicates the rectangular region within the dataset that the user is interested in viewing. More often than not, the area in data pixels of the requested region will be different from the area available for display. For instance, the user may request a 1024-squared region of data; however, the viewer's display size (as returned by getDisplaySize()) may only be 256-squared. As a result, when the data is displayed, the region may get sub-sampled to fit within the available space. To get a coordinate postion, we need to know a points location in the dataset, which is different from the location in the display.gif The position associated with mouse-move events is a display pixel; unfortunately, we need data voxel positions in order to get coordinate positions. Thus, another transformation is needed.

The ImageDisplayMapgif handles the conversion from display pixels to data voxels (and back when necessary). To configure this transformation, it requires two objects: the Slice being displayed and a Rectangle representing the region of the display area to which the image is being painted.

ImageDisplayMap also provides two more parameters as public boolean fields, xaxisReversed and yaxisReversed, that can effect the translation. Normally, it is assumed that data will displayed such that the dataset positions increase left to right and top to bottom, reflecting the order that data is arranged within the dataset. This is the convention used for common computer graphics images like GIF and JPEG; that is, the origin of the image appears in upper left-hand corner of the display. A value of true for the xaxisReversed indicates that the dataset positions increase right to left. The yaxisReversed applies in similar way to the vertical direction. With FITS images, it is common practice to order the data assuming that it will be displayed with data positions increasing right to left and bottom to top (i.e. the origin is in the lower left-hand corner). Thus, when displaying FITS images, these boolean fields should be set to xaxisReversed=false and yaxisReversed=true.

In summary, converting a position pointed to by the mouse involves two basic transformations: one going from display pixels to data voxels, and one going from data voxels to coordinate positions.


next up previous contents
Next: Configuring the ImageDisplayMap Object Up: The Viewer: Getting and Previous: The Viewer: Getting and

Ray Plante
Mon Aug 25 15:16:12 CDT 1997