|
|||||||||
| Home >> All >> org >> modama >> gui >> [ viewer overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
org.modama.gui.viewer
Class JAIAdjustableImage

java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
org.modama.gui.viewer.JAIAdjustableImage
- All Implemented Interfaces:
- javax.accessibility.Accessible, ICoordinatesystem, java.awt.image.ImageObserver, IViewer, java.awt.MenuContainer, java.io.Serializable
- public class JAIAdjustableImage
- extends javax.swing.JPanel
- implements IViewer
- extends javax.swing.JPanel
org.modama.viewer for JAI images
ability to move, zoom and rotating the image
its also posible to add JComponents that are drawn over the image
this is the second version of this class, new fetaeures are:
- the image is drawn with a Graphics2D object
- a AffineTransform is used to do scaling and rotating
- optional a LUT can be specified
their is one important thing about the lut, because JAI doesnt suport lookupfunctions
for floatingpointvalues, the image is transformed to USHORT if its DOUBLE or FLOAT, where the
minimum value will be 0 and the maximumvalue will be 65535, you have to take care of this when you
create a LUT for such an image
| Nested Class Summary |
| Nested classes inherited from class javax.swing.JPanel |
javax.swing.JPanel.AccessibleJPanel |
| Nested classes inherited from class javax.swing.JComponent |
javax.swing.JComponent.AccessibleJComponent |
| Nested classes inherited from class java.awt.Container |
java.awt.Container.AccessibleAWTContainer |
| Nested classes inherited from class java.awt.Component |
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy |
| Field Summary | |
protected java.awt.image.RenderedImage |
image
src image |
protected java.awt.image.Raster |
imageraster
for getting the pixelvalues the raster of the image is needed, we save this, so we dont have to do call getData twice, |
protected LookupTableJAI |
lut
a lookuptable can be specified that will be applied to the image |
protected double |
maxlutvalue
these values are used to rescale the image to USHORT values from 0 to 65535, the same range as the lut, so they represent the range of the lut |
protected double |
maxpixelvalue
smallest and biggest value of the image |
protected double |
minlutvalue
these values are used to rescale the image to USHORT values from 0 to 65535, the same range as the lut, so they represent the range of the lut |
protected double |
minpixelvalue
smallest and biggest value of the image |
protected java.awt.image.RenderedImage |
processed
processed image (after Lookuptable operation, if their is no lut, its the source image) |
protected double |
scalex
scaling factors for zooming size of the image source.width * scalex, source.height * scaley |
protected double |
scaley
scaling factors for zooming size of the image source.width * scalex, source.height * scaley |
protected TransposeType |
transpose
transposing (flip or rotate by multiples of 90) is one of the values defined in TransposeDescriptor !!!!! this is not needed at the moment so it has no effect |
protected java.awt.Point |
viewposition
position of the image (to get the sourceimage coordinat divide by scale) |
| 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.Container |
|
| 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 | |
JAIAdjustableImage()
constructors |
|
JAIAdjustableImage(java.awt.image.RenderedImage image)
constructor sets the image |
|
| Method Summary | |
void |
addCursor(org.modama.gui.viewer.cursor.EmptyCursor newcursor)
sets a new cursor and registers him as mouseinputlistener |
void |
calcLUT()
do a lookup operation on the image, if its floatingpoint, its rescaled to USHORT |
protected void |
calcMinMax()
calculates the minpixelvalue and the maxpixelvalue from the image |
java.awt.image.RenderedImage |
createThumbnail(int width)
creates a thumbnail with the given width |
protected java.awt.geom.Point2D.Double |
getCenterPoint()
gets the image point the corrosponds to the center of the displayed image |
java.awt.geom.Point2D.Double |
getCoordinate(java.awt.Point screen)
|
double |
getCoordinateX(int screenx)
|
double |
getCoordinateY(int screeny)
|
java.awt.image.RenderedImage |
getImage()
gets the image |
java.awt.image.Raster |
getImageRaster()
gets the raster for the image |
LookupTableJAI |
getLookupTable()
|
double |
getMaxLUTValue()
gets the value that corresponds to the last lookup entry |
double |
getMaxPixelValue()
|
double |
getMinLUTValue()
gets the value that corresponds to the first lookup entry |
double |
getMinPixelValue()
|
double[] |
getPixelValue(int x,
int y)
gets the value of the given pixel from the image, x and y are in sourceimage coordinates not screencoordinates |
int |
getPosx()
|
int |
getPosy()
|
java.awt.image.RenderedImage |
getProcessedImage()
returns the processed image, this is only different from getImage if a lookuptable is specified |
double |
getScalex()
|
double |
getScaley()
|
java.awt.Point |
getScreen(java.awt.geom.Point2D.Double object)
|
int |
getScreenX(double objectx)
|
int |
getScreenY(double objecty)
|
java.awt.image.RenderedImage |
getThumbnail()
gets the thumbnail, creates it, if its the first time called |
java.awt.Point |
getViewPosition()
gets the position of the image |
void |
loadParamsFromAnotherViewer(IViewer viewer)
gets the parameters from another viewer, this is usefull if the this viewer should show extactly the same as viewer |
protected void |
paintComponent(java.awt.Graphics g)
paints the image |
void |
removeAllCursors()
removes all components that are an EmptyCursor from this Container |
void |
removeCursor(org.modama.gui.viewer.cursor.EmptyCursor cursor)
removes a cursor |
protected void |
resetParams()
resets the intern parameters |
void |
setAutoScale(boolean keepproportion)
zooms the image so, it fits exactly into the panel |
void |
setImage(java.awt.image.RenderedImage image)
sets the image also resets zooming, position and transposing |
void |
setLookupTable(LookupTableJAI lut)
|
void |
setLUTValues(double minlutvalue,
double maxlutvalue)
sets the values that corresponds to the first and last lookup entry |
void |
setMaxLUTValue(double maxlutvalue)
sets the value that corresponds to the last lookup entry |
void |
setMinLUTValue(double minlutvalue)
sets the value that corresponds to the first lookup entry |
protected void |
setPointToCenter(java.awt.geom.Point2D.Double point)
moves the image so, that the point is showed in the center |
protected void |
setPreferredSize()
sets the preferred size of this container |
void |
setScale(double scalex,
double scaley)
set zoominfactors of the picture |
void |
setScalex(double scalex)
set the scaling for the x coordinates |
void |
setScaley(double scaley)
set the scaling for the y coordinates |
void |
setViewPosition(int x,
int y,
boolean keep_image_in_sight)
sets the postion of the image x and y are in pixels of the zoomed image |
void |
setViewPosition(java.awt.Point viewposition)
sets the position of the image and keeps it in sight |
void |
translate(int x,
int y,
boolean keep_image_in_sight)
translates the imageposition |
void |
transpose(TransposeType type)
transposes the image (flip or rotate by multiples of 90) the type is one of the values defined in TransposeDescriptor Transpose type : 0=FLIP_VERTICAL : 1=FLIP_HORIZONTAL : 2=FLIP_DIAGONAL : 3=FLIP_ANTIDIAGONAL : 4=ROTATE_90 : 5=ROTATE_180 : 6=ROTATE_270 type == null means no transpoing !!!!!!! this is not needed at the moment so it has no effect |
void |
zoomfit()
zooms the image so it fits into the panel |
void |
zoomin()
zooms in so that the center stays |
void |
zoomout()
zooms out |
void |
zoomreset()
zoom reset, set scale to 1 |
| Methods inherited from class javax.swing.JPanel |
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface org.modama.gui.viewer.IViewer |
getHeight, getPreferredSize, getWidth, repaint, setCursor |
| Field Detail |
image
protected java.awt.image.RenderedImage image
- src image
imageraster
protected java.awt.image.Raster imageraster
- for getting the pixelvalues the raster of the image is needed,
we save this, so we dont have to do call getData twice,
processed
protected java.awt.image.RenderedImage processed
- processed image (after Lookuptable operation, if their is no lut, its the source image)
scalex
protected double scalex
- scaling factors for zooming
size of the image source.width * scalex, source.height * scaley
scaley
protected double scaley
- scaling factors for zooming
size of the image source.width * scalex, source.height * scaley
viewposition
protected java.awt.Point viewposition
- position of the image (to get the sourceimage coordinat divide by scale)
transpose
protected TransposeType transpose
- transposing (flip or rotate by multiples of 90)
is one of the values defined in TransposeDescriptor !!!!! this is not needed at the moment so it has no effect
lut
protected LookupTableJAI lut
- a lookuptable can be specified that will be applied to the image
minpixelvalue
protected double minpixelvalue
- smallest and biggest value of the image
maxpixelvalue
protected double maxpixelvalue
- smallest and biggest value of the image
minlutvalue
protected double minlutvalue
- these values are used to rescale the image to USHORT values from 0 to 65535, the same range as the lut,
so they represent the range of the lut
maxlutvalue
protected double maxlutvalue
- these values are used to rescale the image to USHORT values from 0 to 65535, the same range as the lut,
so they represent the range of the lut
| Constructor Detail |
JAIAdjustableImage
public JAIAdjustableImage()
- constructors
JAIAdjustableImage
public JAIAdjustableImage(java.awt.image.RenderedImage image)
- constructor
sets the image
| Method Detail |
setScale
public void setScale(double scalex,
double scaley)
setAutoScale
public void setAutoScale(boolean keepproportion)
- zooms the image so, it fits exactly into the panel
- Specified by:
setAutoScalein interfaceIViewer
setScalex
public void setScalex(double scalex)
setScaley
public void setScaley(double scaley)
getScalex
public double getScalex()
getScaley
public double getScaley()
setViewPosition
public void setViewPosition(int x,
int y,
boolean keep_image_in_sight)
- sets the postion of the image
x and y are in pixels of the zoomed image
- Specified by:
setViewPositionin interfaceIViewer
getViewPosition
public java.awt.Point getViewPosition()
- gets the position of the image
- Specified by:
getViewPositionin interfaceIViewer
getPosx
public int getPosx()
getPosy
public int getPosy()
setViewPosition
public void setViewPosition(java.awt.Point viewposition)
- sets the position of the image and keeps it in sight
- Specified by:
setViewPositionin interfaceIViewer
translate
public void translate(int x,
int y,
boolean keep_image_in_sight)
transpose
public void transpose(TransposeType type)
- transposes the image (flip or rotate by multiples of 90)
the type is one of the values defined in TransposeDescriptor
Transpose type : 0=FLIP_VERTICAL
: 1=FLIP_HORIZONTAL
: 2=FLIP_DIAGONAL
: 3=FLIP_ANTIDIAGONAL
: 4=ROTATE_90
: 5=ROTATE_180
: 6=ROTATE_270
type == null means no transpoing !!!!!!! this is not needed at the moment so it has no effect
setImage
public void setImage(java.awt.image.RenderedImage image)
- sets the image
also resets zooming, position and transposing
getImage
public java.awt.image.RenderedImage getImage()
getImageRaster
public java.awt.image.Raster getImageRaster()
- gets the raster for the image
- Specified by:
getImageRasterin interfaceIViewer
getPixelValue
public double[] getPixelValue(int x,
int y)
- gets the value of the given pixel from the image, x and y are in sourceimage coordinates not screencoordinates
- Specified by:
getPixelValuein interfaceIViewer
getProcessedImage
public java.awt.image.RenderedImage getProcessedImage()
- returns the processed image, this is only different from getImage if a lookuptable is specified
- Specified by:
getProcessedImagein interfaceIViewer
getLookupTable
public LookupTableJAI getLookupTable()
- Specified by:
getLookupTablein interfaceIViewer
setLookupTable
public void setLookupTable(LookupTableJAI lut)
- Specified by:
setLookupTablein interfaceIViewer
removeAllCursors
public void removeAllCursors()
- removes all components that are an EmptyCursor from this Container
- Specified by:
removeAllCursorsin interfaceIViewer
removeCursor
public void removeCursor(org.modama.gui.viewer.cursor.EmptyCursor cursor)
- removes a cursor
- Specified by:
removeCursorin interfaceIViewer
addCursor
public void addCursor(org.modama.gui.viewer.cursor.EmptyCursor newcursor)
- sets a new cursor and registers him as mouseinputlistener
getMinPixelValue
public double getMinPixelValue()
- Specified by:
getMinPixelValuein interfaceIViewer
getMaxPixelValue
public double getMaxPixelValue()
- Specified by:
getMaxPixelValuein interfaceIViewer
getMinLUTValue
public double getMinLUTValue()
- gets the value that corresponds to the first lookup entry
- Specified by:
getMinLUTValuein interfaceIViewer
setMinLUTValue
public void setMinLUTValue(double minlutvalue)
- sets the value that corresponds to the first lookup entry
- Specified by:
setMinLUTValuein interfaceIViewer
getMaxLUTValue
public double getMaxLUTValue()
- gets the value that corresponds to the last lookup entry
- Specified by:
getMaxLUTValuein interfaceIViewer
setMaxLUTValue
public void setMaxLUTValue(double maxlutvalue)
- sets the value that corresponds to the last lookup entry
- Specified by:
setMaxLUTValuein interfaceIViewer
setLUTValues
public void setLUTValues(double minlutvalue,
double maxlutvalue)
- sets the values that corresponds to the first and last lookup entry
- Specified by:
setLUTValuesin interfaceIViewer
zoomin
public void zoomin()
zoomout
public void zoomout()
zoomreset
public void zoomreset()
zoomfit
public void zoomfit()
getThumbnail
public java.awt.image.RenderedImage getThumbnail()
- gets the thumbnail, creates it, if its the first time called
- Specified by:
getThumbnailin interfaceIViewer
createThumbnail
public java.awt.image.RenderedImage createThumbnail(int width)
- creates a thumbnail with the given width
- Specified by:
createThumbnailin interfaceIViewer
paintComponent
protected void paintComponent(java.awt.Graphics g)
- paints the image
resetParams
protected void resetParams()
- resets the intern parameters
loadParamsFromAnotherViewer
public void loadParamsFromAnotherViewer(IViewer viewer)
- gets the parameters from another viewer, this is usefull if the this viewer should show extactly the same as viewer
- Specified by:
loadParamsFromAnotherViewerin interfaceIViewer
calcMinMax
protected void calcMinMax()
- calculates the minpixelvalue and the maxpixelvalue from the image
calcLUT
public void calcLUT()
- do a lookup operation on the image, if its floatingpoint, its rescaled to USHORT
getCenterPoint
protected java.awt.geom.Point2D.Double getCenterPoint()
- gets the image point the corrosponds to the center of the displayed image
setPointToCenter
protected void setPointToCenter(java.awt.geom.Point2D.Double point)
- moves the image so, that the point is showed in the center
setPreferredSize
protected void setPreferredSize()
- sets the preferred size of this container
getCoordinateX
public double getCoordinateX(int screenx)
- Specified by:
getCoordinateXin interfaceIViewer
getCoordinateY
public double getCoordinateY(int screeny)
- Specified by:
getCoordinateYin interfaceIViewer
getCoordinate
public java.awt.geom.Point2D.Double getCoordinate(java.awt.Point screen)
- Specified by:
getCoordinatein interfaceIViewer
getScreenX
public int getScreenX(double objectx)
- Specified by:
getScreenXin interfaceIViewer
getScreenY
public int getScreenY(double objecty)
- Specified by:
getScreenYin interfaceIViewer
getScreen
public java.awt.Point getScreen(java.awt.geom.Point2D.Double object)
|
|||||||||
| Home >> All >> org >> modama >> gui >> [ viewer overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC