fr.esrf.tangoatk.widget.attribute
Class NumberImageViewer

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JPanel
                  extended by fr.esrf.tangoatk.widget.attribute.NumberImageViewer
All Implemented Interfaces:
IAttributeStateListener, IErrorListener, IImageListener, JDrawable, java.awt.event.ActionListener, java.awt.event.KeyListener, java.awt.event.MouseListener, java.awt.event.MouseMotionListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible

public class NumberImageViewer
extends javax.swing.JPanel
implements IImageListener, java.awt.event.MouseMotionListener, java.awt.event.MouseListener, java.awt.event.ActionListener, java.awt.event.KeyListener, JDrawable

A high level class to display a TANGO image and handle several image manipulation function.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JPanel
javax.swing.JPanel.AccessibleJPanel
 
Nested classes/interfaces inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
protected  javax.swing.JButton axisButton
           
protected  javax.swing.JCheckBoxMenuItem bestFitMenuItem
           
protected  javax.swing.JPanel buttonPanel
           
protected  javax.swing.JScrollPane buttonView
           
protected  javax.swing.JMenu dblProfileMenu
           
protected  javax.swing.JCheckBoxMenuItem displayLogMenuItem
           
protected  double[][] doubleValues
           
protected  javax.swing.JButton fileButton
           
protected  javax.swing.JMenuItem fileMenuItem
           
protected  javax.swing.JCheckBoxMenuItem hBottomCheckMenuItem
           
protected  javax.swing.JCheckBoxMenuItem hCenterCheckMenuItem
           
protected  javax.swing.JButton histoButton
           
protected  javax.swing.JMenuItem histogramMenuItem
           
protected  javax.swing.JCheckBoxMenuItem hTopCheckMenuItem
           
protected  JImage imagePanel
           
protected  javax.swing.JScrollPane imageView
           
protected  javax.swing.JPopupMenu imgMenu
           
protected  javax.swing.JMenuItem infoMenuItem
           
protected  javax.swing.filechooser.FileFilter lastFileFilter
           
protected  java.lang.String lastSnapshotLocation
           
protected  javax.swing.JMenuItem lineProfile2MenuItem
           
protected  javax.swing.JMenuItem lineProfileMenuItem
           
protected  LineProfilerViewer lineProfiler
           
protected  javax.swing.JButton loadButton
           
protected  javax.swing.JMenuItem loadMenuItem
           
protected  boolean logValues
           
protected  javax.swing.JCheckBoxMenuItem negativeMenuItem
           
protected  java.awt.Insets noMargin
           
protected  javax.swing.JButton printButton
           
protected  javax.swing.JMenuItem printMenuItem
           
protected  javax.swing.JButton profile2Button
           
protected  javax.swing.JButton profileButton
           
protected  int profileMode
           
protected  javax.swing.JButton saveButton
           
protected  javax.swing.JMenuItem saveDataFileMenuItem
           
protected  javax.swing.JMenuItem saveMenuItem
           
protected  javax.swing.JButton selectButton
           
protected  javax.swing.JButton selectColorButton
           
protected  javax.swing.JMenuItem selectionColorMenuItem
           
protected  javax.swing.JMenuItem selectionMaxMenuItem
           
protected  javax.swing.JMenuItem selectionMenuItem
           
protected  javax.swing.JButton selectMaxButton
           
protected  javax.swing.JTextField selText
           
protected  javax.swing.JButton settingsButton
           
protected  javax.swing.JMenuItem settingsMenuItem
           
protected  javax.swing.JCheckBoxMenuItem showGradMenuItem
           
protected  javax.swing.JCheckBoxMenuItem snapToGridMenuItem
           
protected  int startHisto
           
protected  javax.swing.JCheckBoxMenuItem statusLineMenuItem
           
protected  javax.swing.JButton tableButton
           
protected  javax.swing.JMenuItem tableMenuItem
           
protected  javax.swing.JCheckBoxMenuItem toolbarMenuItem
           
protected  javax.swing.JCheckBoxMenuItem vCenterCheckMenuItem
           
protected  javax.swing.JCheckBoxMenuItem vLeftCheckMenuItem
           
protected  javax.swing.JCheckBoxMenuItem vRigthCheckMenuItem
           
protected  javax.swing.JButton zoomButton
           
protected  javax.swing.JMenuItem zoomMenuItem
           
 
Fields inherited from class javax.swing.JComponent
accessibleContext, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
NumberImageViewer()
          Create a new NumberImageViewer
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent evt)
           
 int addCrossMarker(int x, int y, java.awt.Color c)
          Adds a cross marker at the specified pos
 int addHorizontalLineMarker(int y, java.awt.Color c)
          Adds a horizontal line marker
 int addRectangleMarker(int x, int y, int width, int height, java.awt.Color c)
          Adds a rectangle marker
 void addRoiListener(IRoiListener l)
           
 int addVerticalLineMarker(int x, java.awt.Color c)
          Adds a vertical line marker
protected  double[] buildHistogramData()
           
protected  double[] buildProfileData(java.awt.Point p1, java.awt.Point p2)
           
protected  void changeSelectionColor()
           
 void clearMarkers()
          Clears all markers
 void clearModel()
          Removes all listener belonging to the viewer.
protected  double[][] computeLog(double[][] values)
           
protected  void constructLineProfiler()
           
 void errorChange(ErrorEvent errorEvent)
           
 void fireRoiChange()
           
protected  void freePopup()
           
 boolean getAutoZoom()
          Determines wheter this image viewer has auto zoom enabled.
 double getBestFitMax()
          Returns current best fit max value (user value)
 double getBestFitMin()
          Returns current best fit min value (user value)
 javax.swing.JComponent getComponent()
          Returns the JComponent that implements this interface.
 java.awt.Dimension getCurrentImageSize()
          Returns the current image size
 java.lang.String getDescription(java.lang.String name)
          Get a description of this extensions.
 java.lang.String getExtendedParam(java.lang.String name)
          Returns the specified parameter value.
 java.lang.String[] getExtensionList()
          Returns list of extension name for this objects (Empty array for none).
 Gradient getGradient()
          Returns current colormap
 JLAxis getGradientAxis()
          Returna handle to the Gradient axis.
 java.awt.Insets getImageMargin()
          Returns image margin.
 int getImageXCoord(int x)
          Converts the component horizontal coordinate to the image coordinate.
 int getImageYCoord(int y)
          Converts the component vertical coordinate to the image coordinate.
 java.awt.Rectangle getSelection()
          Return current floating rectangle selection
 int getSelectionMode()
          Returns the floating selection mode
 java.lang.String getSettings()
          returns the configuration as string.
 JLAxis getXAxis()
          Returns a handle to the x axis.
 JLAxis getYAxis()
          Return a handle to the Y axis.
 int getZoom()
          Return the current zoom factor index.
 boolean hasMarker()
           
 void imageChange(NumberImageEvent evt)
           
protected  void initButtonPanel()
           
 void initForEditing()
          Call after a component of a JDSwingObject is created, this give a default look and feel for editing.
protected  void initGradient()
           
protected  void initImagePanel()
           
protected  void initPopupMenu()
           
protected  void initStatusLine()
           
 boolean isAlignToGrid()
          Returns true is floating selection are aligned to grid
 boolean isAutoBestFit()
          Returns true when automatic best fit is enabled
 boolean isBestFit()
          Returns true when best fit is on
 boolean isGradientVisible()
          Returns true when the gradient is visible.
 boolean isLogValues()
           
 boolean isNegative()
          Returns true only if negative image is displayed
 boolean isSelectionEnabled()
          Returns true is floating selection is enabled
 boolean isShowingMenu()
          Returns true is the image viewer menu is displayed when clicking on the right mouse button.
 boolean isStatusLineVisible()
          Returns true when the status line is visible.
 boolean isToolbarVisible()
          Returns true when the toolbar is visible.
 void keyPressed(java.awt.event.KeyEvent e)
           
 void keyReleased(java.awt.event.KeyEvent e)
           
 void keyTyped(java.awt.event.KeyEvent e)
           
 void loadImage(java.lang.String fileName)
          Load an image (gif,jpg or png) into the viewer.
 java.lang.String loadSetting(java.lang.String filename)
          Load NumberImageViewer settings.
static void main(java.lang.String[] args)
           
 void mouseClicked(java.awt.event.MouseEvent e)
           
 void mouseDragged(java.awt.event.MouseEvent e)
           
 void mouseEntered(java.awt.event.MouseEvent e)
           
 void mouseExited(java.awt.event.MouseEvent e)
           
 void mouseMoved(java.awt.event.MouseEvent e)
           
 void mousePressed(java.awt.event.MouseEvent e)
           
 void mouseReleased(java.awt.event.MouseEvent e)
           
protected  void mulPoint(java.awt.Point p)
           
protected  void mulRect(java.awt.Rectangle r)
           
 void printImage()
          Prints out this image.
protected  void refreshLineProfile()
           
protected  void refreshStatusLine()
           
 void removeRoiListener(IRoiListener l)
           
 void saveSetting(java.lang.String filename)
          Save settings.
 void setAlignToGrid(boolean b)
          Sets the align to grid mode for floating selection
 void setAutoBestFit(boolean b)
          Sets the auto Best fit mode.
 void setAutoZoom(boolean auto)
          Enables or disables the auto zoom.
 void setBestFit(boolean b)
          Displays the image using the whole color range.
 void setBestFitMinMax(double min, double max)
          Sets the value of best fit min and max when automatic best fit is off.
 void setCrossCursor(boolean enable)
          Enable or disable the cross cursor.
 void setCrossCursorColor(java.awt.Color c)
          Set the cross cursor color.
 void setData(double[][] v)
          Sets data to display.
 boolean setExtendedParam(java.lang.String name, java.lang.String value, boolean popupErr)
          Sets the specified param.
 void setGradient(Gradient g)
          Sets the colormap
 void setGradientVisible(boolean b)
          Displays or hides the gradient (right panel).
 void setImageMargin(java.awt.Insets i)
          Sets the image margin.
 void setLogValues(boolean logValues)
           
 void setMarkerPos(int id, int x, int y, int nWidth, int nHeight)
          Sets the position of a marker
 void setModel(INumberImage v)
          setModel Set the model.
 void setNegative(boolean b)
          Displays negative image when enabled
 void setSelection(java.awt.Rectangle r)
          Sets the floating selection.
 void setSelectionEnabled(boolean b)
          True is floating selection is enabled
 void setSelectionMode(int m)
          Sets the floating selection mode
 void setShowingMenu(boolean b)
          True to enable menu displayed when clicking on right mouse button.
 void setStatusLineVisible(boolean b)
          Displays or hides the status line (bottom panel).
 void setToolbarVisible(boolean b)
          Displays or hides the toolbar.
 void setVerticalExtent(int ratio)
          Extend verticaly the image.
 void setZoom(int zoomIndex)
          Sets the image zoom factor (does not affect the zoom dialog).
 void stateChange(AttributeStateEvent evt)
           
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

doubleValues

protected double[][] doubleValues

profileMode

protected int profileMode

startHisto

protected int startHisto

noMargin

protected java.awt.Insets noMargin

imagePanel

protected JImage imagePanel

imageView

protected javax.swing.JScrollPane imageView

buttonPanel

protected javax.swing.JPanel buttonPanel

selectButton

protected javax.swing.JButton selectButton

selectMaxButton

protected javax.swing.JButton selectMaxButton

selectColorButton

protected javax.swing.JButton selectColorButton

fileButton

protected javax.swing.JButton fileButton

zoomButton

protected javax.swing.JButton zoomButton

tableButton

protected javax.swing.JButton tableButton

profileButton

protected javax.swing.JButton profileButton

profile2Button

protected javax.swing.JButton profile2Button

histoButton

protected javax.swing.JButton histoButton

settingsButton

protected javax.swing.JButton settingsButton

axisButton

protected javax.swing.JButton axisButton

loadButton

protected javax.swing.JButton loadButton

saveButton

protected javax.swing.JButton saveButton

printButton

protected javax.swing.JButton printButton

buttonView

protected javax.swing.JScrollPane buttonView

selText

protected javax.swing.JTextField selText

imgMenu

protected javax.swing.JPopupMenu imgMenu

infoMenuItem

protected javax.swing.JMenuItem infoMenuItem

bestFitMenuItem

protected javax.swing.JCheckBoxMenuItem bestFitMenuItem

snapToGridMenuItem

protected javax.swing.JCheckBoxMenuItem snapToGridMenuItem

negativeMenuItem

protected javax.swing.JCheckBoxMenuItem negativeMenuItem

toolbarMenuItem

protected javax.swing.JCheckBoxMenuItem toolbarMenuItem

statusLineMenuItem

protected javax.swing.JCheckBoxMenuItem statusLineMenuItem

showGradMenuItem

protected javax.swing.JCheckBoxMenuItem showGradMenuItem

selectionMenuItem

protected javax.swing.JMenuItem selectionMenuItem

selectionMaxMenuItem

protected javax.swing.JMenuItem selectionMaxMenuItem

selectionColorMenuItem

protected javax.swing.JMenuItem selectionColorMenuItem

fileMenuItem

protected javax.swing.JMenuItem fileMenuItem

zoomMenuItem

protected javax.swing.JMenuItem zoomMenuItem

tableMenuItem

protected javax.swing.JMenuItem tableMenuItem

lineProfileMenuItem

protected javax.swing.JMenuItem lineProfileMenuItem

lineProfile2MenuItem

protected javax.swing.JMenuItem lineProfile2MenuItem

dblProfileMenu

protected javax.swing.JMenu dblProfileMenu

vLeftCheckMenuItem

protected javax.swing.JCheckBoxMenuItem vLeftCheckMenuItem

vCenterCheckMenuItem

protected javax.swing.JCheckBoxMenuItem vCenterCheckMenuItem

vRigthCheckMenuItem

protected javax.swing.JCheckBoxMenuItem vRigthCheckMenuItem

hTopCheckMenuItem

protected javax.swing.JCheckBoxMenuItem hTopCheckMenuItem

hCenterCheckMenuItem

protected javax.swing.JCheckBoxMenuItem hCenterCheckMenuItem

hBottomCheckMenuItem

protected javax.swing.JCheckBoxMenuItem hBottomCheckMenuItem

histogramMenuItem

protected javax.swing.JMenuItem histogramMenuItem

settingsMenuItem

protected javax.swing.JMenuItem settingsMenuItem

loadMenuItem

protected javax.swing.JMenuItem loadMenuItem

saveMenuItem

protected javax.swing.JMenuItem saveMenuItem

saveDataFileMenuItem

protected javax.swing.JMenuItem saveDataFileMenuItem

printMenuItem

protected javax.swing.JMenuItem printMenuItem

displayLogMenuItem

protected javax.swing.JCheckBoxMenuItem displayLogMenuItem

lineProfiler

protected LineProfilerViewer lineProfiler

lastSnapshotLocation

protected java.lang.String lastSnapshotLocation

lastFileFilter

protected javax.swing.filechooser.FileFilter lastFileFilter

logValues

protected boolean logValues
Constructor Detail

NumberImageViewer

public NumberImageViewer()
Create a new NumberImageViewer

Method Detail

initImagePanel

protected void initImagePanel()

initButtonPanel

protected void initButtonPanel()

initGradient

protected void initGradient()

initStatusLine

protected void initStatusLine()

initPopupMenu

protected void initPopupMenu()

initForEditing

public void initForEditing()
Description copied from interface: JDrawable
Call after a component of a JDSwingObject is created, this give a default look and feel for editing.

Specified by:
initForEditing in interface JDrawable

getComponent

public javax.swing.JComponent getComponent()
Description copied from interface: JDrawable
Returns the JComponent that implements this interface.

Specified by:
getComponent in interface JDrawable

getDescription

public java.lang.String getDescription(java.lang.String name)
Description copied from interface: JDrawable
Get a description of this extensions.

Specified by:
getDescription in interface JDrawable
Parameters:
name - Extension name
Returns:
Empty string for no description.

getExtensionList

public java.lang.String[] getExtensionList()
Description copied from interface: JDrawable
Returns list of extension name for this objects (Empty array for none).

Specified by:
getExtensionList in interface JDrawable

setExtendedParam

public boolean setExtendedParam(java.lang.String name,
                                java.lang.String value,
                                boolean popupErr)
Description copied from interface: JDrawable
Sets the specified param.

Specified by:
setExtendedParam in interface JDrawable
Parameters:
name - Parameter name (Case unsensitive).
value - Parameter value.
popupErr - true when the JDrawable should display a popup if the parameter value is incorrect, false otherwise. Note that the JDrawable must not display an error message if the parameter does not exists even if popupAllowed is true.
Returns:
true if parameters has been succesfully applied, false otherwise.

getExtendedParam

public java.lang.String getExtendedParam(java.lang.String name)
Description copied from interface: JDrawable
Returns the specified parameter value.

Specified by:
getExtendedParam in interface JDrawable
Parameters:
name - Param name (Case unsensitive).
Returns:
Empty string if not exists, the value otherwise.

addRoiListener

public void addRoiListener(IRoiListener l)

removeRoiListener

public void removeRoiListener(IRoiListener l)

fireRoiChange

public void fireRoiChange()

setBestFit

public void setBestFit(boolean b)
Displays the image using the whole color range.

Parameters:
b - Best fit toggle

isBestFit

public boolean isBestFit()
Returns true when best fit is on

Returns:
Best fit state

setAutoBestFit

public void setAutoBestFit(boolean b)
Sets the auto Best fit mode. Computes maximum and minimum value of the image when enabled else uses the min and max best fit user values.

Parameters:
b - True to enable auto best fit

isAutoBestFit

public boolean isAutoBestFit()
Returns true when automatic best fit is enabled

Returns:
Auto best fit state

setBestFitMinMax

public void setBestFitMinMax(double min,
                             double max)
Sets the value of best fit min and max when automatic best fit is off.

Parameters:
min - Minimum value
max - Maximum value

getBestFitMin

public double getBestFitMin()
Returns current best fit min value (user value)

Returns:
Minimum value

getBestFitMax

public double getBestFitMax()
Returns current best fit max value (user value)

Returns:
Maximum value

setGradient

public void setGradient(Gradient g)
Sets the colormap

Parameters:
g - New gradient colormap

getGradient

public Gradient getGradient()
Returns current colormap

Returns:
Gradient object

setNegative

public void setNegative(boolean b)
Displays negative image when enabled

Parameters:
b - True for negtive image

isNegative

public boolean isNegative()
Returns true only if negative image is displayed

Returns:
True when negative

setAlignToGrid

public void setAlignToGrid(boolean b)
Sets the align to grid mode for floating selection

Parameters:
b - True to enable

isAlignToGrid

public boolean isAlignToGrid()
Returns true is floating selection are aligned to grid

Returns:
Align to grid

setToolbarVisible

public void setToolbarVisible(boolean b)
Displays or hides the toolbar.

Parameters:
b - True if toolbar is displayed

isToolbarVisible

public boolean isToolbarVisible()
Returns true when the toolbar is visible.

Returns:
Toolbar visible state

setStatusLineVisible

public void setStatusLineVisible(boolean b)
Displays or hides the status line (bottom panel).

Parameters:
b - True if status line is displayed

isStatusLineVisible

public boolean isStatusLineVisible()
Returns true when the status line is visible.

Returns:
Status line visible state

setGradientVisible

public void setGradientVisible(boolean b)
Displays or hides the gradient (right panel).

Parameters:
b - True if status line is displayed

isGradientVisible

public boolean isGradientVisible()
Returns true when the gradient is visible.


setShowingMenu

public void setShowingMenu(boolean b)
True to enable menu displayed when clicking on right mouse button.

Parameters:
b - True to enable the menu

setZoom

public void setZoom(int zoomIndex)
Sets the image zoom factor (does not affect the zoom dialog). If you want to start you viewer with a fixed zoom factor, you have to call setZoom() before setModel().
 Possible zoomIndex values are:
   0 : 800%
   1 : 400%
   2 : 200%
   3 : 100%
   4 : 50%
   5 : 25%
   6 : 12.5%
 

Parameters:
zoomIndex - ZoomFactor index (see description).

getZoom

public int getZoom()
Return the current zoom factor index.

See Also:
setZoom(int)

setAutoZoom

public void setAutoZoom(boolean auto)
Enables or disables the auto zoom. When enabled, the image size (zoom) is automatically adjusted according to the component size. The calcul of the size is triggered by a call to setData() or imageChange().

Parameters:
auto - AutoZoom flag

getAutoZoom

public boolean getAutoZoom()
Determines wheter this image viewer has auto zoom enabled.

See Also:
setAutoZoom(boolean)

isShowingMenu

public boolean isShowingMenu()
Returns true is the image viewer menu is displayed when clicking on the right mouse button.

Returns:
True is menu is enabled

getImageMargin

public java.awt.Insets getImageMargin()
Returns image margin.

Returns:
Mergin

setImageMargin

public void setImageMargin(java.awt.Insets i)
Sets the image margin.

Parameters:
i - Image margin

getCurrentImageSize

public java.awt.Dimension getCurrentImageSize()
Returns the current image size

Returns:
Current image size

setSelectionEnabled

public void setSelectionEnabled(boolean b)
True is floating selection is enabled

Parameters:
b - True to allow floating selection

isSelectionEnabled

public boolean isSelectionEnabled()
Returns true is floating selection is enabled

Returns:
True when floating selection is allowed

setCrossCursor

public void setCrossCursor(boolean enable)
Enable or disable the cross cursor.

Parameters:
enable - True to enable cross cursor, false otherwise.

setCrossCursorColor

public void setCrossCursorColor(java.awt.Color c)
Set the cross cursor color.

Parameters:
c - Cursor color
See Also:
setCrossCursor(boolean)

setSelection

public void setSelection(java.awt.Rectangle r)
Sets the floating selection.

Parameters:
r - Rectangle to select

getSelection

public java.awt.Rectangle getSelection()
Return current floating rectangle selection

Returns:
Selection rectangle, Null is returned when nothing is selected.

getSelectionMode

public int getSelectionMode()
Returns the floating selection mode

Returns:
0 when Line selection, 1 when rectangle selection

setSelectionMode

public void setSelectionMode(int m)
Sets the floating selection mode

Parameters:
m - 0 for Line selection, 1 fro rectangle selection

setData

public void setData(double[][] v)
Sets data to display.

Parameters:
v - Handle to data

loadImage

public void loadImage(java.lang.String fileName)
               throws java.io.IOException
Load an image (gif,jpg or png) into the viewer. For color image the green field is taken.

Parameters:
fileName - File to be loaded
Throws:
java.io.IOException - Exception thrown in case of failure

addCrossMarker

public int addCrossMarker(int x,
                          int y,
                          java.awt.Color c)
Adds a cross marker at the specified pos

Parameters:
x - X coordinates
y - Y coordinates
c - Marker Color
Returns:
Marker id

addRectangleMarker

public int addRectangleMarker(int x,
                              int y,
                              int width,
                              int height,
                              java.awt.Color c)
Adds a rectangle marker

Parameters:
x - X topleft corner coordinate
y - Y topleft corner coordinate
width - Rectangle width
height - Rectangle hieght
c - Marker Color
Returns:
Marker id

addVerticalLineMarker

public int addVerticalLineMarker(int x,
                                 java.awt.Color c)
Adds a vertical line marker

Parameters:
x - Horizontal position
c - Marker color
Returns:
Marker id

addHorizontalLineMarker

public int addHorizontalLineMarker(int y,
                                   java.awt.Color c)
Adds a horizontal line marker

Parameters:
y - Vertical position
c - Marker color
Returns:
Marker id

setMarkerPos

public void setMarkerPos(int id,
                         int x,
                         int y,
                         int nWidth,
                         int nHeight)
Sets the position of a marker

Parameters:
id - Marker index
x - X coordinate (ignored when HORIZONTAL_LINE Marker)
y - Y coordinate (ignored when VERTICAL_LINE Marker)
nWidth - Rectangle width (ignored when CROSS Marker or LINE Marker)
nHeight - Rectangle height (ignored when CROSS Marker or LINE Marker)

clearMarkers

public void clearMarkers()
Clears all markers


hasMarker

public boolean hasMarker()

getXAxis

public JLAxis getXAxis()
Returns a handle to the x axis.


getYAxis

public JLAxis getYAxis()
Return a handle to the Y axis.


getGradientAxis

public JLAxis getGradientAxis()
Returna handle to the Gradient axis.


getImageXCoord

public int getImageXCoord(int x)
Converts the component horizontal coordinate to the image coordinate.

Parameters:
x - Component horizontal coordinate

getImageYCoord

public int getImageYCoord(int y)
Converts the component vertical coordinate to the image coordinate.

Parameters:
y - Component vertical coordinate

setVerticalExtent

public void setVerticalExtent(int ratio)
Extend verticaly the image.

Parameters:
ratio - Vertical extent ration

mulRect

protected void mulRect(java.awt.Rectangle r)

mulPoint

protected void mulPoint(java.awt.Point p)

freePopup

protected void freePopup()

buildProfileData

protected double[] buildProfileData(java.awt.Point p1,
                                    java.awt.Point p2)

buildHistogramData

protected double[] buildHistogramData()

refreshLineProfile

protected void refreshLineProfile()

refreshStatusLine

protected void refreshStatusLine()

saveSetting

public void saveSetting(java.lang.String filename)
Save settings.

Parameters:
filename - file to be saved.

getSettings

public java.lang.String getSettings()
returns the configuration as string.

See Also:
saveSetting(java.lang.String)

loadSetting

public java.lang.String loadSetting(java.lang.String filename)
Load NumberImageViewer settings.

Parameters:
filename - file to be read
Returns:
An error string or An empty string when succes

constructLineProfiler

protected void constructLineProfiler()

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent evt)
Specified by:
actionPerformed in interface java.awt.event.ActionListener

mouseDragged

public void mouseDragged(java.awt.event.MouseEvent e)
Specified by:
mouseDragged in interface java.awt.event.MouseMotionListener

mouseMoved

public void mouseMoved(java.awt.event.MouseEvent e)
Specified by:
mouseMoved in interface java.awt.event.MouseMotionListener

mouseEntered

public void mouseEntered(java.awt.event.MouseEvent e)
Specified by:
mouseEntered in interface java.awt.event.MouseListener

mouseExited

public void mouseExited(java.awt.event.MouseEvent e)
Specified by:
mouseExited in interface java.awt.event.MouseListener

mouseClicked

public void mouseClicked(java.awt.event.MouseEvent e)
Specified by:
mouseClicked in interface java.awt.event.MouseListener

mouseReleased

public void mouseReleased(java.awt.event.MouseEvent e)
Specified by:
mouseReleased in interface java.awt.event.MouseListener

mousePressed

public void mousePressed(java.awt.event.MouseEvent e)
Specified by:
mousePressed in interface java.awt.event.MouseListener

keyPressed

public void keyPressed(java.awt.event.KeyEvent e)
Specified by:
keyPressed in interface java.awt.event.KeyListener

keyTyped

public void keyTyped(java.awt.event.KeyEvent e)
Specified by:
keyTyped in interface java.awt.event.KeyListener

keyReleased

public void keyReleased(java.awt.event.KeyEvent e)
Specified by:
keyReleased in interface java.awt.event.KeyListener

errorChange

public void errorChange(ErrorEvent errorEvent)
Specified by:
errorChange in interface IErrorListener

stateChange

public void stateChange(AttributeStateEvent evt)
Specified by:
stateChange in interface IAttributeStateListener

imageChange

public void imageChange(NumberImageEvent evt)
Specified by:
imageChange in interface IImageListener

setModel

public void setModel(INumberImage v)
setModel Set the model.

Parameters:
v - Value to assign to model. This image must have a height equals to 2.

clearModel

public void clearModel()
Removes all listener belonging to the viewer.


printImage

public void printImage()
Prints out this image.


isLogValues

public boolean isLogValues()
Returns:
the logValues

setLogValues

public void setLogValues(boolean logValues)
Parameters:
logValues - the logValues to set

computeLog

protected double[][] computeLog(double[][] values)

changeSelectionColor

protected void changeSelectionColor()

main

public static void main(java.lang.String[] args)