fable.imageviewer.views
Class ImageView

java.lang.Object
  extended by org.eclipse.core.commands.common.EventManager
      extended by org.eclipse.ui.part.WorkbenchPart
          extended by org.eclipse.ui.part.ViewPart
              extended by fable.imageviewer.views.ImageView
All Implemented Interfaces:
ActionsProvider, IImagesVarKeys, org.eclipse.core.runtime.IAdaptable, org.eclipse.core.runtime.IExecutableExtension, org.eclipse.ui.IPersistable, org.eclipse.ui.IViewPart, org.eclipse.ui.IWorkbenchPart, org.eclipse.ui.IWorkbenchPart2, org.eclipse.ui.IWorkbenchPart3, org.eclipse.ui.part.IWorkbenchPartOrientation

public class ImageView
extends org.eclipse.ui.part.ViewPart
implements IImagesVarKeys, ActionsProvider

ImageView implements a view to display an image using the SWT Image widget. The image is automatically fitted to the window size. The main features are the display is fast, a variety of controls allow the user to zoom a box, line, integrated profile or 3d relief, change lookup tables, autoscale or manually scale the range. The image is treated as a floating point image so that images scaled between 0 and 1 are displayed correctly. Images can be loaded using loadFile(FabioFile) or via changeImageData().

ImageView allows multiple Views. These are distinguished by the secondary ID. The secondary ID is typically set by IWorkbenchPage.showView(String viewId, String secondaryId, int mode). The viewId to use is ImageView.ID. Any plug-in can call this method and is free to specify the secondary ID as it wishes. ImageView manages 5 secondary IDs, for the main, zoom, slice1D, slice2D, and copy views. These IDs are determined by the public fields SECONDARY_ID_xxx. If you wish to call these views, then you should use these fields by name. Except for the copy views, there is expected to be zero or one of the others. On workspace shutdown ImageView hides (i.e. removes) all of the views that it manages, except the main one with SECONDARY_ID_MAIN. This is to prevent workspace clutter on restarting the workspace. It does not remove others. Other plug-ins are responsible for removing ones they created if desired. When ImageView is first created and does not have an image, then the part name (name on the tab) is set to the secondary ID + "Image View". This should help to distinguish empty Image Views created by ImageView and other plug-ins. Eclipse can create ImageViews with a null secondary ID, e.g. via Window | Show View. ImageView hides these and creates a new one with SECONDARY_ID_MAIN to insure all views have a non-null secondary ID.

New images are typically loaded to the Main view. For example, only the Main view listens for property change events from the SampleController associated with the Image Navigator. Loading into the Main view will cause existing Zoom, Slice1, and Slice2 views to update, depending on if there is a selection and the current selection mode. That is, if there is a selection and the current mode is Area then the Zoom view will update, but not Slice1 or Slice2. Drag and Drop supports dropping on any view.

ImageView is a large View and is implemented in several classes. The principal ones are (1) ImageView which manages the usual view things and holds the values of most of the settings, (2) ImageViewControls which manages the SWT controls except for the imageCanvas, and (3) ImageViewImage which manages the imageCanvas and things, such as selections, related to it.

Dependencies :
FabioFile - for loading FabioFiles
ZoomLineView - for plotting lines and integrated profiles

The image can be viewed in 8 orientations. These orientations are associated with the TotalCrys o parameters (o11, o12, o21, o22). The parameters that result in an image oriented as it would be looking at the detector in the direction of the beam are the o parameters to specify in other Fable software, such as ImageD11.

The coordinate origin can be selected as TL=(0,0) (typical image coordinates), TR=(0,0), BR=(0,0) (TotalCrys coordinates), and BL=(0,0) (usual xy coordinate system). They can also be specified as custom. The only place the coordinates appear is in the display of the mouse position. Note that the coordinate system and the image orientation may be specified independently.

The TotalCryst project (cf. http://fable.wiki.sourceforge.net/space/showimage/Geometry_version_1.0.2.pdf) defines the coordinate system as follows:
(o) Horizontal axis as Y with zero on the right and positive to the left
(o) Vertical axis as Z with zero at the bottom and positive up.

Author:
Andy Gotz (ESRF), Ken Evans (APS)

Field Summary
static java.lang.String ID
          Plug-in ID.
 
Fields inherited from interface fable.imageviewer.internal.IImagesVarKeys
BTN_IMG_ADD, BTN_IMG_ADD_PLOT, BTN_IMG_DELETE, BTN_IMG_SETTINGS, BTN_IMG_SUBTRACT, BTN_IMG_SUBTRACT_PLOT, COORD_BL, COORD_BR, COORD_CUSTOM, COORD_TL, COORD_TR, coordNameValues, O_MOOM, O_MOOP, O_OMMO, O_OMPO, O_OPMO, O_OPPO, O_POOM, O_POOP, orientNameValues, PALETTE_AUTUMN, PALETTE_BLUES, PALETTE_COLOR, PALETTE_GREENS, PALETTE_GREY, PALETTE_PASTEL1, PALETTE_RAINBOW1, PALETTE_RAINBOW2, PALETTE_REDS, PALETTE_SPRING, PALETTE_SUMMER, PALETTE_WINTER, paletteNameValues
 
Fields inherited from interface org.eclipse.ui.IWorkbenchPart
PROP_TITLE
 
Constructor Summary
ImageView()
           
 
Method Summary
 void createPartControl(org.eclipse.swt.widgets.Composite parent)
           
 void dispose()
           
 org.eclipse.ui.IActionBars getActionBars()
           
 ImageComponentImage getImage()
           
 ImageComponent getImageComponent()
           
 java.lang.String getSecondaryId()
           
 void setFocus()
           
 void setPartName(java.lang.String name)
           
 void setZoomSelection(ZoomSelection area)
           
 void transferSelectedSettings(ImageComponent iv)
           
 
Methods inherited from class org.eclipse.ui.part.ViewPart
getViewSite, init, init, saveState, setInitializationData
 
Methods inherited from class org.eclipse.ui.part.WorkbenchPart
addPartPropertyListener, addPropertyListener, getAdapter, getContentDescription, getOrientation, getPartName, getPartProperties, getPartProperty, getSite, getTitle, getTitleImage, getTitleToolTip, removePartPropertyListener, removePropertyListener, setPartProperty, showBusy
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.eclipse.ui.IWorkbenchPart
addPropertyListener, getSite, getTitle, getTitleImage, getTitleToolTip, removePropertyListener
 
Methods inherited from interface org.eclipse.core.runtime.IAdaptable
getAdapter
 

Field Detail

ID

public static final java.lang.String ID
Plug-in ID.

See Also:
Constant Field Values
Constructor Detail

ImageView

public ImageView()
Method Detail

createPartControl

public void createPartControl(org.eclipse.swt.widgets.Composite parent)
Specified by:
createPartControl in interface org.eclipse.ui.IWorkbenchPart
Specified by:
createPartControl in class org.eclipse.ui.part.WorkbenchPart

setFocus

public void setFocus()
Specified by:
setFocus in interface org.eclipse.ui.IWorkbenchPart
Specified by:
setFocus in class org.eclipse.ui.part.WorkbenchPart

dispose

public void dispose()
Specified by:
dispose in interface org.eclipse.ui.IWorkbenchPart
Overrides:
dispose in class org.eclipse.ui.part.WorkbenchPart

getSecondaryId

public java.lang.String getSecondaryId()
Returns:
the secondary ID of this instance.

getImage

public ImageComponentImage getImage()

setPartName

public void setPartName(java.lang.String name)
Overrides:
setPartName in class org.eclipse.ui.part.ViewPart

transferSelectedSettings

public void transferSelectedSettings(ImageComponent iv)

getImageComponent

public ImageComponent getImageComponent()

getActionBars

public org.eclipse.ui.IActionBars getActionBars()
Specified by:
getActionBars in interface ActionsProvider

setZoomSelection

public void setZoomSelection(ZoomSelection area)