Class ncsa.horizon.util.ImageDataOrigin
All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class ncsa.horizon.util.ImageDataOrigin

java.lang.Object
   |
   +----ncsa.horizon.util.ImageDataOrigin

public class ImageDataOrigin
extends Object
implements Cloneable
an object that provides a way to express the convention used for how the display pixels in an image map to corresponding data pixels.

This object can be used by a Viewer to keep track of how data pixels are begin mapped to display pixels. This can be non-trivial when users have requested a subregion of the data to display. Another tricky effect is data order. For instance, computer graphics images (like GIF and JPEG) order the data such that the first pixel should appear in the top left corner; however, some scientific data (such as FITS) orders the data using the mathematical convention where the first pixel should appear in the lower left corner. Both these effects can be kept track of with this object.

There are three basic characteristics tracked by this object via public fields:

With each of the member fields properly set, one converts between display pixels and data pixels via the methods getDataPixel() and getDisplayPixel().


Variable Index

 o height
the height of the display region; only used if yaxisReversed=true.
 o width
the width of the display region; only used if xaxisReversed=true.
 o xaxisReversed
true if data pixel positions increase to the left and xpos should be taken to be relative to the right side of the display region.
 o xpos
the horizontal position of the data origin relative to the left side of a display region (if xaxisReversed = false).
 o xsize
the number data pixels covered by one display pixels along the horizontal directions.
 o yaxisReversed
true if data pixel positions increase upwards and ypos should be taken to be relative to the bottom of the display region.
 o ypos
the vertical position of the data origin relative to the top of the display region (if yaxisReversed = false).
 o ysize
the number data pixels covered by one display pixels along the vertical directions.

Constructor Index

 o ImageDataOrigin()
create an ImageDataOrigin object with default values.
 o ImageDataOrigin(double, double, int, int)
create an ImageDataOrigin object with xaxisReversed = yaxisReversed = false and xsize = ysize = 1
 o ImageDataOrigin(double, double, int, int, double, double)
create an ImageDataOrigin object with xaxisReversed = yaxisReversed = false
 o ImageDataOrigin(double, double, int, int, double, double, boolean, boolean)
create a fully specified ImageDataOrigin object

Method Index

 o clone()
 o getDataPixel(Point)
return a data point location associated with a given display pixel given display pixel.
 o getDisplayPixel(double, double)
return a Point object that the display pixel covering a given data pixel location.

Variables

 o xpos
  public double xpos
the horizontal position of the data origin relative to the left side of a display region (if xaxisReversed = false). A positive value means the data origin is to the right of the left side. If xaxisReversed = true, then xpos is relative to the right side of the display region and a positive value places the origin to the left of that side.
 o ypos
  public double ypos
the vertical position of the data origin relative to the top of the display region (if yaxisReversed = false). A positive value means the data origin is below the top edge. If yaxisReversed = true, then ypos is relative to the bottom edge of the display region and a positive value places the origin above that edge.
 o width
  public int width
the width of the display region; only used if xaxisReversed=true.
 o height
  public int height
the height of the display region; only used if yaxisReversed=true.
 o xsize
  public double xsize
the number data pixels covered by one display pixels along the horizontal directions. This value should almost always be set to a positive number; if the data and display pixels increase in opposite directions along the xaxis, one should set xaxisReversed=true.
 o ysize
  public double ysize
the number data pixels covered by one display pixels along the vertical directions. This value should almost always be set to a positive number; if the data and display pixels increase in opposite directions along the yaxis, one should set yaxisReversed=true.
 o xaxisReversed
  public boolean xaxisReversed
true if data pixel positions increase to the left and xpos should be taken to be relative to the right side of the display region. That is, the zero position will the right side of the right-most display pixel in the xaxis. See also xpos.
 o yaxisReversed
  public boolean yaxisReversed
true if data pixel positions increase upwards and ypos should be taken to be relative to the bottom of the display region. That is, the zero position will the bottom side of the bottom-most display pixel in the yaxis. See also ypos.

Constructors

 o ImageDataOrigin
  public ImageDataOrigin(double xpos,
                         double ypos,
                         int width,
                         int height,
                         double xsize,
                         double ysize,
                         boolean xrev,
                         boolean yrev)
create a fully specified ImageDataOrigin object
 o ImageDataOrigin
  public ImageDataOrigin(double xpos,
                         double ypos,
                         int width,
                         int height,
                         double xsize,
                         double ysize)
create an ImageDataOrigin object with xaxisReversed = yaxisReversed = false
 o ImageDataOrigin
  public ImageDataOrigin(double xpos,
                         double ypos,
                         int width,
                         int height)
create an ImageDataOrigin object with xaxisReversed = yaxisReversed = false and xsize = ysize = 1
 o ImageDataOrigin
  public ImageDataOrigin()
create an ImageDataOrigin object with default values. These values correspond to the convention used by computer graphics images (e.g. GIF, JPEG, etc.) where the origin is at the upper left hand corner of the display region with pixels increasing downward and to the right.

Methods

 o getDataPixel
  public double[] getDataPixel(Point displayPixel)
return a data point location associated with a given display pixel given display pixel.
Returns:
s double[] a two element array containing the x and y location
 o getDisplayPixel
  public Point getDisplayPixel(double xp,
                               double yp)
return a Point object that the display pixel covering a given data pixel location.
 o clone
  public Object clone()
Overrides:
clone in class Object

All Packages  Class Hierarchy  This Package  Previous  Next  Index