DESY ACOP Beans Home

de.desy.acop.video.displayer
Class ImageDisplayer

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 de.desy.acop.video.displayer.ImageDisplayer
All Implemented Interfaces:
TineImageReceiver, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible

public class ImageDisplayer
extends javax.swing.JPanel
implements TineImageReceiver

ImageDisplayer implements basic, but versatile display of video images. Five guidelines were set at development startup:

The component was designed that it can either be used inside a so-called ACOP Video Bean as well as inside a stand alone application.

Version:
$Id: Templates.xml,v 1.10 2008/06/23 14:30:13 sweisse Exp $
Author:
sweisse, mdavid
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.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
static java.lang.String INVALID_CAMERA_PORT_NAME
           
static java.lang.String PROPERTY_AOI_ZOOM
           
static java.lang.String PROPERTY_COLOR_MAP
           
static java.lang.String PROPERTY_HISTOGRAM_EQUALISATION
           
static java.lang.String PROPERTY_HISTOGRAM_MAX
           
static java.lang.String PROPERTY_HISTOGRAM_MIN
           
static java.lang.String PROPERTY_IMAGE_ZOOM
           
static java.lang.String PROPERTY_KEEP_ASPECT_RATIO
           
static java.lang.String PROPERTY_OVERLAY_STATE
           
 
Fields inherited from class javax.swing.JComponent
accessibleContext, listenerList, 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
ImageDisplayer()
          Constructs class
 
Method Summary
 boolean exportToPNG(java.lang.String fileNamePath)
          Exports the currently displayed image as exported PNG file.
 ImageCLUT getCLUT()
          returns the currently used color lookup table.
 ColorMap getColorMap()
          returns the currently used false color map to outside world.
 java.beans.ExceptionListener getExceptionListener()
          Gets the ExceptionListener object for this ImageDisplayer.
 int getHistogramMax()
          returns histogram max value
 int getHistogramMin()
          returns histogram min value
 de.desy.tine.types.IMAGE getIMAGE()
          Returns current Tine image
 ImageZoom getImageZoom()
          Returns image zoom.
 OverlayState getOverlayState()
          Returns overlay information state.
 java.awt.image.BufferedImage getSnapshotImage()
          Takes a snapshot of the currently displayed image.
 boolean isAOIZoom()
          returns whether out zooming of AOI (no black border around AOI which depicts full frame) is currently enabled.
 boolean isHistogramEqualisation()
          returns whether histogram equalization (normalization) is currently enabled.
 boolean isKeepAspectRatio()
          returns whether 'aspect ratio is kept' is currently enabled.
protected  void paintComponent(java.awt.Graphics g)
           
 void resetForReceiving()
          resets important internal parameters.
 boolean saveAsPNGImage(java.lang.String fileNamePath)
          Saves the currently displayed image as archival PNG file.
 void setAOIZoom(boolean aoiZoom)
          Switches 'AOI zoom' on or off.
 void setCLUT(ImageCLUT newValue)
          Sets color lookup table.
 void setColorMap(ColorMap newValue)
          Updates the currently used false color map.
 void setExceptionListener(java.beans.ExceptionListener exceptionListener)
          Sets an exception listener for this ImageDisplayer.
 void setHistogramEqualisation(boolean newValue)
          Sets whether or not the histogram equalization (normalization) is enabled.
After new assignment, drawing as well as repainting is enforced to update all involved parts of code so that Histogram Equalization is immediately applied to image.
 void setHistogramMax(int newValue)
          Sets histogram max value
 void setHistogramMin(int newValue)
          Sets histogram min value
 void setImageZoom(ImageZoom newValue)
          Sets image zoom
 void setKeepAspectRatio(boolean keepAspectRatio)
          Switches 'aspect ratio is kept' on or off.
 void setLiveTransfer(boolean aLive)
          informs the displayer that a lot of frames are constantly to be drawn(true) or it is not very likely that a lot of frames are drawn (timeout on transfer or stop mode).
 void setOverlayState(OverlayState newValue)
          Sets overlay state mode
 void updateValue(de.desy.tine.types.IMAGE ti)
          passes/injects a new image into image processing, drawing and redrawing pipeline.
 
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, getBaseline, getBaselineResizeBehavior, 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, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, 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

INVALID_CAMERA_PORT_NAME

public static final java.lang.String INVALID_CAMERA_PORT_NAME
See Also:
Constant Field Values

PROPERTY_KEEP_ASPECT_RATIO

public static final java.lang.String PROPERTY_KEEP_ASPECT_RATIO
See Also:
Constant Field Values

PROPERTY_AOI_ZOOM

public static final java.lang.String PROPERTY_AOI_ZOOM
See Also:
Constant Field Values

PROPERTY_OVERLAY_STATE

public static final java.lang.String PROPERTY_OVERLAY_STATE
See Also:
Constant Field Values

PROPERTY_IMAGE_ZOOM

public static final java.lang.String PROPERTY_IMAGE_ZOOM
See Also:
Constant Field Values

PROPERTY_HISTOGRAM_EQUALISATION

public static final java.lang.String PROPERTY_HISTOGRAM_EQUALISATION
See Also:
Constant Field Values

PROPERTY_HISTOGRAM_MIN

public static final java.lang.String PROPERTY_HISTOGRAM_MIN
See Also:
Constant Field Values

PROPERTY_HISTOGRAM_MAX

public static final java.lang.String PROPERTY_HISTOGRAM_MAX
See Also:
Constant Field Values

PROPERTY_COLOR_MAP

public static final java.lang.String PROPERTY_COLOR_MAP
See Also:
Constant Field Values
Constructor Detail

ImageDisplayer

public ImageDisplayer()
Constructs class

Method Detail

paintComponent

protected void paintComponent(java.awt.Graphics g)
Overrides:
paintComponent in class javax.swing.JComponent

getIMAGE

public de.desy.tine.types.IMAGE getIMAGE()
Returns current Tine image

Returns:
TINE image

getCLUT

public ImageCLUT getCLUT()
returns the currently used color lookup table.

Returns:
currently used color lookup table

setCLUT

public void setCLUT(ImageCLUT newValue)
Sets color lookup table.

Parameters:
newValue - new color lookup table

setColorMap

public void setColorMap(ColorMap newValue)
Updates the currently used false color map.

Parameters:
newValue - - new color map to use

getColorMap

public ColorMap getColorMap()
returns the currently used false color map to outside world.

Returns:
currently used false color map

setImageZoom

public void setImageZoom(ImageZoom newValue)
Sets image zoom

Parameters:
newValue - - new image zoom value

getImageZoom

public ImageZoom getImageZoom()
Returns image zoom.


setOverlayState

public void setOverlayState(OverlayState newValue)
Sets overlay state mode

Parameters:
newValue - - new overlay state value

getOverlayState

public OverlayState getOverlayState()
Returns overlay information state.


setHistogramEqualisation

public void setHistogramEqualisation(boolean newValue)
Sets whether or not the histogram equalization (normalization) is enabled.
After new assignment, drawing as well as repainting is enforced to update all involved parts of code so that Histogram Equalization is immediately applied to image.

Parameters:
newValue - - switch histogram equalization on (true) or off (false)

isHistogramEqualisation

public boolean isHistogramEqualisation()
returns whether histogram equalization (normalization) is currently enabled.

Returns:
true if histogram equalization is enabled, otherwise false

setHistogramMin

public void setHistogramMin(int newValue)
Sets histogram min value

Parameters:
newValue - - histogram min value

getHistogramMin

public int getHistogramMin()
returns histogram min value

Returns:
histogram min value

setHistogramMax

public void setHistogramMax(int newValue)
Sets histogram max value

Parameters:
newValue - - histogram max value

getHistogramMax

public int getHistogramMax()
returns histogram max value

Returns:
histogram max value

setAOIZoom

public void setAOIZoom(boolean aoiZoom)
Switches 'AOI zoom' on or off. This method will do nothing if the AOI zoom mode is already in the state about to be set. Repainting is enforced to have an immediate update.

Parameters:
aoiZoom - - enable (true) or disable (false) AOI zooming

isAOIZoom

public boolean isAOIZoom()
returns whether out zooming of AOI (no black border around AOI which depicts full frame) is currently enabled.

Returns:
true - AOI Zoom is switched on
false - AOI Zoom is switched off

setKeepAspectRatio

public void setKeepAspectRatio(boolean keepAspectRatio)
Switches 'aspect ratio is kept' on or off. This method will do nothing if the aspect ratio mode is already in the state about to be set. Repainting is enforced to have an immediate update.

Parameters:
keepAspectRatio - - enable (true) or disable (false) keeping of aspect ratio

isKeepAspectRatio

public boolean isKeepAspectRatio()
returns whether 'aspect ratio is kept' is currently enabled.

Returns:
true - 'aspect ratio is kept' is switched on
false - 'aspect ratio is kept' is switched off

setLiveTransfer

public void setLiveTransfer(boolean aLive)
informs the displayer that a lot of frames are constantly to be drawn(true) or it is not very likely that a lot of frames are drawn (timeout on transfer or stop mode). The method was invented for performance reasons. When a lot of frames are coming in each second it can be a very time-consuming process for Java. In order to off-load some performance, certain Java-scheduled redrawing of the component is disabled because it is redrawn with each new video image coming in anyhow.

Parameters:
aLive -
  • true: live mode is set, a lot of frames are expected
  • false: either live mode was stopped or timeout happened

resetForReceiving

public void resetForReceiving()
resets important internal parameters. This method must be called from outside (e.g. image provider like TineHandler) in order to prepare the displayer for a new chunk of subsequent images.

Specified by:
resetForReceiving in interface TineImageReceiver

updateValue

public void updateValue(de.desy.tine.types.IMAGE ti)
passes/injects a new image into image processing, drawing and redrawing pipeline. Uses thread locking for proper synchronization. Drawing and Displaying is done inside invoked Swing thread.

Specified by:
updateValue in interface TineImageReceiver
Parameters:
ti - new TINE image

getSnapshotImage

public java.awt.image.BufferedImage getSnapshotImage()
Takes a snapshot of the currently displayed image. TODO: mdavid

Returns:
a snapshot of the current image

saveAsPNGImage

public boolean saveAsPNGImage(java.lang.String fileNamePath)
Saves the currently displayed image as archival PNG file.

Parameters:
fileNamePath - Filename of PNG file with extension, may include path
Returns:
false if an error occurs during writing, otherwise true

exportToPNG

public boolean exportToPNG(java.lang.String fileNamePath)
Exports the currently displayed image as exported PNG file.

Parameters:
fileNamePath - Filename of PNG file with extension, may include path
Returns:
false if an error occurs during writing, otherwise true

setExceptionListener

public void setExceptionListener(java.beans.ExceptionListener exceptionListener)
Sets an exception listener for this ImageDisplayer.

Parameters:
exceptionListener - - the exception listener

getExceptionListener

public java.beans.ExceptionListener getExceptionListener()
Gets the ExceptionListener object for this ImageDisplayer.

Returns:
the ExceptionListener for this ImageDisplayer


Copyright © 2010. All Rights Reserved.