|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.awt.Component java.awt.Container java.awt.Panel ImageScroller
public class ImageScroller
ImageScroller class supports a scrollable image for the Left and right images. It is also used for the top flicker window with scrolling disabled. It acquires an image and has a text-title, image canvas, horizontal and vertical scroll bars, and delay scrollbar (for flickering). The ImageScroller is generally created as part of the GUI before the image has been loaded. Therefore, we need to do several setXXXX() fct calls after the image has been loaded to tell the ImageScroller "stuff" it will need.
This work was produced by Peter Lemkin of the National Cancer Institute, an agency of the United States Government. As a work of the United States Government there is no associated copyright. It is offered as open source software under the Mozilla Public License (version 1.1) subject to the limitations noted in the accompanying LEGAL file. This notice must be included with the code. The Flicker Mozilla and Legal files are available on http://open2dprot.sourceforge.net/Flicker
Nested Class Summary |
---|
Nested classes/interfaces inherited from class java.awt.Panel |
---|
java.awt.Panel.AccessibleAWTPanel |
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 | |
---|---|
(package private) java.awt.Adjustable |
aH
deals with scroller events |
(package private) java.awt.Adjustable |
aV
deals with scroller events |
(package private) BrightnessContrastFilter |
bcImgF
Instance of Brightness/Contrast Filter. |
java.awt.Scrollbar |
delayBar
opt. |
javax.swing.JLabel |
delayLabel
opt. |
java.awt.Panel |
dPanel
opt. |
private Flicker |
flk
|
int |
guardHeight
size of top & bottom guard region |
int |
guardImgHeight
size of img with guard region |
int |
guardImgWidth
size of img with guard region |
boolean |
guardRegionFlag
guard region flag |
int |
guardWidth
size of right & left guard region |
ImageData |
iData
Image data for mapGraytoOD[] that will be set later... |
boolean |
img_selectedFlag
set if xObj,yObj is set |
int |
isHeight
height of image from iData.iHeight or zoomed data |
int |
isWidth
width of image from iData.iWidth or zoomed data |
static java.lang.String |
lastISName
last image scroller - used in new operation "flicker", "left", "right" |
java.lang.String |
name
obj name "left", "right" or "both". |
java.lang.String |
oGifFileName
Name of GIF file used in "SaveAs" of oImg to local GIF file |
(package private) int |
oldIHeight
calc ScrollPostions |
(package private) int |
oldIWidth
calc ScrollPostions |
int |
pagestep
thickness of scroller |
int |
preferredHeight
preferred height of canvas |
int |
preferredWidth
preferred width of canvas |
(package private) boolean |
repackFlag
|
(package private) java.awt.Point |
scrollPos
keep track of ScrollPostions |
ScrollableImageCanvas |
siCanvas
pointer to the associated image canvas |
java.awt.Panel |
southPanel
opt. |
(package private) java.awt.ScrollPane |
sp
scroller for the canvas, siCanvas |
SliderState |
state
SliderState threshold parameters associated with the image |
int |
steps
prewired scroller steps |
java.lang.String |
title
current title for image scroller associated with iData |
java.awt.TextField |
txtField
image title placed above canvas |
(package private) boolean |
useScrollBarsFlag
create and use scrollers flag |
private Util |
util
|
(package private) int |
xObj
X cursor position mapped to image |
(package private) int |
yObj
Y cursor position mapped to image |
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 | |
---|---|
ImageScroller(Flicker flk,
java.lang.String name,
java.lang.String title,
ImageData iData,
int preferredWidth,
int preferredHeight,
int def_delay,
int min_delay,
int max_delay,
boolean useScrollBarsFlag)
ImageScroller() - constructor. |
Method Summary | |
---|---|
void |
addGuardRegion(boolean guardRegionFlag)
addGuardRegion() - set up siCanvas for guard region |
void |
adjustmentValueChanged(java.awt.event.AdjustmentEvent e)
adjustmentValueChanged() - handle ImageScroller scroll events. |
void |
clearLandmarkTextListToDraw()
clearLandmarkTextListToDraw() - disable text list of things to draw in canvas. |
java.lang.String |
cvFeatures2str(java.lang.String imgFile)
cvFeatures2str() - cvt object features to printable string |
void |
drawImageTitle()
drawImageTitle() - draw title in image. |
void |
finishMeasurement()
finishMeasurement() - finish measurement and compute features |
java.awt.Color[] |
getColorText()
getColorText() - text list items colors |
int |
getDelay()
getDelay() - get the Image delay time |
java.awt.Font[] |
getFontText()
getFontText() - get text list fonts |
java.awt.Dimension |
getGuardRegionDimension(double mag)
getGuardRegionDimension() - return guard size |
java.awt.Point |
getImgCursor()
getImgCursor() - get the (x,y) scrollable cursor for this image If there is no cursor, then return (0,0). |
java.awt.Point |
getImgCursorMax()
getImgCursorMax() - get the (x,y) scrollable cursor Maximum for image If there is no cursor, then return (0,0). |
java.awt.Point |
getImgPosition()
getImgPosition() - get the Image position. |
int |
getMaxScrollBarHeight()
getMaxScrollBarHeight() - return scroll max height |
int |
getMaxScrollBarWidth()
getMaxScrollBarWidth() - return scroll max width |
int |
getNbrTextItems()
getNbrTextItems() - return actual number of text items to display |
java.awt.Point |
getObjPosition()
getObjPosition() - get the object position. |
java.awt.Dimension |
getPreferredSize()
getPreferredSize() - getPreferredSize, needed for sizing canvas and ScrollPane correctly. |
int |
getScrollbarHeight()
getScrollBarHeight() - return scroll height position |
int |
getScrollbarWidth()
getScrollBarWidth() - return scroll width position |
java.awt.Point |
getScrollPosition()
getScrollPosition() - return scroll positions |
java.lang.String[] |
getText()
getText() - text list items |
boolean |
getValidFeaturesFlag()
getValidFeaturesFlag() - get the valid features set after measurement |
int |
getXObjPosition()
getXObjPosition() - get the X object position. |
int[] |
getXText()
getXText() - x text list items positions |
int |
getYObjPosition()
getYObjPosition() - get the X object position. |
int[] |
getYText()
getYText() - y text list items positions |
void |
paint(java.awt.Graphics g)
paintComponent() - repaint scrollable canvas in region defined by scroll bars |
void |
paintSiCanvas()
paintSiCanvas() - paint the scrollable canvas using thread safe method in one place. |
boolean |
processBCimage(ImageData id)
processBCimage() - process colormap image by running the filter. |
void |
resizeImageCanvas(java.awt.Image img,
int newWidth,
int newHeight,
double mag)
resizeImageCanvas() - Reset Image, used in zoom and dezoom. |
void |
saveAsOverlayFile(java.lang.String saveAsImgFile)
saveAsOverlayFile() - save repainted image as GIF file |
(package private) boolean |
saveOImgAsGifFile(java.lang.String defGifFile,
boolean promptForFileFlag)
saveOImgAsGifFile() - save the oImg into a Gif image file in the < userDir >/tmp/. |
void |
setBndState(boolean bndOpenFlag)
setBndState() - set the boundary state in the imageCanvas |
void |
setCanvasSize(int size)
setCanvasSize() - change the size of this Canvas. |
void |
setCanvasSize(int preferredWidth,
int preferredHeight)
setCanvasSize() - change the size of this Canvas. |
void |
setcurrentIS(ImageScroller currentIS)
setcurrentIS() - set the currentIS, used when flickering |
void |
setGuardRegion(int newImgWidth,
int newImgHeight,
double zoomMag)
setGuardRegion() - force siCanvas to create guard region |
void |
setImageData(ImageData iData)
setImageData() - change the ImageData for the panel. |
void |
setImageData(ImageData iData,
java.awt.Point xyImg)
setImageData() - change the ImageData for the panel. |
void |
setImgPosition(int xImg,
int yImg)
setImgPosition() - set the Image position. |
void |
setImgPosition(java.awt.Point xyImg)
setImgPosition() - set the Image position. |
void |
setLandmarksTextListToDraw(int nTextItems,
java.awt.Color[] color_text,
java.lang.String[] text,
java.awt.Font[] font_text,
int[] x_text,
int[] y_text)
setLandmarksTextListToDraw() - set text list including color and position. |
void |
setObjPosition(int xObj,
int yObj)
setObjPosition() - set the object position. |
void |
setObjPosition(java.awt.Point xyObj)
setObjPosition() - set the object position. |
void |
setTitle(java.lang.String title,
boolean saveTitleFlag)
setTitle() - change the title for the panel. |
void |
startMeasurement(java.lang.String measType)
startMeasurement() - start measurement of object. |
void |
textValueChanged(java.awt.event.TextEvent e)
textValueChanged() - process text change events in image title text area NOTE: this is DEPRICATED! |
void |
update(java.awt.Graphics g)
update() - update without background the scrollable canvas |
(package private) void |
updateClickableCanvas()
updateClickableCanvas() - perform canvas update operations invoked by various controls |
Methods inherited from class java.awt.Panel |
---|
addNotify, getAccessibleContext |
Methods inherited from class java.awt.Container |
---|
add, add, add, add, add, addContainerListener, addImpl, 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, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, paramString, preferredSize, print, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, removeNotify, setComponentZOrder, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, 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, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, 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 |
Field Detail |
---|
private Flicker flk
private Util util
public static java.lang.String lastISName
public ImageData iData
public int isWidth
public int isHeight
public SliderState state
public ScrollableImageCanvas siCanvas
public java.awt.Panel southPanel
public java.awt.Panel dPanel
public javax.swing.JLabel delayLabel
public java.awt.Scrollbar delayBar
public java.awt.TextField txtField
public int preferredWidth
public int preferredHeight
public int steps
public int pagestep
public boolean img_selectedFlag
boolean useScrollBarsFlag
boolean repackFlag
public java.lang.String oGifFileName
public java.lang.String name
public java.lang.String title
java.awt.ScrollPane sp
java.awt.Adjustable aH
java.awt.Adjustable aV
java.awt.Point scrollPos
int oldIWidth
int oldIHeight
BrightnessContrastFilter bcImgF
int xObj
int yObj
public boolean guardRegionFlag
public int guardWidth
public int guardHeight
public int guardImgWidth
public int guardImgHeight
Constructor Detail |
---|
public ImageScroller(Flicker flk, java.lang.String name, java.lang.String title, ImageData iData, int preferredWidth, int preferredHeight, int def_delay, int min_delay, int max_delay, boolean useScrollBarsFlag)
flk
- is instance of flickername
- title
- iData
- is current ImageData iData - this may change for
flicker Image ScrollerpreferredWidth
- is size of canvaspreferredHeight
- def_delay
- is Flicker delay scroll bar valuesmin_delay
- max_delay
- useScrollBarsFlag
- Method Detail |
---|
public void setGuardRegion(int newImgWidth, int newImgHeight, double zoomMag)
newImgWidth
- new image widthnewImgHeight
- new image heightzoomMag
- magification factorpublic void addGuardRegion(boolean guardRegionFlag)
guardRegionFlag
- boolean to turn on/off guard regionpublic java.awt.Dimension getGuardRegionDimension(double mag)
public void resizeImageCanvas(java.awt.Image img, int newWidth, int newHeight, double mag)
img
- is the image to set to be drawnnewWidth
- tof the canvasnewHeight
- tof the canvasmage
- of the canvaspublic java.awt.Dimension getPreferredSize()
getPreferredSize
in class java.awt.Container
public void setCanvasSize(int size)
size
- is new sizepublic void setCanvasSize(int preferredWidth, int preferredHeight)
preferredWidth
- is new widthpreferredHeight
- is new heightpublic void setImageData(ImageData iData)
iData
- is Image datapublic void setImageData(ImageData iData, java.awt.Point xyImg)
iData
- is Image dataxyImg
- is the position of the image in the scrollable canvaspublic void setTitle(java.lang.String title, boolean saveTitleFlag)
title
- to usesaveTitleFlag
- if keep title changepublic int getDelay()
public void setImgPosition(java.awt.Point xyImg)
xyImg
- is current image positionpublic void setImgPosition(int xImg, int yImg)
xImg
- is current image positionyImg
- is current image positionpublic java.awt.Point getImgPosition()
public void setObjPosition(java.awt.Point xyObj)
xyObj
- is object positionpublic void setObjPosition(int xObj, int yObj)
xObj
- is object positionyObj
- is object positionpublic void setcurrentIS(ImageScroller currentIS)
currentIS
- is current ImageScroller (right or left)public java.awt.Point getObjPosition()
public int getXObjPosition()
public int getYObjPosition()
public java.awt.Point getScrollPosition()
public int getScrollbarWidth()
public int getScrollbarHeight()
public int getMaxScrollBarWidth()
public int getMaxScrollBarHeight()
public void setBndState(boolean bndOpenFlag)
bndOpenFlag
- open/close boundary state flagpublic boolean getValidFeaturesFlag()
public void startMeasurement(java.lang.String measType)
measType
- type specified as "Quant" or "Bkgrd"public void finishMeasurement()
public java.lang.String cvFeatures2str(java.lang.String imgFile)
imgFile
- to display
public void setLandmarksTextListToDraw(int nTextItems, java.awt.Color[] color_text, java.lang.String[] text, java.awt.Font[] font_text, int[] x_text, int[] y_text)
nTextItems
- is the number of text itemscolor_text
- is list of text label colorstext
- is list of text labelsfont_text
- is list of fonts of labelsx_text
- is list of x coordinates of labelsy_text
- is list of y coordinates of labelspublic void clearLandmarkTextListToDraw()
public int getNbrTextItems()
public java.awt.Color[] getColorText()
public java.lang.String[] getText()
public java.awt.Font[] getFontText()
public int[] getXText()
public int[] getYText()
public boolean processBCimage(ImageData id)
id
- is the ImageData to get the image to process
public void drawImageTitle()
public java.awt.Point getImgCursor()
public java.awt.Point getImgCursorMax()
void updateClickableCanvas()
public void adjustmentValueChanged(java.awt.event.AdjustmentEvent e)
adjustmentValueChanged
in interface java.awt.event.AdjustmentListener
e
- is adjustment event for scroll barspublic void textValueChanged(java.awt.event.TextEvent e)
textValueChanged
in interface java.awt.event.TextListener
e
- is text eventpublic void saveAsOverlayFile(java.lang.String saveAsImgFile)
saveAsImgFile
- is full path name of the GIF file to writeboolean saveOImgAsGifFile(java.lang.String defGifFile, boolean promptForFileFlag)
defGifFile
- is the full path GIF output filepromptForFileFlag
- if want to have user overide file name
Component.repaint()
public void paintSiCanvas()
public void update(java.awt.Graphics g)
update
in class java.awt.Container
g
- is graphics contextpublic void paint(java.awt.Graphics g)
paint
in class java.awt.Container
g
- is graphics context
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |