Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS | NEXT CLASS FRAMES  | NO FRAMES
SUMMARY:  INNER | FIELD | CONSTR | METHOD DETAIL:  FIELD | CONSTR | METHOD

Class ncsa.horizon.util.ImageDisplayMap

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

public class ImageDisplayMap
extends java.lang.Object
implements java.lang.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.


Field Summary
Slice data
          the 2-d portion of data being displayed
java.awt.Rectangle display
          the 2-d region that the data is displayed to
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 (i.e. the right side of the right-most display pixel in the xaxis).
boolean yaxisReversed
          true if data pixel positions increase upwards and ypos should be taken to be relative to the right side of the display region (i.e. the bottom side of the bottom-most display pixel in the yaxis).
 
Constructor Summary
ImageDisplayMap(Slice dataSlice, java.awt.Rectangle displayRegion)
          create an ImageDisplayMap object assuming that the given slice will be displayed in a given Rectangle
ImageDisplayMap(Slice dataSlice, java.awt.Rectangle displayRegion, boolean xIsReversed, boolean yIsReversed)
          create an ImageDisplayMap object assuming that the given slice will be displayed in a given Rectangle
ImageDisplayMap(Slice dataSlice)
          create an ImageDisplayMap object assuming that the given slice will be displayed in a 1 x 1 pixel region.
ImageDisplayMap()
          create an ImageDisplayMap object assuming that a slice made up of the will first data voxel in a volume of data will be displayed in a 1 x 1 pixel region.
 
Method Summary
java.lang.Object clone()
           
Slice getDataSlice(java.awt.Rectangle displayRegion)
          return the Slice enclosed by a rectanglar region of the display
Voxel getDataVoxel(java.awt.Point displayPixel)
          return a data point location associated with a given display pixel given display pixel.
java.awt.Rectangle getDisplay()
          return a copy of the Rectangle being used as the current the display region
java.awt.Point getDisplayPixel(Voxel dataVoxel)
          return a Point that represents the display pixel that coves a given data location.
java.awt.Rectangle getDisplayRegion(Volume dataVol)
          return the Rectangle that encloses the intersection of a given slice with the data currently being displayed.
Slice getSlice()
          return a copy of the Slice being mapped to the display region
double getXDataPos(Voxel dataVoxel)
          return the position of a Voxel along the axis currently being displayed in horizontal direction.
double getYDataPos(Voxel dataVoxel)
          return the position of a Voxel along the axis currently being displayed in vertical direction.
void setDisplay(java.awt.Rectangle newDisplay)
          change the Slice being mapped to the current display region
void setSlice(Slice newSlice)
          change the Slice being mapped to the current display region
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notifyAll, notify, toString, wait, wait, wait
 

Field Detail

data

protected Slice data
the 2-d portion of data being displayed

display

protected java.awt.Rectangle display
the 2-d region that the data is displayed to

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 (i.e. the right side of the right-most display pixel in the xaxis).

yaxisReversed

public boolean yaxisReversed
true if data pixel positions increase upwards and ypos should be taken to be relative to the right side of the display region (i.e. the bottom side of the bottom-most display pixel in the yaxis).
Constructor Detail

ImageDisplayMap

public ImageDisplayMap(Slice dataSlice,
                       java.awt.Rectangle displayRegion)
create an ImageDisplayMap object assuming that the given slice will be displayed in a given Rectangle

ImageDisplayMap

public ImageDisplayMap(Slice dataSlice,
                       java.awt.Rectangle displayRegion,
                       boolean xIsReversed,
                       boolean yIsReversed)
create an ImageDisplayMap object assuming that the given slice will be displayed in a given Rectangle

ImageDisplayMap

public ImageDisplayMap(Slice dataSlice)
create an ImageDisplayMap object assuming that the given slice will be displayed in a 1 x 1 pixel region.

ImageDisplayMap

public ImageDisplayMap()
create an ImageDisplayMap object assuming that a slice made up of the will first data voxel in a volume of data will be displayed in a 1 x 1 pixel region.
Method Detail

getDataVoxel

public Voxel getDataVoxel(java.awt.Point displayPixel)
return a data point location associated with a given display pixel given display pixel.
Parameters:
displayPixel - a position in the display region

getXDataPos

public double getXDataPos(Voxel dataVoxel)
return the position of a Voxel along the axis currently being displayed in horizontal direction.
Throws:
java.lang.ArrayIndexOutOfBoundsException - if current x-axis is beyond the domain of the Voxel

getYDataPos

public double getYDataPos(Voxel dataVoxel)
return the position of a Voxel along the axis currently being displayed in vertical direction.
Throws:
java.lang.ArrayIndexOutOfBoundsException - if current y-axis is beyond the domain of the Voxel

getDisplayPixel

public java.awt.Point getDisplayPixel(Voxel dataVoxel)
return a Point that represents the display pixel that coves a given data location.

getDataSlice

public Slice getDataSlice(java.awt.Rectangle displayRegion)
return the Slice enclosed by a rectanglar region of the display

getDisplayRegion

public java.awt.Rectangle getDisplayRegion(Volume dataVol)
return the Rectangle that encloses the intersection of a given slice with the data currently being displayed.

setSlice

public void setSlice(Slice newSlice)
change the Slice being mapped to the current display region

getSlice

public Slice getSlice()
return a copy of the Slice being mapped to the display region

setDisplay

public void setDisplay(java.awt.Rectangle newDisplay)
change the Slice being mapped to the current display region

getDisplay

public java.awt.Rectangle getDisplay()
return a copy of the Rectangle being used as the current the display region

clone

public java.lang.Object clone()
Overrides:
clone in class java.lang.Object

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS | NEXT CLASS FRAMES  | NO FRAMES
SUMMARY:  INNER | FIELD | CONSTR | METHOD DETAIL:  FIELD | CONSTR | METHOD