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().
-
height
- the height of the display region; only used if yaxisReversed=true.
-
width
- the width of the display region; only used if xaxisReversed=true.
-
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.
-
xpos
-
the horizontal position of the data origin relative to the
left side of a display region (if xaxisReversed = false).
-
xsize
-
the number data pixels covered by one display pixels along the
horizontal directions.
-
yaxisReversed
-
true if data pixel positions increase upwards and ypos should be
taken to be relative to the bottom of the display region.
-
ypos
-
the vertical position of the data origin relative to the top
of the display region (if yaxisReversed = false).
-
ysize
-
the number data pixels covered by one display pixels along the
vertical directions.
-
ImageDataOrigin()
- create an ImageDataOrigin object with default values.
-
ImageDataOrigin(double, double, int, int)
- create an ImageDataOrigin object with
xaxisReversed = yaxisReversed = false and xsize = ysize = 1
-
ImageDataOrigin(double, double, int, int, double, double)
- create an ImageDataOrigin object with
xaxisReversed = yaxisReversed = false
-
ImageDataOrigin(double, double, int, int, double, double, boolean, boolean)
- create a fully specified ImageDataOrigin object
-
clone()
-
-
getDataPixel(Point)
- return a data point location associated with a given display pixel
given display pixel.
-
getDisplayPixel(double, double)
- return a Point object that the display pixel covering a given data
pixel location.
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.
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.
width
public int width
- the width of the display region; only used if xaxisReversed=true.
height
public int height
- the height of the display region; only used if yaxisReversed=true.
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.
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.
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.
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.
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
ImageDataOrigin
public ImageDataOrigin(double xpos,
double ypos,
int width,
int height,
double xsize,
double ysize)
- create an ImageDataOrigin object with
xaxisReversed = yaxisReversed = false
ImageDataOrigin
public ImageDataOrigin(double xpos,
double ypos,
int width,
int height)
- create an ImageDataOrigin object with
xaxisReversed = yaxisReversed = false and xsize = ysize = 1
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.
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
getDisplayPixel
public Point getDisplayPixel(double xp,
double yp)
- return a Point object that the display pixel covering a given data
pixel location.
clone
public Object clone()
- Overrides:
- clone in class Object
All Packages Class Hierarchy This Package Previous Next Index