|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectfable.imageviewer.component.ImageComponent
public class ImageComponent
ImageComponent 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.
Field Summary | |
---|---|
static int |
copySecondaryID
Number to use for the secondary ID for the next copy ImageView. |
ImageComponentImage |
image
A reference to the class that manages the SWT image for this view. |
static int |
SECONDARY_ID_COPY_START
Number to use for the secondary ID for the first copy ImageView. |
static java.lang.String |
SECONDARY_ID_MAIN
Secondary ID for the main ImageView. |
static java.lang.String |
SECONDARY_ID_SLICE1D
Secondary ID for the slice 1D ImageView. |
static java.lang.String |
SECONDARY_ID_SLICE2D
Secondary ID for the slice 2D ImageView. |
static java.lang.String |
SECONDARY_ID_ZOOM
Secondary ID for the Zoom ImageView. |
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 |
Constructor Summary | |
---|---|
ImageComponent(org.eclipse.ui.IWorkbenchPart3 parentPart)
|
|
ImageComponent(org.eclipse.ui.IWorkbenchPart3 parentPart,
ActionsProvider provider)
|
Method Summary | |
---|---|
void |
calcImageDiff()
Calculate / image |
void |
createPartControl(org.eclipse.swt.widgets.Composite parent)
|
void |
dispose()
|
org.eclipse.ui.IActionBars |
getActionBars()
|
SampleController |
getController()
|
ImageComponentUI |
getControls()
|
Coordinates |
getCoordinates()
|
java.lang.String |
getCoordinatesName()
Gets the short name of the current coordinate origin. |
int |
getCoordOrigin()
|
org.eclipse.swt.widgets.Display |
getDisplay()
|
java.lang.String |
getFileName()
|
ImageComponentImage |
getImage()
|
ImageModel |
getImageDiffModel()
|
ImageModel |
getImageModel()
|
ImageModel |
getImageSavedModel()
|
float |
getMaximum()
|
float |
getMean()
|
float |
getMinimum()
|
int |
getOrientation()
|
org.eclipse.swt.graphics.PaletteData |
getPalette()
|
int |
getPaletteIndex()
|
org.eclipse.ui.IWorkbenchPart3 |
getParentPart()
|
java.lang.Object |
getPartName()
|
int |
getPeakMarkerSize()
|
java.util.Vector<java.lang.Float> |
getPeaks()
|
double |
getPixelHeightSave()
|
double |
getPixelWidthSave()
|
java.lang.String |
getSecondaryId()
|
float[] |
getStatistics()
Gets the statistics. |
float |
getUserMaximum()
|
float |
getUserMinimum()
|
double |
getX0Save()
|
java.lang.String |
getXNameSave()
|
double |
getY0Save()
|
java.lang.String |
getYNameSave()
|
ZoomSelection |
getZoomSelection()
|
void |
initWithShowPeaks()
|
boolean |
isImageDiffOn()
|
boolean |
isPeaksOn()
|
void |
loadFile(java.lang.String fileName)
|
void |
loadModel(ImageModel imageModel)
Loads a new image from the specified image model. |
void |
propertyChange(org.eclipse.jface.util.PropertyChangeEvent evt)
|
void |
resetCoordinates()
Reset the coordinates to reflect the current image and orientation. |
void |
selectionChanged(org.eclipse.ui.IWorkbenchPart part,
org.eclipse.jface.viewers.ISelection selection)
This method receives selectionEvents from the workbench. |
void |
setControls(ImageComponentUI controls)
|
void |
setCoordOrigin(int coordOrigin)
|
void |
setFocus()
|
void |
setImage(ImageComponentImage image)
|
void |
setImageDiffModel(ImageModel imageDiffModel)
|
void |
setImageDiffOn(boolean imageDiffOn)
|
void |
setImageModel(ImageModel imageModel)
|
void |
setImageSavedModel(ImageModel imageSavedModel)
|
void |
setOrientation(int orientation)
|
void |
setPalette(int index)
Creates a palette in the palettes array if it has not been created yet, sets that palette, and redisplays the image. |
void |
setPalette(org.eclipse.swt.graphics.PaletteData palette)
|
void |
setPaletteIndex(int paletteIndex)
|
void |
setPeakMarkerSize(int peakMarkerSize)
|
void |
setPeaks(java.util.Vector<java.lang.Float> vals)
set the list of peaks to display |
void |
setPeaksOn(boolean peaksOn)
|
void |
setPixelHeightSave(double pixelHeightSave)
|
void |
setPixelWidthSave(double pixelWidthSave)
|
void |
setPlotTitle(java.lang.String title)
|
void |
setStatistics(float[] statistics)
Sets the statistics. |
void |
setStatistics(float[] statistics,
boolean autoScale)
Sets the statistics and autoScale. |
void |
setStatusLabel(org.eclipse.swt.widgets.Text statusLabel)
|
void |
setUserMaximum(float userMaximum)
|
void |
setUserMinimum(float userMinimum)
|
void |
setX0Save(double save)
|
void |
setXNameSave(java.lang.String nameSave)
|
void |
setY0Save(double save)
|
void |
setYNameSave(java.lang.String nameSave)
|
void |
setZoomSelection(ZoomSelection zoomSelection)
Sets the zoomSelection. |
java.lang.String |
toString()
|
void |
transferSelectedSettings(ImageComponent src)
Transfer some of settings from another instance to this one. |
void |
updateStatusLabel(java.lang.String _status)
update status label asynchronously |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String SECONDARY_ID_MAIN
public static final java.lang.String SECONDARY_ID_ZOOM
public static final java.lang.String SECONDARY_ID_SLICE1D
public static final java.lang.String SECONDARY_ID_SLICE2D
public static int SECONDARY_ID_COPY_START
public static int copySecondaryID
public ImageComponentImage image
Constructor Detail |
---|
public ImageComponent(org.eclipse.ui.IWorkbenchPart3 parentPart)
public ImageComponent(org.eclipse.ui.IWorkbenchPart3 parentPart, ActionsProvider provider)
Method Detail |
---|
public void createPartControl(org.eclipse.swt.widgets.Composite parent)
public void setFocus()
public void selectionChanged(org.eclipse.ui.IWorkbenchPart part, org.eclipse.jface.viewers.ISelection selection)
PeakSearchSpt
or an instance of Peak
, spots are
displayed in the image.
selectionChanged
in interface org.eclipse.ui.ISelectionListener
ISelectionListener.selectionChanged(org.eclipse.ui.IWorkbenchPart,
org.eclipse.jface.viewers.ISelection)
public void loadFile(java.lang.String fileName) throws java.lang.Throwable
fileName
-
java.lang.Throwable
public void loadModel(ImageModel imageModel)
imageModel
- The image model to use.public void calcImageDiff()
public void updateStatusLabel(java.lang.String _status)
_status
- - status to displaypublic void setPeaks(java.util.Vector<java.lang.Float> vals)
vals
- - list of peaks as pairs of [y,z] coordinatespublic void propertyChange(org.eclipse.jface.util.PropertyChangeEvent evt)
propertyChange
in interface org.eclipse.jface.util.IPropertyChangeListener
public void dispose()
public void transferSelectedSettings(ImageComponent src)
source
- The source instance.public void initWithShowPeaks()
public void resetCoordinates()
public int getCoordOrigin()
public void setCoordOrigin(int coordOrigin)
coordOrigin
- the coordOrigin to setpublic int getOrientation()
public void setOrientation(int orientation)
orientation
- the orientation to setpublic org.eclipse.swt.graphics.PaletteData getPalette()
public void setPalette(int index)
index
- The index of the palette in the palettes array.for possible indices.
public float[] getStatistics()
public void setStatistics(float[] statistics, boolean autoScale)
statistics
- The new values as float[] {min, max, mean}.public void setStatistics(float[] statistics)
statistics
- The new values as float[] {min, max, mean}.public java.lang.String getFileName()
public ImageModel getImageModel()
public void setImageModel(ImageModel imageModel)
imageModel
- The imageModel to set.public ImageModel getImageDiffModel()
public void setImageDiffModel(ImageModel imageDiffModel)
imageDiffModel
- public ImageModel getImageSavedModel()
public void setImageSavedModel(ImageModel imageSavedModel)
imageSavedModel
- the imageSavedModel to setpublic Coordinates getCoordinates()
public java.lang.String getCoordinatesName()
public SampleController getController()
public boolean isPeaksOn()
public void setPeaksOn(boolean peaksOn)
peaksOn
- the peaksOn to setpublic int getPeakMarkerSize()
public void setPeakMarkerSize(int peakMarkerSize)
peakMarkerSize
- the peakMarkerSize to setpublic ImageComponentUI getControls()
public void setControls(ImageComponentUI controls)
controls
- the controls to setpublic ImageComponentImage getImage()
public void setImage(ImageComponentImage image)
image
- the image to setpublic void setZoomSelection(ZoomSelection zoomSelection)
zoomSelection
- public ZoomSelection getZoomSelection()
public java.util.Vector<java.lang.Float> getPeaks()
public boolean isImageDiffOn()
public void setImageDiffOn(boolean imageDiffOn)
imageDiffOn
- the imageDiffOn to setpublic float getMinimum()
public float getMaximum()
public float getMean()
public float getUserMinimum()
public void setUserMinimum(float userMinimum)
userMinimum
- the userMinimum to setpublic float getUserMaximum()
public void setUserMaximum(float userMaximum)
userMaximum
- the userMaximum to setpublic double getX0Save()
public void setX0Save(double save)
save
- the x0Save to setpublic double getY0Save()
public void setY0Save(double save)
save
- the y0Save to setpublic double getPixelWidthSave()
public void setPixelWidthSave(double pixelWidthSave)
pixelWidthSave
- the pixelWidthSave to setpublic double getPixelHeightSave()
public void setPixelHeightSave(double pixelHeightSave)
pixelHeightSave
- the pixelHeightSave to setpublic java.lang.String getXNameSave()
public void setXNameSave(java.lang.String nameSave)
nameSave
- the xNameSave to setpublic java.lang.String getYNameSave()
public void setYNameSave(java.lang.String nameSave)
nameSave
- the yNameSave to setpublic int getPaletteIndex()
public void setPaletteIndex(int paletteIndex)
paletteIndex
- the paletteIndex to setpublic void setPalette(org.eclipse.swt.graphics.PaletteData palette)
palette
- the palette to setpublic org.eclipse.swt.widgets.Display getDisplay()
public java.lang.String getSecondaryId()
public java.lang.Object getPartName()
public org.eclipse.ui.IActionBars getActionBars()
public java.lang.String toString()
toString
in class java.lang.Object
public org.eclipse.ui.IWorkbenchPart3 getParentPart()
public void setStatusLabel(org.eclipse.swt.widgets.Text statusLabel)
public void setPlotTitle(java.lang.String title)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |