uk.ac.essex.ia.imageview.pane
Class ImageViewerOpImage

java.lang.Object
  extended by java.util.Observable
      extended by uk.ac.essex.ia.imageview.pane.ImageViewerOpImage
All Implemented Interfaces:
java.awt.image.RenderedImage, java.beans.PropertyChangeListener, java.util.EventListener, Focusable, ImageViewerConstants
Direct Known Subclasses:
IVDicomOpImage

public class ImageViewerOpImage
extends java.util.Observable
implements java.awt.image.RenderedImage, java.beans.PropertyChangeListener, ImageViewerConstants, Focusable

A wrapper class to generate the result image of the processing chain for window/leveling, rotation and scaling.


Field Summary
protected  javax.swing.event.SwingPropertyChangeSupport changeSupport
          The property change event manager.
protected  boolean isFocused
          Indicates this image is displayed in a focused image display pane.
protected  int level
          The level value.
protected  byte[][] lut
          The look-up-table for window/leveling.
protected  int rotationAngle
          The rotation angle.
protected  java.awt.image.RenderedImage rotationResult
          The result image after rotation.
protected  java.awt.image.RenderedImage source
          The source image.
protected static int tileSize
          Cache the default tile size defined in the property file.
protected  int window
          The window value.
protected  java.awt.image.RenderedImage windowLevelResult
          The result image after window/leveling.
protected  double zoomFactor
          The zoom factor.
protected  java.awt.image.RenderedImage zoomResult
          The result image after zoom.
 
Fields inherited from interface uk.ac.essex.ia.imageview.ImageViewerConstants
allViewsCommand, annotationCommand, currentViewCommand, defaultLevel, defaultWindow, histogramCommand, largestLevel, largestWindow, levelCommand, measurementCommand, nozoom, paramSync, RESOURCE_BASE_NAME, rotationCommand, setLayoutCommand, smallestLevel, smallestWindow, speedCommand, startCommand, statisticsCommand, stopCommand, windowCommand, zoomCommand
 
Constructor Summary
ImageViewerOpImage(java.awt.image.RenderedImage source, int window, int level, int angle, double zoom)
          Constructor.
 
Method Summary
 void addPropertyChangeListener(java.lang.String propertyName, java.beans.PropertyChangeListener listener)
          Add a property change listener.
 java.awt.image.WritableRaster copyData(java.awt.image.WritableRaster raster)
           
 void displayStatistics(java.awt.Shape shape, boolean b)
          Display the statistics or histogram.
protected  void firePropertyChange(java.lang.String propertyName, java.lang.Object oldValue, java.lang.Object newValue)
          Fire property change event.
 java.awt.image.ColorModel getColorModel()
           
 java.awt.image.Raster getData()
           
 java.awt.image.Raster getData(java.awt.Rectangle rect)
           
 int getHeight()
           
 int getLevel()
          Return the level value.
 int getMinTileX()
           
 int getMinTileY()
           
 int getMinX()
           
 int getMinY()
           
 int getNumXTiles()
           
 int getNumYTiles()
           
 java.lang.Object getProperty(java.lang.String name)
          The following override a group of methods from the super classes.
 java.lang.String[] getPropertyNames()
           
 int getRotationAngle()
          Return the rotation angle in degree.
 java.awt.image.SampleModel getSampleModel()
           
 java.util.Vector getSources()
          Override the getSource methods.
 java.awt.image.Raster getTile(int tileX, int tileY)
           
 int getTileGridXOffset()
           
 int getTileGridYOffset()
           
 int getTileHeight()
           
 int getTileWidth()
           
 int getWidth()
           
 int getWindow()
          Return the window value.
 double getZoomFactor()
          Return the zoom factor.
 boolean isFocused()
          Return the focus status.
 void propertyChange(java.beans.PropertyChangeEvent evt)
          Process the property change events: accepts the new parameters.
 void removePropertyChangeListener(java.lang.String propertyName, java.beans.PropertyChangeListener listener)
          Remove a property change listener.
protected  java.awt.image.RenderedImage rotationOperator(java.awt.image.RenderedImage source, int angle)
          Create the rotation result image.
protected  void setChangedAndNotify()
          This protected method fire the change event to the observers.
 void setFocused(boolean b)
          When focused, synchronize the interface to use the parameters of this image.
 void setLevel(int level)
          Set the new level value.
 void setRotation(int angle)
          Set the rotation angle.
 void setWindow(int window)
          Set the new window value.
 void setZoom(double zoom)
          Return the zoom factor.
protected  java.awt.Shape transformOnROI(java.awt.Shape shape)
          Transform the shape object to the original image coordinate system.
protected  java.awt.image.RenderedImage windowLevelOperator(java.awt.image.RenderedImage source, double low, double high)
          Create the window/level result image.
protected  java.awt.image.RenderedImage zoomOperator(java.awt.image.RenderedImage source, double zoomFactor)
          Create the zoom result image.
 
Methods inherited from class java.util.Observable
addObserver, clearChanged, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers, setChanged
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

tileSize

protected static int tileSize
Cache the default tile size defined in the property file.


source

protected java.awt.image.RenderedImage source
The source image.


window

protected int window
The window value.


level

protected int level
The level value.


zoomFactor

protected double zoomFactor
The zoom factor.


rotationAngle

protected int rotationAngle
The rotation angle.


windowLevelResult

protected java.awt.image.RenderedImage windowLevelResult
The result image after window/leveling. The current process is a chain defined as window/level, rotation, zoom.


rotationResult

protected java.awt.image.RenderedImage rotationResult
The result image after rotation.


zoomResult

protected java.awt.image.RenderedImage zoomResult
The result image after zoom.


lut

protected byte[][] lut
The look-up-table for window/leveling. It is also used in the display of histogram/statistics.


isFocused

protected boolean isFocused
Indicates this image is displayed in a focused image display pane.


changeSupport

protected javax.swing.event.SwingPropertyChangeSupport changeSupport
The property change event manager.

Constructor Detail

ImageViewerOpImage

public ImageViewerOpImage(java.awt.image.RenderedImage source,
                          int window,
                          int level,
                          int angle,
                          double zoom)
Constructor.

Parameters:
source - The source image for the win/lvl, rotation, zoom process.
window - The window value.
level - The level value.
angle - The angle in degree.
zoom - The zoom factor.
Method Detail

getZoomFactor

public double getZoomFactor()
Return the zoom factor.


getRotationAngle

public int getRotationAngle()
Return the rotation angle in degree.


getWindow

public int getWindow()
Return the window value.


getLevel

public int getLevel()
Return the level value.


setZoom

public void setZoom(double zoom)
Return the zoom factor.


setRotation

public void setRotation(int angle)
Set the rotation angle.

Parameters:
angle - The rotation angle in degree.

setWindow

public void setWindow(int window)
Set the new window value.

Parameters:
window - The new window value.

setLevel

public void setLevel(int level)
Set the new level value.

Parameters:
level - The new level value.

propertyChange

public void propertyChange(java.beans.PropertyChangeEvent evt)
Process the property change events: accepts the new parameters.

Specified by:
propertyChange in interface java.beans.PropertyChangeListener

setFocused

public void setFocused(boolean b)
When focused, synchronize the interface to use the parameters of this image.

Specified by:
setFocused in interface Focusable

isFocused

public boolean isFocused()
Return the focus status.

Specified by:
isFocused in interface Focusable

firePropertyChange

protected void firePropertyChange(java.lang.String propertyName,
                                  java.lang.Object oldValue,
                                  java.lang.Object newValue)
Fire property change event.


addPropertyChangeListener

public void addPropertyChangeListener(java.lang.String propertyName,
                                      java.beans.PropertyChangeListener listener)
Add a property change listener.


removePropertyChangeListener

public void removePropertyChangeListener(java.lang.String propertyName,
                                         java.beans.PropertyChangeListener listener)
Remove a property change listener.


displayStatistics

public void displayStatistics(java.awt.Shape shape,
                              boolean b)
Display the statistics or histogram.


transformOnROI

protected java.awt.Shape transformOnROI(java.awt.Shape shape)
Transform the shape object to the original image coordinate system.


getSources

public java.util.Vector getSources()
Override the getSource methods.

Specified by:
getSources in interface java.awt.image.RenderedImage

getProperty

public java.lang.Object getProperty(java.lang.String name)
The following override a group of methods from the super classes.

Specified by:
getProperty in interface java.awt.image.RenderedImage

getPropertyNames

public java.lang.String[] getPropertyNames()
Specified by:
getPropertyNames in interface java.awt.image.RenderedImage

getColorModel

public java.awt.image.ColorModel getColorModel()
Specified by:
getColorModel in interface java.awt.image.RenderedImage

getSampleModel

public java.awt.image.SampleModel getSampleModel()
Specified by:
getSampleModel in interface java.awt.image.RenderedImage

getWidth

public int getWidth()
Specified by:
getWidth in interface java.awt.image.RenderedImage

getHeight

public int getHeight()
Specified by:
getHeight in interface java.awt.image.RenderedImage

getMinX

public int getMinX()
Specified by:
getMinX in interface java.awt.image.RenderedImage

getMinY

public int getMinY()
Specified by:
getMinY in interface java.awt.image.RenderedImage

getNumXTiles

public int getNumXTiles()
Specified by:
getNumXTiles in interface java.awt.image.RenderedImage

getNumYTiles

public int getNumYTiles()
Specified by:
getNumYTiles in interface java.awt.image.RenderedImage

getMinTileX

public int getMinTileX()
Specified by:
getMinTileX in interface java.awt.image.RenderedImage

getMinTileY

public int getMinTileY()
Specified by:
getMinTileY in interface java.awt.image.RenderedImage

getTileWidth

public int getTileWidth()
Specified by:
getTileWidth in interface java.awt.image.RenderedImage

getTileHeight

public int getTileHeight()
Specified by:
getTileHeight in interface java.awt.image.RenderedImage

getTileGridXOffset

public int getTileGridXOffset()
Specified by:
getTileGridXOffset in interface java.awt.image.RenderedImage

getTileGridYOffset

public int getTileGridYOffset()
Specified by:
getTileGridYOffset in interface java.awt.image.RenderedImage

getTile

public java.awt.image.Raster getTile(int tileX,
                                     int tileY)
Specified by:
getTile in interface java.awt.image.RenderedImage

getData

public java.awt.image.Raster getData()
Specified by:
getData in interface java.awt.image.RenderedImage

getData

public java.awt.image.Raster getData(java.awt.Rectangle rect)
Specified by:
getData in interface java.awt.image.RenderedImage

copyData

public java.awt.image.WritableRaster copyData(java.awt.image.WritableRaster raster)
Specified by:
copyData in interface java.awt.image.RenderedImage

setChangedAndNotify

protected void setChangedAndNotify()
This protected method fire the change event to the observers.


windowLevelOperator

protected final java.awt.image.RenderedImage windowLevelOperator(java.awt.image.RenderedImage source,
                                                                 double low,
                                                                 double high)
Create the window/level result image.


rotationOperator

protected java.awt.image.RenderedImage rotationOperator(java.awt.image.RenderedImage source,
                                                        int angle)
Create the rotation result image.


zoomOperator

protected java.awt.image.RenderedImage zoomOperator(java.awt.image.RenderedImage source,
                                                    double zoomFactor)
Create the zoom result image.