DESY ACOP Beans Home

de.desy.video.sw
Class ImageDisplayer

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by de.desy.video.sw.ImageDisplayer
All Implemented Interfaces:
java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable

public final class ImageDisplayer
extends java.awt.Container

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 standalone application.

Version:
$Id: Templates.xml,v 1.10 2008/06/23 14:30:13 sweisse Exp $
Author:
Stefan Weisse
See Also:
Serialized Form

Nested Class Summary
static class ImageDisplayer.ColorMap
          enum for color mapping assignment
static class ImageDisplayer.OverlayState
          Enum for overlay information
 
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
 
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()
          default constructor.
 
Method Summary
 void addMouseListener(java.awt.event.MouseListener l)
           
 void addMouseMotionListener(java.awt.event.MouseMotionListener l)
           
 void addMouseWheelListener(java.awt.event.MouseWheelListener l)
           
 ImageDisplayer.ColorMap getColorMap()
          returns the currently used false colour map to outside world.
 ImageDisplayer.OverlayState getOverlayState()
          Returns overlay information state.
 java.awt.Image getSnapshotImage()
          Takes a snapshot of the currently displayed image.
 boolean isAOIZoom()
          returns whether outzooming of AOI (no black border around AOI which depicts full frame) is currently enabled.
 boolean isFalseColorSwitchingAllowed()
          returns whether false colour switching is currently meaningful.
 boolean isHistogramEqualisationEnabled()
          returns whether histogram equalisation (normalisation) is currently enabled.
 boolean isKeepAspectRatioEnabled()
          returns whether 'aspect ratio is kept' is currently enabled.
 void resetForReceiving()
          resets important internal parameters.
 boolean saveAsPNGImage(java.lang.String fileNamePath)
          saves the currently displayed image as colour (RGB) png file.
 void setAOIZoom(boolean zoom)
          Switches 'AOI zoom' on or off.
 void setColorMap(ImageDisplayer.ColorMap map)
          updates the currently used false colour map.
 void setFalseColorSwitchingAllowed(boolean enabled)
          Switches 'false colour switching meaningfulness' on or off.
 void setHistogramEqualisationEnabled(boolean normalisation)
          Switches 'histogram equalisation' on or off.
 void setKeepAspectRatioEnabled(boolean keep)
          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(ImageDisplayer.OverlayState state)
           
 void updateValue(CVideoHeader3 aHdr)
          passes/injects a new image into image processing, drawing and redrawing pipeline.
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addNotify, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getInsets, getLayout, getListeners, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paint, paintComponents, paramString, preferredSize, print, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, removeNotify, setComponentZOrder, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, setLayout, transferFocusBackward, transferFocusDownCycle, update, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getAccessibleContext, getBackground, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setPreferredSize, setSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ImageDisplayer

public ImageDisplayer()
default constructor. Initialises parent class and calls initialize() method for local initialisation.

Method Detail

addMouseListener

public void addMouseListener(java.awt.event.MouseListener l)
Overrides:
addMouseListener in class java.awt.Component

addMouseMotionListener

public void addMouseMotionListener(java.awt.event.MouseMotionListener l)
Overrides:
addMouseMotionListener in class java.awt.Component

addMouseWheelListener

public void addMouseWheelListener(java.awt.event.MouseWheelListener l)
Overrides:
addMouseWheelListener in class java.awt.Component

setColorMap

public void setColorMap(ImageDisplayer.ColorMap map)
updates the currently used false colour map. Get/Set. This method will do nothing if the new map equals the current map for performance reasons. After new assignment, drawing is enforced to update all involved parts of code that work with or reference false colours.

Parameters:
map - new false colour map to use

getColorMap

public ImageDisplayer.ColorMap getColorMap()
returns the currently used false colour map to outside world. Get/Set.

Returns:
currently used false colour map

setOverlayState

public void setOverlayState(ImageDisplayer.OverlayState state)
Parameters:
overlay - set overlay mode always on (true) or off(false)

getOverlayState

public ImageDisplayer.OverlayState getOverlayState()
Returns overlay information state.


setHistogramEqualisationEnabled

public void setHistogramEqualisationEnabled(boolean normalisation)
Switches 'histogram equalisation' on or off. Get/Set. This method will do nothing if the histogram equalisation mode is already in the state about to be set. After new assignment, drawing as well as repainting is enforced to update all involved parts of code so that histogram equalisation is immediately applied to image.

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

isHistogramEqualisationEnabled

public boolean isHistogramEqualisationEnabled()
returns whether histogram equalisation (normalisation) is currently enabled. Get/Set.

Returns:
true - histogram equalisation is switched on
false - histogram equalisation is switched off

setAOIZoom

public void setAOIZoom(boolean zoom)
Switches 'AOI zoom' on or off. Get/Set. 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:
zoom - enable (true) or disable (false) AOI zooming

isAOIZoom

public boolean isAOIZoom()
returns whether outzooming of AOI (no black border around AOI which depicts full frame) is currently enabled. Get/Set.

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

setKeepAspectRatioEnabled

public void setKeepAspectRatioEnabled(boolean keep)
Switches 'aspect ratio is kept' on or off. Get/Set. 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:
keep - enable (true) or disable (false) keeping of aspect ratio

isKeepAspectRatioEnabled

public boolean isKeepAspectRatioEnabled()
returns whether 'aspect ratio is kept' is currently enabled. Get/Set.

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

saveAsPNGImage

public boolean saveAsPNGImage(java.lang.String fileNamePath)
saves the currently displayed image as colour (RGB) png file. An additional text file is saved beside the png file that describes full image metainformation (VSv3 header contents).

Parameters:
fileNamePath - Filename of PNG file with extension, may include path
Returns:
boolean indicating success (true) or failure (false)

setFalseColorSwitchingAllowed

public void setFalseColorSwitchingAllowed(boolean enabled)
Switches 'false colour switching meaningfulness' on or off. Get/Set. This method will do nothing if the meaningfulness of false colour switching is already in the state about to be set. Repainting is enforced to have an immediate update. The variable behind this get/set was invented to have an indication whether false colour switching is meaningful (false colour data) or not meaningful (colour data). For colour data no proper transformation to false colour is provided (usually it is not necessary simply) so false colour switching would be logically meaningless.

Parameters:
enabled -
  • true false colour switching is meaningful (allowed)
  • false switching of false colour is not meaningful (allowed)

isFalseColorSwitchingAllowed

public boolean isFalseColorSwitchingAllowed()
returns whether false colour switching is currently meaningful. Get/Set.

Returns:
true - false colour switching is meaningful (allowed)
false - false colour switching is not meaningful (allowed)

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 offload 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.


updateValue

public void updateValue(CVideoHeader3 aHdr)
passes/injects a new image into image processing, drawing and redrawing pipeline. Uses thread locking for proper synchronisation. Drawing and Displaying is done inside invoked Swing thread.

Parameters:
aHdr - new video frame (marshalled into CVideoHeader3 instance)

getSnapshotImage

public java.awt.Image getSnapshotImage()
Takes a snapshot of the currently displayed image.

Returns:
a snapshot of the current image


Copyright © 2009. All Rights Reserved.