CADI.Viewer.Util
Class ThresholdsAndColorMaps

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by java.awt.Window
              extended by java.awt.Frame
                  extended by javax.swing.JFrame
                      extended by CADI.Viewer.Util.ThresholdsAndColorMaps
All Implemented Interfaces:
java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants

public class ThresholdsAndColorMaps
extends javax.swing.JFrame

Version:
1.0 2008/11/10
Author:
Group on Interactive Coding of Images (GICI)
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JFrame
javax.swing.JFrame.AccessibleJFrame
 
Nested classes/interfaces inherited from class java.awt.Frame
java.awt.Frame.AccessibleAWTFrame
 
Nested classes/interfaces inherited from class java.awt.Window
java.awt.Window.AccessibleAWTWindow
 
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
private  javax.swing.JButton acceptButton
           
private  java.text.NumberFormat amountFormat
           
private  javax.swing.JButton applyButton
           
private  javax.swing.JPanel buttonsPane
           
private  javax.swing.JButton cancelButton
           
private  javax.swing.JCheckBox[] checkBoxHistogramOperations
           
private static int DIALOG_HEIGHT
          Peferences frame height
private static int DIALOG_WIDTH
          Peferences frame width
private  javax.swing.JPanel formPane
           
(package private)  int[][] histogram
           
private  javax.swing.JPanel histogramPane
           
(package private)  float[][][] image
           
private  ImageData imageData
          Reference to the container of the displayed image.
private  java.awt.Container jFramePane
           
private  javax.swing.JPanel mainPane
           
private  javax.swing.Box maxThresholdAbsoluteBox
           
private  javax.swing.JFormattedTextField maxThresholdAbsoluteField
           
private  javax.swing.Box maxThresholdBox
           
private  javax.swing.Box maxThresholdPercentBox
           
private  javax.swing.JTextField maxThresholdPercentField
           
(package private)  int maxvalue
           
private  javax.swing.Box minThresholdAbsoluteBox
           
private  javax.swing.JTextField minThresholdAbsoluteField
           
private  javax.swing.Box minThresholdBox
           
private  javax.swing.Box minThresholdPercentBox
           
private  javax.swing.JFormattedTextField minThresholdPercentField
           
(package private)  int minvalue
           
private  java.lang.Object obj
          Class where the invocated method is.
private  javax.swing.JFrame owner
          Reference to the parent object.
private  java.lang.reflect.Method rePaintImage
          Method to invoke a repaint of the displayed image.
private static long serialVersionUID
           
private  javax.swing.JSlider sl1
           
private  javax.swing.JSlider sl2
           
private  javax.swing.JPanel sliderPane
           
private  javax.swing.JPanel thresholdsPane
           
private static java.lang.String TITLE
          Peferences frame title
private  javax.swing.JCheckBox xMaxCheck
           
private  javax.swing.JTextField xMaxField
           
private  javax.swing.JCheckBox xMinCheck
           
private  javax.swing.JTextField xMinField
           
private  javax.swing.JCheckBox yMaxCheck
           
private  javax.swing.JTextField yMaxField
           
private  javax.swing.JCheckBox yMinCheck
           
private  javax.swing.JTextField yMinField
           
 
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
ThresholdsAndColorMaps()
          Constructor.
ThresholdsAndColorMaps(javax.swing.JFrame owner, ImageData imageData, java.lang.Object obj, java.lang.reflect.Method rePaintImage)
          Constructor.
 
Method Summary
private  int[][] calculateCumulativeHistogram(float[][][] image)
          Computes the cumulative histogram of an image.
private  int[][] calculateHistogram(float[][][] image)
          This method computes the historgram of an image.
private  void contrastStretching(float[][][] image, int minOutputRange, int maxOutputRange)
          Adjust an image to its available dynamic range.
private  javax.swing.JPanel createFormPane()
           
private  javax.swing.JPanel createHistogramOperations(int width, int height)
           
private  javax.swing.JPanel createPane()
           
private  javax.swing.JPanel createSliderPane()
           
private  javax.swing.JPanel createThresholdsPane(int width, int height)
           
private  void equalizeImage(float[][][] image)
          Equalizes the image.
private  void paintGradient(java.awt.Graphics2D g2, int x1, int y1, int x2, int y2)
           
 void printHistogram(int[][] hist, java.awt.Graphics g)
           
 void streching(int max, int min, float[][][] image)
           
private  void testLino()
           
private  void thresholdImage(float[][][] image, int xMin, int yMin, int xMax, int yMax)
           
 
Methods inherited from class javax.swing.JFrame
addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
 
Methods inherited from class java.awt.Frame
addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setCursor, setExtendedState, 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, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOwnedWindows, getOwner, getOwnerlessWindows, getToolkit, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isShowing, pack, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setVisible, 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, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paint, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, 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, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, 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, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, 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, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, setBackground, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.awt.MenuContainer
getFont, postEvent
 

Field Detail

serialVersionUID

private static final long serialVersionUID
See Also:
Constant Field Values

DIALOG_WIDTH

private static final int DIALOG_WIDTH
Peferences frame width

See Also:
Constant Field Values

DIALOG_HEIGHT

private static final int DIALOG_HEIGHT
Peferences frame height

See Also:
Constant Field Values

TITLE

private static final java.lang.String TITLE
Peferences frame title

See Also:
Constant Field Values

owner

private javax.swing.JFrame owner
Reference to the parent object.


obj

private java.lang.Object obj
Class where the invocated method is.


imageData

private ImageData imageData
Reference to the container of the displayed image.


rePaintImage

private java.lang.reflect.Method rePaintImage
Method to invoke a repaint of the displayed image.


jFramePane

private java.awt.Container jFramePane

mainPane

private javax.swing.JPanel mainPane

formPane

private javax.swing.JPanel formPane

histogramPane

private javax.swing.JPanel histogramPane

thresholdsPane

private javax.swing.JPanel thresholdsPane

maxThresholdBox

private javax.swing.Box maxThresholdBox

minThresholdBox

private javax.swing.Box minThresholdBox

maxThresholdPercentBox

private javax.swing.Box maxThresholdPercentBox

minThresholdPercentBox

private javax.swing.Box minThresholdPercentBox

maxThresholdAbsoluteBox

private javax.swing.Box maxThresholdAbsoluteBox

minThresholdAbsoluteBox

private javax.swing.Box minThresholdAbsoluteBox

maxThresholdPercentField

private javax.swing.JTextField maxThresholdPercentField

minThresholdPercentField

private javax.swing.JFormattedTextField minThresholdPercentField

maxThresholdAbsoluteField

private javax.swing.JFormattedTextField maxThresholdAbsoluteField

minThresholdAbsoluteField

private javax.swing.JTextField minThresholdAbsoluteField

buttonsPane

private javax.swing.JPanel buttonsPane

acceptButton

private javax.swing.JButton acceptButton

cancelButton

private javax.swing.JButton cancelButton

applyButton

private javax.swing.JButton applyButton

sliderPane

private javax.swing.JPanel sliderPane

sl1

private javax.swing.JSlider sl1

sl2

private javax.swing.JSlider sl2

xMinField

private javax.swing.JTextField xMinField

yMinField

private javax.swing.JTextField yMinField

xMaxField

private javax.swing.JTextField xMaxField

yMaxField

private javax.swing.JTextField yMaxField

xMinCheck

private javax.swing.JCheckBox xMinCheck

xMaxCheck

private javax.swing.JCheckBox xMaxCheck

yMinCheck

private javax.swing.JCheckBox yMinCheck

yMaxCheck

private javax.swing.JCheckBox yMaxCheck

image

float[][][] image

histogram

int[][] histogram

amountFormat

private java.text.NumberFormat amountFormat

maxvalue

int maxvalue

minvalue

int minvalue

checkBoxHistogramOperations

private javax.swing.JCheckBox[] checkBoxHistogramOperations
Constructor Detail

ThresholdsAndColorMaps

public ThresholdsAndColorMaps()
Constructor.

This constructor is not allowed.


ThresholdsAndColorMaps

public ThresholdsAndColorMaps(javax.swing.JFrame owner,
                              ImageData imageData,
                              java.lang.Object obj,
                              java.lang.reflect.Method rePaintImage)
Constructor.

Parameters:
owner -
rePaintImage -
Method Detail

createPane

private javax.swing.JPanel createPane()

createHistogramOperations

private javax.swing.JPanel createHistogramOperations(int width,
                                                     int height)
Parameters:
width -
height -
Returns:

createThresholdsPane

private javax.swing.JPanel createThresholdsPane(int width,
                                                int height)
Parameters:
width -
height -
Returns:

calculateHistogram

private int[][] calculateHistogram(float[][][] image)
This method computes the historgram of an image.

Parameters:
image - a three-dimension array with the image samples.
Returns:
a bi-dimensional array with the historgram of the image. The first component is the component and the second one is the histogram for that image component.

calculateCumulativeHistogram

private int[][] calculateCumulativeHistogram(float[][][] image)
Computes the cumulative histogram of an image.

Parameters:
image -
Returns:
a bi-dimensional array with the cumulative histogram. The first index corresponds with the image component, and the second index is value of the cumulative histogram for the pixel value.

contrastStretching

private void contrastStretching(float[][][] image,
                                int minOutputRange,
                                int maxOutputRange)
Adjust an image to its available dynamic range.

Parameters:
image -
minOutputRange -
maxOutputRange -

equalizeImage

private void equalizeImage(float[][][] image)
Equalizes the image.

Parameters:
image -

thresholdImage

private void thresholdImage(float[][][] image,
                            int xMin,
                            int yMin,
                            int xMax,
                            int yMax)
Parameters:
image -
xMin -
yMin -
xMax -
yMax -

createFormPane

private javax.swing.JPanel createFormPane()

createSliderPane

private javax.swing.JPanel createSliderPane()

paintGradient

private void paintGradient(java.awt.Graphics2D g2,
                           int x1,
                           int y1,
                           int x2,
                           int y2)
Parameters:
g2 -
x1 -
y1 -
x2 -
y2 -

printHistogram

public void printHistogram(int[][] hist,
                           java.awt.Graphics g)

streching

public void streching(int max,
                      int min,
                      float[][][] image)

testLino

private void testLino()


CADI - Copyright (C) 2007
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

Group on Interactive Coding of Images (GICI) (contact)