Class ViewImageDirectory

  • All Implemented Interfaces:
    PreviewImageContainer, java.awt.event.ActionListener, java.awt.event.ComponentListener, java.awt.event.ItemListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible, javax.swing.event.ChangeListener, javax.swing.event.TreeExpansionListener, javax.swing.event.TreeSelectionListener, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    Direct Known Subclasses:
    ViewJFrameDICOMParser

    public class ViewImageDirectory
    extends javax.swing.JFrame
    implements java.awt.event.ActionListener, java.awt.event.ComponentListener, java.awt.event.ItemListener, javax.swing.event.TreeSelectionListener, javax.swing.event.TreeExpansionListener, javax.swing.event.ChangeListener, PreviewImageContainer
    Tree of images beneath the given directory. When a user clicks on a filename, a thumbnail of the image appears, along with the header data.
    Version:
    1.0 June 1, 2002
    Author:
    Neva Cherniavsky
    See Also:
    ViewJComponentPreviewImage, Serialized Form
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      private class  ViewImageDirectory.ImageNameComparator
      DOCUMENT ME!
      • 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, java.awt.Window.Type
      • 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

      Fields 
      Modifier and Type Field Description
      private int brightness
      DOCUMENT ME!
      private javax.swing.JPanel brightPanel
      DOCUMENT ME!
      private javax.swing.JSlider brightSlider
      DOCUMENT ME!
      private float contrast
      DOCUMENT ME!
      private javax.swing.JSlider contSlider
      DOCUMENT ME!
      private javax.swing.JLabel current
      DOCUMENT ME!
      private javax.swing.JLabel current2
      DOCUMENT ME!
      private java.awt.Dimension defaultImageSize
      DOCUMENT ME!
      protected java.lang.String directory
      DOCUMENT ME!
      protected javax.swing.JTree directoryTree
      DOCUMENT ME!
      protected java.io.File file
      DOCUMENT ME!
      protected ViewImageFileFilter imageFilter
      DOCUMENT ME!
      protected javax.swing.JPanel imagePanel
      DOCUMENT ME!
      private javax.swing.JSplitPane imageSliderPane
      DOCUMENT ME!
      protected ViewJComponentPreviewImage img
      DOCUMENT ME!
      private java.text.NumberFormat nfc
      DOCUMENT ME!
      protected ViewFileTreeNode node
      DOCUMENT ME!
      private boolean openSeparate
      DOCUMENT ME!
      private javax.swing.JCheckBoxMenuItem openSeparateOption
      DOCUMENT ME!
      private int origBrightness
      DOCUMENT ME!
      private float origContrast
      DOCUMENT ME!
      private javax.swing.JLabel otherLabel
      DOCUMENT ME!
      private ViewTableModel primaryModel
      DOCUMENT ME!
      private javax.swing.JTable primaryTable
      DOCUMENT ME!
      private ViewTableModel secondaryModel
      DOCUMENT ME!
      private javax.swing.JTable secondaryTable
      DOCUMENT ME!
      private static long serialVersionUID
      Use serialVersionUID for interoperability.
      protected java.awt.Font serif12
      DOCUMENT ME!
      protected java.awt.Font serif12B
      DOCUMENT ME!
      private boolean showXMLThumbnail
      DOCUMENT ME!
      private javax.swing.JPanel sliderPanel
      DOCUMENT ME!
      protected FileImageXML.Thumbnail thumbnail
      DOCUMENT ME!
      private javax.swing.JCheckBoxMenuItem thumbnailOption
      DOCUMENT ME!
      protected javax.swing.JPanel treePanel
      DOCUMENT ME!
      protected ViewUserInterface userInterface
      DOCUMENT ME!
      • Fields inherited from class javax.swing.JFrame

        accessibleContext, 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 java.awt.image.ImageObserver

        ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • Fields inherited from interface javax.swing.WindowConstants

        DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, EXIT_ON_CLOSE, HIDE_ON_CLOSE
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void actionPerformed​(java.awt.event.ActionEvent event)
      Recreates the tree when a new directory is selected; refreshes the tree when refresh is selected.
      private void buildBrightContPanel()
      Initializes GUI components and displays dialog.
      protected FileInfoBase buildImage​(java.lang.String fileName, java.lang.String directory)
      DOCUMENT ME!
      private javax.swing.JSplitPane buildImagePanel()
      Sets up the image panel and the table that will store basic header info, and returns the panel containing these.
      private void buildMenu()
      Builds a small menu with "New directory", "Refresh directory", "Reset file filter", and "Open image" options.
      protected void buildSourceTreeListing​(boolean directoriesOnly)
      Creates the tree that holds the image files and returns the panel containing the tree.
      protected javax.swing.border.TitledBorder buildTitledBorder​(java.lang.String title)
      Builds a titled border with the given title, an etched border, and the proper font and color.
      protected javax.swing.JPanel buildToolbar()
      Builds a toolbar with the same functionality as the menu.
      void componentHidden​(java.awt.event.ComponentEvent event)
      Unchanged.
      void componentMoved​(java.awt.event.ComponentEvent event)
      Unchanged.
      void componentResized​(java.awt.event.ComponentEvent event)
      Tells the component image that the size of the image panel has changed, then repaints the component image.
      void componentShown​(java.awt.event.ComponentEvent event)
      Unchanged.
      ViewJComponentPreviewImage getComponentPreviewImage()
      Gets the ViewJComponentPreviewImage that contains the currently selected model image.
      java.awt.Dimension getPanelSize()
      Called by the component image to get the real-time size of the panel before centering.
      protected void init()
      Initializes the GUI components and adds them to the main frame.
      void itemStateChanged​(java.awt.event.ItemEvent event)
      Sets border painted or not painted depending on if the button was selected or deselected.
      void stateChanged​(javax.swing.event.ChangeEvent e)
      Sets values based on knob along slider.
      void treeCollapsed​(javax.swing.event.TreeExpansionEvent tee)
      Unchanged.
      void treeExpanded​(javax.swing.event.TreeExpansionEvent tee)
      Expands tree node in file tree.
      void valueChanged​(javax.swing.event.TreeSelectionEvent e)
      Re-create the image and header info by reacting to each selection on the tree.
      • 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, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • Methods inherited from class java.awt.Window

        addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, 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, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, 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, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, 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, 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, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setMixingCutoutShape, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, 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
        Use serialVersionUID for interoperability.
        See Also:
        Constant Field Values
      • directory

        protected java.lang.String directory
        DOCUMENT ME!
      • directoryTree

        protected javax.swing.JTree directoryTree
        DOCUMENT ME!
      • file

        protected java.io.File file
        DOCUMENT ME!
      • imagePanel

        protected javax.swing.JPanel imagePanel
        DOCUMENT ME!
      • serif12

        protected java.awt.Font serif12
        DOCUMENT ME!
      • serif12B

        protected java.awt.Font serif12B
        DOCUMENT ME!
      • treePanel

        protected javax.swing.JPanel treePanel
        DOCUMENT ME!
      • brightness

        private int brightness
        DOCUMENT ME!
      • brightPanel

        private javax.swing.JPanel brightPanel
        DOCUMENT ME!
      • brightSlider

        private javax.swing.JSlider brightSlider
        DOCUMENT ME!
      • contSlider

        private javax.swing.JSlider contSlider
        DOCUMENT ME!
      • contrast

        private float contrast
        DOCUMENT ME!
      • current

        private javax.swing.JLabel current
        DOCUMENT ME!
      • current2

        private javax.swing.JLabel current2
        DOCUMENT ME!
      • defaultImageSize

        private java.awt.Dimension defaultImageSize
        DOCUMENT ME!
      • imageSliderPane

        private javax.swing.JSplitPane imageSliderPane
        DOCUMENT ME!
      • nfc

        private java.text.NumberFormat nfc
        DOCUMENT ME!
      • openSeparate

        private boolean openSeparate
        DOCUMENT ME!
      • openSeparateOption

        private javax.swing.JCheckBoxMenuItem openSeparateOption
        DOCUMENT ME!
      • origBrightness

        private int origBrightness
        DOCUMENT ME!
      • origContrast

        private float origContrast
        DOCUMENT ME!
      • otherLabel

        private javax.swing.JLabel otherLabel
        DOCUMENT ME!
      • primaryTable

        private javax.swing.JTable primaryTable
        DOCUMENT ME!
      • secondaryTable

        private javax.swing.JTable secondaryTable
        DOCUMENT ME!
      • showXMLThumbnail

        private boolean showXMLThumbnail
        DOCUMENT ME!
      • sliderPanel

        private javax.swing.JPanel sliderPanel
        DOCUMENT ME!
      • thumbnailOption

        private javax.swing.JCheckBoxMenuItem thumbnailOption
        DOCUMENT ME!
    • Constructor Detail

      • ViewImageDirectory

        public ViewImageDirectory​(java.lang.String dir,
                                  ViewImageFileFilter filter)
        Creates new tree of images and sets up file filter. Calls initialization method.
        Parameters:
        dir - DOCUMENT ME!
        filter - Directory to make tree under.
    • Method Detail

      • actionPerformed

        public void actionPerformed​(java.awt.event.ActionEvent event)
        Recreates the tree when a new directory is selected; refreshes the tree when refresh is selected.
        Specified by:
        actionPerformed in interface java.awt.event.ActionListener
        Parameters:
        event - Event that triggered this function.
      • componentHidden

        public void componentHidden​(java.awt.event.ComponentEvent event)
        Unchanged.
        Specified by:
        componentHidden in interface java.awt.event.ComponentListener
        Parameters:
        event - DOCUMENT ME!
      • componentMoved

        public void componentMoved​(java.awt.event.ComponentEvent event)
        Unchanged.
        Specified by:
        componentMoved in interface java.awt.event.ComponentListener
        Parameters:
        event - DOCUMENT ME!
      • componentResized

        public void componentResized​(java.awt.event.ComponentEvent event)
        Tells the component image that the size of the image panel has changed, then repaints the component image.
        Specified by:
        componentResized in interface java.awt.event.ComponentListener
        Parameters:
        event - Event that triggered this function.
      • componentShown

        public void componentShown​(java.awt.event.ComponentEvent event)
        Unchanged.
        Specified by:
        componentShown in interface java.awt.event.ComponentListener
        Parameters:
        event - DOCUMENT ME!
      • getPanelSize

        public java.awt.Dimension getPanelSize()
        Called by the component image to get the real-time size of the panel before centering.
        Specified by:
        getPanelSize in interface PreviewImageContainer
        Returns:
        The size of the panel.
      • getComponentPreviewImage

        public ViewJComponentPreviewImage getComponentPreviewImage()
        Gets the ViewJComponentPreviewImage that contains the currently selected model image.
        Returns:
        Gets the contained preview image component.
      • itemStateChanged

        public void itemStateChanged​(java.awt.event.ItemEvent event)
        Sets border painted or not painted depending on if the button was selected or deselected.
        Specified by:
        itemStateChanged in interface java.awt.event.ItemListener
        Parameters:
        event - Event that triggered this function.
      • stateChanged

        public void stateChanged​(javax.swing.event.ChangeEvent e)
        Sets values based on knob along slider.
        Specified by:
        stateChanged in interface javax.swing.event.ChangeListener
        Parameters:
        e - Event that triggered this function
      • treeCollapsed

        public void treeCollapsed​(javax.swing.event.TreeExpansionEvent tee)
        Unchanged.
        Specified by:
        treeCollapsed in interface javax.swing.event.TreeExpansionListener
        Parameters:
        tee - DOCUMENT ME!
      • treeExpanded

        public void treeExpanded​(javax.swing.event.TreeExpansionEvent tee)
        Expands tree node in file tree. On expansion, the tree queries the selected node; if a selected node has had its children previously added, then no nodes will be added, but the tree will display the previously added children. Otherwize, the node will add nodes which will be displayed; each node will be marked as adding only directories as child-nodes.
        Specified by:
        treeExpanded in interface javax.swing.event.TreeExpansionListener
        Parameters:
        tee - Event that triggered this function.
      • valueChanged

        public void valueChanged​(javax.swing.event.TreeSelectionEvent e)
        Re-create the image and header info by reacting to each selection on the tree. On selection, the image is read in again and constructed, and the table is cleared and the new header info is posted to the table. Note: no check has been made to remove child-nodes from a selection when the parent has been selected.
        Specified by:
        valueChanged in interface javax.swing.event.TreeSelectionListener
        Parameters:
        e - Event that triggered this function.
      • buildImage

        protected FileInfoBase buildImage​(java.lang.String fileName,
                                          java.lang.String directory)
        DOCUMENT ME!
        Parameters:
        fileName - String
        directory - String
        Returns:
        FileInfoBase
      • buildSourceTreeListing

        protected void buildSourceTreeListing​(boolean directoriesOnly)
        Creates the tree that holds the image files and returns the panel containing the tree.
        Parameters:
        directoriesOnly - DOCUMENT ME!
      • buildTitledBorder

        protected javax.swing.border.TitledBorder buildTitledBorder​(java.lang.String title)
        Builds a titled border with the given title, an etched border, and the proper font and color.
        Parameters:
        title - Title of the border
        Returns:
        The titled border.
      • buildToolbar

        protected javax.swing.JPanel buildToolbar()
        Builds a toolbar with the same functionality as the menu.
        Returns:
        DOCUMENT ME!
      • init

        protected void init()
        Initializes the GUI components and adds them to the main frame.
      • buildBrightContPanel

        private void buildBrightContPanel()
        Initializes GUI components and displays dialog.

        For the brightSlider the slider values and the brightness values are identical. brightness is an offset going from -255 to 255. This is enough to change all 0 values to 255 and all 255 values to 0. brightness is added to all contrast scaled red, green, and blue.

        However, for the contrastSlider the slider values are different from the contrast values. The contrast values go from 0.1 to 10.0 while the slider values go from -200 to 200. contrast = (float)Math.pow(10.0,contSlider.getValue()/200.0) The original red, green, and blue are mutliplied by contrast.

      • buildImagePanel

        private javax.swing.JSplitPane buildImagePanel()
        Sets up the image panel and the table that will store basic header info, and returns the panel containing these.
        Returns:
        The panel containing the image and the header info table.
      • buildMenu

        private void buildMenu()
        Builds a small menu with "New directory", "Refresh directory", "Reset file filter", and "Open image" options.