Class HorizontalLineRemovalSettingsDialogBox

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--java.awt.Window
                    |
                    +--java.awt.Frame
                          |
                          +--javax.swing.JFrame
                                |
                                +--HorizontalLineRemovalSettingsDialogBox
All Implemented Interfaces:
Accessible, ActionListener, EventListener, ImageObserver, MenuContainer, RootPaneContainer, Serializable, WindowConstants

public class HorizontalLineRemovalSettingsDialogBox
extends JFrame
implements ActionListener

A dialog box that allows the user to select thresholds that control which pixels are to be selected as belonging to horizontal lines of some specified colour or combination of colour.

Parameters are chosen to set the RGB colour channel intervals that candidate pixels that could belong to the horizontal lines must fall within (including absolute 8 bit values, fraction of total level per channel and average brightness). The user may also choose to set thresholds based on maximum vertical run length and minimum horizontal run length. The Filter Pixels By checkboxes enable the user to control which of these options are used, and the text boxes allow the users to set the parameters. The filtering is performed in the same order that the Filter Pixels By options are listed, with only the pixels surviving one stage serving as candidates to the next.

Users can use the Test Thresholds button to restore the image to that of the file that was most recently loaded or saved and then cause those pixels that survive various thresholds to be superimposed on the image. Only the last n layers, as set by the Max Layers To Display text area are displayed. The pixels surviving the last stage of filtering are set to bright green, those surviving the second to last stage are set to bright orange, those surviving the third to last stage are set to blue, those survivng the fourth to last stage are set to magenta and those surviving the first stage are set to magenta. The Restore Defaults button restores the values of the settings to their hard coded values.

The Done button hides this dialogbox.

The following parameters can be set:

Min Absolute Red: the minimum red RGB channel level that a pixel must have in order to be selected as a candidate. Value must be between 0 and 255 and must be lower than the Max Absolute Red.
Max Absolute Red: the maximum red RGB channel level that a pixel must have in order to be selected as a candidate. Value must be between 0 and 255 and must be higher than the Min Absolute Red.
Min Absolute Green: the minimum green RGB channel level that a pixel must have in order to be selected as a candidate. Value must be between 0 and 255 and must be lower than the Max Absolute Green.
Max Absolute Green: the maximum green RGB channel level that a pixel must have in order to be selected as a candidate. Value must be between 0 and 255 and must be higher than the Min Absolute Green.
Min Absolute Blue: the minimum blue RGB channel level that a pixel must have in order to be selected as a candidate. Value must be between 0 and 255 and must be lower than the Max Absolute Blue.
Max Absolute Blue: the maximum blue RGB channel level that a pixel must have in order to be selected as a candidate. Value must be between 0 and 255 and must be higher than the Min Absolute Blue.
Min Red Percentage: the minimum percentage of the total RGB levels represented by the red channel level that a pixel must have in order to be selected as a candidate. Value must be between 0.0 and 100.0 and must be lower than the Red Blue Percentage.
Max Red Percentage: the maximum percentage of the total RGB levels represented by the red channel level that a pixel must have in order to be selected as a candidate. Value must be between 0.0 and 100.0 and must be higher than the Min Red Percentage.
Min Green Percentage: the minimum percentage of the total RGB levels represented by the green channel level that a pixel must have in order to be selected as a candidate. Value must be between 0.0 and 100.0 and must be lower than the Green Blue Percentage.
Max Green Percentage: the maximum percentage of the total RGB levels represented by the green channel level that a pixel must have in order to be selected as a candidate. Value must be between 0.0 and 100.0 and must be higher than the Min Green Percentage.
Min Blue Percentage: the minimum percentage of the total RGB levels represented by the blue channel level that a pixel must have in order to be selected as a candidate. Value must be between 0.0 and 100.0 and must be lower than the Max Blue Percentage.
Max Blue Percentage: the maximum percentage of the total RGB levels represented by the blue channel level that a pixel must have in order to be selected as a candidate. Value must be between 0.0 and 100.0 and must be higher than the Min Blue Percentage.
Min Brightness: the minimum average level of the three RGB channels that a pixel must have in order to be selected as a candidate. Value must be between 0.0 and 255.0 and must be lower than the Max Brightness.
Max Brightness: the maximum average level of the three RGB channels that a pixel may have in order to be selected as a candidate. Value must be between 0.0 and 255.0 and must be higher than the Min Brightness.
Max Vertical Run Length: the maximum number of consecutive vertical pixels selected by the previous threshold filtering that are acceptable in order for pixels to be considered part of a horizontal line.
Min Horizontal Run Length: the minimum number of consecutive horizontal pixels selected by the previous threshold filtering that are acceptable in order for pixels to be considered part of a horizontal line.
Filter Pixels By: which types of threshold filtering to apply.
Max Layers To Display: the maximum number of filtering layers that are to be displayed when the Test Threshold button is pressed. If more than this number of layers are selected with the Filter Pixels By checkbox, then only the last one(s) are displayed.

These parameters can be accessed by other objects through this class' get methods.

See Also:
Serialized Form
Author:
Cory McKay

Field Summary
 
Fields inherited from class javax.swing.JFrame
accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
 
Fields inherited from class java.awt.Frame
CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface javax.swing.WindowConstants
DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
HorizontalLineRemovalSettingsDialogBox(MainFrame parent)
          Basic constructor.
 
Method Summary
 void actionPerformed(ActionEvent event)
          Calls the appropriate methods when the buttons are pressed.
 boolean[] getFiltersToUse()
          Returns a boolean array whose:
 int getHighBlueThreshold()
          Returns the value of high blue detection threshold, as entered in the text field.
 int getHighGreenThreshold()
          Returns the value of high green detection threshold, as entered in the text field.
 int getHighRedThreshold()
          Returns the value of high red detection threshold, as entered in the text field.
 int getHorizontalRunLengthThreshold()
          Returns the value of horizontal run length threshold, as entered in the text field.
 int getLayersToDisplay()
          Returns the maximum number of layers to display when the Test Thresholds button is pressed, as entered in the text field.
 int getLowBlueThreshold()
          Returns the value of low blue detection threshold, as entered in the text field.
 int getLowGreenThreshold()
          Returns the value of low green detection threshold, as entered in the text field.
 int getLowRedThreshold()
          Returns the value of low red detection threshold, as entered in the text field.
 double getMaxBluePercentageThreshold()
          Returns the value of maximum blue percentage threshold, as entered in the text field.
 double getMaxBrightnessThreshold()
          Returns the value of maximum brightness threshold, as entered in the text field.
 double getMaxGreenPercentageThreshold()
          Returns the value of maximum green percentage threshold, as entered in the text field.
 double getMaxRedPercentageThreshold()
          Returns the value of maximum red percentage threshold, as entered in the text field.
 double getMinBluePercentageThreshold()
          Returns the value of minimum blue percentage threshold, as entered in the text field.
 double getMinBrightnessThreshold()
          Returns the value of minimum brightness threshold, as entered in the text field.
 double getMinGreenPercentageThreshold()
          Returns the value of minimum green percentage threshold, as entered in the text field.
 double getMinRedPercentageThreshold()
          Returns the value of minimum red percentage threshold, as entered in the text field.
 int getVerticalRunLengthThreshold()
          Returns the value of vertical run length threshold, as entered in the text field.
 
Methods inherited from class javax.swing.JFrame
addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getJMenuBar, getLayeredPane, getRootPane, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, update
 
Methods inherited from class java.awt.Frame
addNotify, finalize, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setCursor, setExtendedState, setIconImage, setMaximizedBounds, setMenuBar, setResizable, setState, setTitle, setUndecorated
 
Methods inherited from class java.awt.Window
addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getGraphicsConfiguration, getInputContext, getListeners, getLocale, getMostRecentFocusOwner, getOwnedWindows, getOwner, getToolkit, getWarningString, getWindowFocusListeners, getWindowListeners, getWindowStateListeners, hide, isActive, isFocusableWindow, isFocusCycleRoot, isFocused, isShowing, pack, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, setCursor, setFocusableWindowState, setFocusCycleRoot, setLocationRelativeTo, show, toBack, toFront
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paint, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setFocusTraversalKeys, setFocusTraversalPolicy, setFont, 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, getBackground, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isOpaque, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, 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, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.awt.MenuContainer
getFont, postEvent
 

Constructor Detail

HorizontalLineRemovalSettingsDialogBox

public HorizontalLineRemovalSettingsDialogBox(MainFrame parent)
Basic constructor. Configures the panel and sets its fields to defaults.

Parameters:
parent - Name of the MainFrame window that spawned this dialog box.
Method Detail

actionPerformed

public void actionPerformed(ActionEvent event)
Calls the appropriate methods when the buttons are pressed.

Specified by:
actionPerformed in interface ActionListener
Parameters:
event - The event that is to be reacted to.

getLowRedThreshold

public int getLowRedThreshold()
Returns the value of low red detection threshold, as entered in the text field.


getHighRedThreshold

public int getHighRedThreshold()
Returns the value of high red detection threshold, as entered in the text field.


getLowGreenThreshold

public int getLowGreenThreshold()
Returns the value of low green detection threshold, as entered in the text field.


getHighGreenThreshold

public int getHighGreenThreshold()
Returns the value of high green detection threshold, as entered in the text field.


getLowBlueThreshold

public int getLowBlueThreshold()
Returns the value of low blue detection threshold, as entered in the text field.


getHighBlueThreshold

public int getHighBlueThreshold()
Returns the value of high blue detection threshold, as entered in the text field.


getMinRedPercentageThreshold

public double getMinRedPercentageThreshold()
Returns the value of minimum red percentage threshold, as entered in the text field.


getMaxRedPercentageThreshold

public double getMaxRedPercentageThreshold()
Returns the value of maximum red percentage threshold, as entered in the text field.


getMinGreenPercentageThreshold

public double getMinGreenPercentageThreshold()
Returns the value of minimum green percentage threshold, as entered in the text field.


getMaxGreenPercentageThreshold

public double getMaxGreenPercentageThreshold()
Returns the value of maximum green percentage threshold, as entered in the text field.


getMinBluePercentageThreshold

public double getMinBluePercentageThreshold()
Returns the value of minimum blue percentage threshold, as entered in the text field.


getMaxBluePercentageThreshold

public double getMaxBluePercentageThreshold()
Returns the value of maximum blue percentage threshold, as entered in the text field.


getMinBrightnessThreshold

public double getMinBrightnessThreshold()
Returns the value of minimum brightness threshold, as entered in the text field.


getMaxBrightnessThreshold

public double getMaxBrightnessThreshold()
Returns the value of maximum brightness threshold, as entered in the text field.


getVerticalRunLengthThreshold

public int getVerticalRunLengthThreshold()
Returns the value of vertical run length threshold, as entered in the text field.


getHorizontalRunLengthThreshold

public int getHorizontalRunLengthThreshold()
Returns the value of horizontal run length threshold, as entered in the text field.


getFiltersToUse

public boolean[] getFiltersToUse()
Returns a boolean array whose:

- first element indicates whether or not pixels that do meet the absolute RGB channel value thresholds are to be filtered
- second element indicates whether or not pixels that do not meet the RGB channel percentage thresholds are to be filtered
- third element indicates whether or not pixels that do not meet the average brightness thresholds are to be filtered
- fourth element indicates whether or not pixels that do meet the maximum vertical run length threshold are to be filtered
- fifth element indicates whether or not pixels that do meet the minimum horizontal run length are to be filtered

These settings are determined by the the Filter Pixels By checkboxes.

Returns:
The settings defined by the check boxes in this dialog box.

getLayersToDisplay

public int getLayersToDisplay()
Returns the maximum number of layers to display when the Test Thresholds button is pressed, as entered in the text field.