    All Packages  Class Hierarchy  This Package  Previous  Next  Index

# Class ncsa.horizon.viewer.ADILViewer

    java.lang.Object
       |
       +----java.awt.Component
               |
               +----java.awt.Container
                       |
                       +----java.awt.Panel
                               |
                               +----ncsa.horizon.viewer.Viewer
                                       |
                                       +----ncsa.horizon.viewer.SelectionViewer
                                               |
                                               +----ncsa.horizon.viewer.ADILViewer

public class ADILViewer
extends SelectionViewer
implements Cloneable

A SelectionViewer developed for use with the NCSA Astronomy Digital Image Library (ADIL).

This viewer provides two display areas side-by-side. The left side displays a scaled version of the requested slice. The right side displays zoomed version of the image. Clicking positions in the left display will cause a new zoomed image to appear in the right display centered over the selected pixel. The user may control how much the right image is zoomed via buttons along the bottom of the viewer panel. The user may optionally choose "Region" zooming which allows a box to be drawn in the left display, representing the region to be shown in the right display. The coordinate positions corresponding to the pixel below the mouse are displayed as the mouse is moved about within either display. Users may display the image's text header by clicking on the header button.

The ADIL uses this viewer to browse representations of FITS files from the Library's collection. The only assumption made about the data being displayed is that data origin is relative to the lower left corner of the display with the y-axis increasing upward. (This may be relaxed in future versions.)

Although the default label on the header button is "FITS Header Text", its behavior is not FITS-specific. The text of button can be set during construction. How the text header is obtained is also publicly adjustable. This can be done synchronously by calling the setHeader() method. Alternatively, the viewer can be told to set the header text asynchronously only when the user requests it by clicking the header button; this might be preferred if setting the header is costly (e.g. it must be downloaded over the network.) To do this, one provides the viewer a Runnable object (via the setHeaderFetcher()) that calls setHeader().

Habanero Support

This viewer can be used as part of collaborative application within the Habanero environment. When run as part of Habanero, certain user actions are mirrored on each version of the application in the collaborative session. These sharable events include requests for zoomed images (i.e. when a user clicks on a point or selects a box in the left image) as well as requests for a change in the zoom factor (i.e. when a user clicks one of the zoom factor buttons or enters a custom zoom factor). Events that are not shared include requests to view the image header and coordinate tracking with the mouse. The viewer also supports late-joiners to the Habanero session. (See Habanero documentation (http://www.ncsa.uiuc.edu/SDG/Software/Habanero/Docs) for more details about Habanero.)

Events are shared by converting physical events (e.g. a button click) into logical events (e.g. change zoom factor). All logical events have the type ACTION_EVENT, and their logical type and arguments are encoded together as a String stored in the Event field arg. Several static methods, `isLogical(Event), decodeLogicalEvent(Event), encodeLogicalEvent(Event),` and `getLogicalEventArg(Event)`, are thus provided for encoding and decoding logical events.

##

CHANGE_ZOOM
  a logical event type requesting a change in the zoom factor
coord
cpixtrx
data
fetcher
hdrArea
hdrDisplayed
hdrWinButton
hdrWinButtonText
hdrWindow
header
lepid
magctl
magslice
magview
mainimg
mainview
mpixtrx
newViewable
posview
ppixtrx
selbox
selline
selpix
slice
sliceSize
ZOOM_BOX
  a logical event type requesting a zoomed view of a requested box
ZOOM_POINT
  a logical event type requesting a zoomed view centered on a specified pixel

##

ADILViewer()
  create a viewer with no Viewable to display
ADILViewer(AV_MainCanvas, AV_ImageCanvas, AV_PositionPanel, AV_MagnifierControl)
  construct a Viewer using specific subcomponents
ADILViewer(AV_MainCanvas, AV_ImageCanvas, AV_PositionPanel, AV_MagnifierControl, String)
  construct a Viewer using specific subcomponents
ADILViewer(String)
  create a viewer with no Viewable to display
ADILViewer(Viewable, Slice)
  create a viewer and display in it a slice from a viewable image

##

action(Event, Object)
addViewable(Viewable)
  replace the current Viewable object with a new one; the display will not be affected until displaySlice() is called.
clone()
  produce a copy of this viewer.
decodeLogicalEvent(Event)
  decode a Logical Event argument
displaySlice()
  display a default slice of the current Viewable
displaySlice(Slice)
  display a slice from the current Viewable data, or do nothing if the current Viewable is not set.
displayViewable()
  display a default slice of the current Viewable
encodeLogicalEvent(Event, int, int, String)
  encode a logical event into the arg field of the given Event
getBoxSelection()
  get the current selected display box.
getDisplaySize()
  return the size of the display area
getID()
  return the Viewer's logical event producer id
getLineSelection()
  get the current selected display Line.
getLogicalEventArg(Event)
  Return a String containing the actual argument of a Logical Event
getMagnification()
getPixelSelection()
  get the current selected display pixel.
getSliceSelection()
  return the current selected Slice, or null if there is no current Viewable;
getViewable()
  Return a reference to the current Viewable object, or null if none are attached to this Viewer.
getViewSlice()
  return a Slice object describing the data currently being viewed, or null if there is no Viewable currently being viewed.
getVoxelSelection()
  return the current selected Voxel, or null if there is no current Viewable.
handleLogicalEvent(Event)
imageUpdate(Image, int, int, int, int, int)
  This implementation simple issues a repaint() when an image has become available.
init()
  assemble the components of the Viewer Panel
isLogical(Event)
  return true if event is a logical event
marshallSelf(DataOutput)
  for use within an Habanero-ized application (similar to implementing the interface ncsa.habanero.Marshallable, a form of serialization)
minimumSize()
setBoxSelection(int, int, int, int)
  set the current selected display box.
setDrawBox(boolean)
setDrawLine(boolean)
setDrawPoint(boolean)
setHeader(String)
  set the string to be used as a header
setHeaderFetcher(Runnable)
  set the routine that will fetch the header text when needed.
setID(int)
  set the Viewer's logical event producer id
setLineSelection(int, int, int, int)
  set the current selected display line.
setMagnification(float)
setPixelSelection(int, int)
  set the current selected display pixel.
setSliceSelection(Volume)
  set the current selected Slice to the given Volume as projected onto the currently displayed Slice, or do nothing if there is no current Viewable.
setVoxelSelection(Voxel)
  set the current selected Voxel to the one given as projected onto the currently displayed Slice, or do nothing if there is no current Viewable.
showHeader()
  pop up a Frame with a box containing header text
unmarshallSelf(DataInput)
  for use within an Habanero-ized application (similar to implementing the interface ncsa.habanero.Marshallable, a form of serialization)
updateMagview()
  update the display of the image that appears in the magnifier canvas
updatePosview(AV_ImageCanvas, int, int)
  update the display of positions in the position panel

##

magview

      protected AV_ImageCanvas magview

posview

      protected AV_PositionPanel posview

mainview

      protected AV_MainCanvas mainview

magctl

      protected AV_MagnifierControl magctl

selpix

      protected Point selpix

selbox

      protected Rectangle selbox

selline

      protected Rectangle selline

data

      protected Viewable data

slice

      protected Slice slice

magslice

      protected Slice magslice

ppixtrx

      protected ImageDisplayMap ppixtrx

mpixtrx

      protected ImageDisplayMap mpixtrx

cpixtrx

      protected ImageDisplayMap cpixtrx

coord

      protected CoordinateSystem coord

mainimg

      protected Image mainimg

newViewable

      protected boolean newViewable

sliceSize

      protected Dimension sliceSize

lepid

      protected int lepid

hdrWinButtonText

      protected String hdrWinButtonText

hdrWinButton

      protected Button hdrWinButton

header

      protected String header

hdrWindow

      protected SimpleFrame hdrWindow

hdrArea

      protected TextArea hdrArea

hdrDisplayed

      protected boolean hdrDisplayed

fetcher

      protected Runnable fetcher

CHANGE_ZOOM

      public final static int CHANGE_ZOOM

  a logical event type requesting a change in the zoom factor

ZOOM_POINT

      public final static int ZOOM_POINT

  a logical event type requesting a zoomed view centered on a specified pixel

ZOOM_BOX

      public final static int ZOOM_BOX

  a logical event type requesting a zoomed view of a requested box

##

ADILViewer

      public ADILViewer()

  create a viewer with no Viewable to display

ADILViewer

      public ADILViewer(String hdrButtonText)

  create a viewer with no Viewable to display
  Parameters:
    hdrButtonText - text to use on header display request button

ADILViewer

      public ADILViewer(AV_MainCanvas mainc,
                        AV_ImageCanvas magc,
                        AV_PositionPanel posp,
                        AV_MagnifierControl magp,
                        String hdrButtonText)

  construct a Viewer using specific subcomponents

ADILViewer

      public ADILViewer(AV_MainCanvas mainc,
                        AV_ImageCanvas magc,
                        AV_PositionPanel posp,
                        AV_MagnifierControl magp)

  construct a Viewer using specific subcomponents

ADILViewer

      public ADILViewer(Viewable data,
                        Slice slice)

  create a viewer and display in it a slice from a viewable image

##

init

      protected void init()

  assemble the components of the Viewer Panel

getID

      public int getID()

  return the Viewer's logical event producer id

setID

      public void setID(int id)

  set the Viewer's logical event producer id

isLogical

      public static boolean isLogical(Event ev)

  return true if event is a logical event

decodeLogicalEvent

      public static Event decodeLogicalEvent(Event ev)

  decode a Logical Event argument

getLogicalEventArg

      public static String getLogicalEventArg(Event ev)

  Return a String containing the actual argument of a Logical Event

encodeLogicalEvent

      public static void encodeLogicalEvent(Event ev,
                                            int id,
                                            int epid,
                                            String arg)

  encode a logical event into the arg field of the given Event
  Parameters:
    ev - Event to edit
    id - Logical Event id
    epid - Logical Event producer's id
    argument - String-encoded argument for logical event

addViewable

      public synchronized void addViewable(Viewable data)

  replace the current Viewable object with a new one; the display will not be affected until displaySlice() is called.
  Overrides:
    addViewable in class Viewer

getViewable

      public synchronized Viewable getViewable()

  Return a reference to the current Viewable object, or null if none are attached to this Viewer.
  Overrides:
    getViewable in class Viewer

displaySlice

      public synchronized void displaySlice(Slice sl)

  display a slice from the current Viewable data, or do nothing if the current Viewable is not set.
  Overrides:
    displaySlice in class Viewer

displaySlice

      public void displaySlice()

  display a default slice of the current Viewable
  Overrides:
    displaySlice in class Viewer

displayViewable

      public void displayViewable()

  display a default slice of the current Viewable

getDisplaySize

      public Dimension getDisplaySize()

  return the size of the display area
  Overrides:
    getDisplaySize in class Viewer

setPixelSelection

      public void setPixelSelection(int x,
                                    int y)

  set the current selected display pixel. The location is measured in real display (i.e. screen) pixels relative to the upper left hand corner.
  Overrides:
    setPixelSelection in class SelectionViewer

setBoxSelection

      public void setBoxSelection(int x1,
                                  int y1,
                                  int x2,
                                  int y2)

  set the current selected display box. The locations are measured in real display (i.e. screen) pixels relative to the upper left hand corner.
  Parameters:
    x1,y1 - the location of one vertex of the selected box
    x2,y2 - the location of the vertex of the selected box opposite to the one given by x1,y1
  Overrides:
    setBoxSelection in class SelectionViewer

setLineSelection

      public void setLineSelection(int x1,
                                   int y1,
                                   int x2,
                                   int y2)

  set the current selected display line. The locations are measured in real display (i.e. screen) pixels relative to the upper left hand corner.
  Parameters:
    x1,y1 - the location of the start of the line
    x2,y2 - the location of the end of the line
  Overrides:
    setLineSelection in class SelectionViewer

getPixelSelection

      public Point getPixelSelection()

  get the current selected display pixel.
  Overrides:
    getPixelSelection in class SelectionViewer

getBoxSelection

      public Rectangle getBoxSelection()

  get the current selected display box.
  Overrides:
    getBoxSelection in class SelectionViewer

getLineSelection

      public Rectangle getLineSelection()

  get the current selected display Line.
  Overrides:
    getLineSelection in class SelectionViewer

getVoxelSelection

      public Voxel getVoxelSelection()

  return the current selected Voxel, or null if there is no current Viewable.
  Overrides:
    getVoxelSelection in class SelectionViewer

setVoxelSelection

      public synchronized void setVoxelSelection(Voxel vox)

  set the current selected Voxel to the one given as projected onto the currently displayed Slice, or do nothing if there is no current Viewable.
  Overrides:
    setVoxelSelection in class SelectionViewer

getSliceSelection

      public Slice getSliceSelection()

  return the current selected Slice, or null if there is no current Viewable;
  Overrides:
    getSliceSelection in class SelectionViewer

getViewSlice

      public Slice getViewSlice()

  return a Slice object describing the data currently being viewed, or null if there is no Viewable currently being viewed.
  Overrides:
    getViewSlice in class Viewer

setSliceSelection

      public synchronized void setSliceSelection(Volume vol)

  set the current selected Slice to the given Volume as projected onto the currently displayed Slice, or do nothing if there is no current Viewable.
  Overrides:
    setSliceSelection in class SelectionViewer

imageUpdate

      public boolean imageUpdate(Image img,
                                 int flags,
                                 int x,
                                 int y,
                                 int w,
                                 int h)

  This implementation simple issues a repaint() when an image has become available.
  Overrides:
    imageUpdate in class Component

updatePosview

      public void updatePosview(AV_ImageCanvas ic,
                                int x,
                                int y)

  update the display of positions in the position panel

updateMagview

      public void updateMagview()

  update the display of the image that appears in the magnifier canvas

setDrawBox

      public void setDrawBox(boolean b)

setDrawLine

      public void setDrawLine(boolean b)

setDrawPoint

      public void setDrawPoint(boolean b)

setHeaderFetcher

      public void setHeaderFetcher(Runnable routine)

  set the routine that will fetch the header text when needed. The Runnable must call this ADILViewer's setHeader();

setHeader

      public void setHeader(String hdr)

  set the string to be used as a header

showHeader

      public void showHeader()

  pop up a Frame with a box containing header text

action

      public boolean action(Event ev,
                            Object what)

Overrides:
  action in class Component

handleLogicalEvent

      public boolean handleLogicalEvent(Event ev)

minimumSize

      public Dimension minimumSize()

Overrides:
  minimumSize in class Container

getMagnification

      public float getMagnification()

setMagnification

      public void setMagnification(float mag)

clone

      public Object clone()

  produce a copy of this viewer.
  Overrides:
    clone in class Viewer

marshallSelf

      public void marshallSelf(DataOutput out) throws IOException

  for use within an Habanero-ized application (similar to implementing the interface ncsa.habanero.Marshallable, a form of serialization)

unmarshallSelf

      public void unmarshallSelf(DataInput in) throws IOException

  for use within an Habanero-ized application (similar to implementing the interface ncsa.habanero.Marshallable, a form of serialization)

    All Packages  Class Hierarchy  This Package  Previous  Next  Index