Class ncsa.horizon.viewer.ADILViewer
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.


Variable Index

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

Constructor Index

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

Method Index

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

Variables

 o magview
  protected AV_ImageCanvas magview
 o posview
  protected AV_PositionPanel posview
 o mainview
  protected AV_MainCanvas mainview
 o magctl
  protected AV_MagnifierControl magctl
 o selpix
  protected Point selpix
 o selbox
  protected Rectangle selbox
 o selline
  protected Rectangle selline
 o data
  protected Viewable data
 o slice
  protected Slice slice
 o magslice
  protected Slice magslice
 o ppixtrx
  protected ImageDisplayMap ppixtrx
 o mpixtrx
  protected ImageDisplayMap mpixtrx
 o cpixtrx
  protected ImageDisplayMap cpixtrx
 o coord
  protected CoordinateSystem coord
 o mainimg
  protected Image mainimg
 o newViewable
  protected boolean newViewable
 o sliceSize
  protected Dimension sliceSize
 o lepid
  protected int lepid
 o hdrWinButtonText
  protected String hdrWinButtonText
 o hdrWinButton
  protected Button hdrWinButton
 o header
  protected String header
 o hdrWindow
  protected SimpleFrame hdrWindow
 o hdrArea
  protected TextArea hdrArea
 o hdrDisplayed
  protected boolean hdrDisplayed
 o fetcher
  protected Runnable fetcher
 o CHANGE_ZOOM
  public final static int CHANGE_ZOOM
a logical event type requesting a change in the zoom factor
 o ZOOM_POINT
  public final static int ZOOM_POINT
a logical event type requesting a zoomed view centered on a specified pixel
 o ZOOM_BOX
  public final static int ZOOM_BOX
a logical event type requesting a zoomed view of a requested box

Constructors

 o ADILViewer
  public ADILViewer()
create a viewer with no Viewable to display
 o ADILViewer
  public ADILViewer(String hdrButtonText)
create a viewer with no Viewable to display
Parameters:
hdrButtonText - text to use on header display request button
 o ADILViewer
  public ADILViewer(AV_MainCanvas mainc,
                    AV_ImageCanvas magc,
                    AV_PositionPanel posp,
                    AV_MagnifierControl magp,
                    String hdrButtonText)
construct a Viewer using specific subcomponents
 o ADILViewer
  public ADILViewer(AV_MainCanvas mainc,
                    AV_ImageCanvas magc,
                    AV_PositionPanel posp,
                    AV_MagnifierControl magp)
construct a Viewer using specific subcomponents
 o ADILViewer
  public ADILViewer(Viewable data,
                    Slice slice)
create a viewer and display in it a slice from a viewable image

Methods

 o init
  protected void init()
assemble the components of the Viewer Panel
 o getID
  public int getID()
return the Viewer's logical event producer id
 o setID
  public void setID(int id)
set the Viewer's logical event producer id
 o isLogical
  public static boolean isLogical(Event ev)
return true if event is a logical event
 o decodeLogicalEvent
  public static Event decodeLogicalEvent(Event ev)
decode a Logical Event argument
 o getLogicalEventArg
  public static String getLogicalEventArg(Event ev)
Return a String containing the actual argument of a Logical Event
 o 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
 o 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
 o 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
 o 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
 o displaySlice
  public void displaySlice()
display a default slice of the current Viewable
Overrides:
displaySlice in class Viewer
 o displayViewable
  public void displayViewable()
display a default slice of the current Viewable
 o getDisplaySize
  public Dimension getDisplaySize()
return the size of the display area
Overrides:
getDisplaySize in class Viewer
 o 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
 o 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
 o 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
 o getPixelSelection
  public Point getPixelSelection()
get the current selected display pixel.
Overrides:
getPixelSelection in class SelectionViewer
 o getBoxSelection
  public Rectangle getBoxSelection()
get the current selected display box.
Overrides:
getBoxSelection in class SelectionViewer
 o getLineSelection
  public Rectangle getLineSelection()
get the current selected display Line.
Overrides:
getLineSelection in class SelectionViewer
 o getVoxelSelection
  public Voxel getVoxelSelection()
return the current selected Voxel, or null if there is no current Viewable.
Overrides:
getVoxelSelection in class SelectionViewer
 o 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
 o getSliceSelection
  public Slice getSliceSelection()
return the current selected Slice, or null if there is no current Viewable;
Overrides:
getSliceSelection in class SelectionViewer
 o 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
 o 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
 o 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
 o updatePosview
  public void updatePosview(AV_ImageCanvas ic,
                            int x,
                            int y)
update the display of positions in the position panel
 o updateMagview
  public void updateMagview()
update the display of the image that appears in the magnifier canvas
 o setDrawBox
  public void setDrawBox(boolean b)
 o setDrawLine
  public void setDrawLine(boolean b)
 o setDrawPoint
  public void setDrawPoint(boolean b)
 o 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();
 o setHeader
  public void setHeader(String hdr)
set the string to be used as a header
 o showHeader
  public void showHeader()
pop up a Frame with a box containing header text
 o action
  public boolean action(Event ev,
                        Object what)
Overrides:
action in class Component
 o handleLogicalEvent
  public boolean handleLogicalEvent(Event ev)
 o minimumSize
  public Dimension minimumSize()
Overrides:
minimumSize in class Container
 o getMagnification
  public float getMagnification()
 o setMagnification
  public void setMagnification(float mag)
 o clone
  public Object clone()
produce a copy of this viewer.
Overrides:
clone in class Viewer
 o 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)
 o 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