Class JDialogVolViewResample

  • All Implemented Interfaces:
    DialogDefaultsInterface, java.awt.event.ActionListener, java.awt.event.FocusListener, java.awt.event.ItemListener, java.awt.event.WindowListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants

    public class JDialogVolViewResample
    extends JDialogBase
    Dialog to ask user to resample the images to power of 2 before volume rendering.
    Author:
    Ruida Cheng
    See Also:
    Serialized Form
    • Nested Class Summary

      • Nested classes/interfaces inherited from class javax.swing.JDialog

        javax.swing.JDialog.AccessibleJDialog
      • Nested classes/interfaces inherited from class java.awt.Dialog

        java.awt.Dialog.AccessibleAWTDialog, java.awt.Dialog.ModalExclusionType, java.awt.Dialog.ModalityType
      • 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[] extents
      Original dimensions extents value array.
      private javax.swing.JTextField extXInput
      Original X, Y, Z dimension extents values.
      private javax.swing.JTextField extXOutput
      Power of 2 X, Y, Z dimension extents values.
      private javax.swing.JTextField extYInput
      Original X, Y, Z dimension extents values.
      private javax.swing.JTextField extYOutput
      Power of 2 X, Y, Z dimension extents values.
      private javax.swing.JTextField extZInput
      Original X, Y, Z dimension extents values.
      private javax.swing.JTextField extZOutput
      Power of 2 X, Y, Z dimension extents values.
      private boolean forcePadding
      Flag to force the padding of blank images to the end of images.
      private boolean forceResample
      Boolean flag to do resample images.
      private ModelImage imageA
      Model images A and B.
      private ModelImage imageAOriginal
      The non-cloned image which we want to load into the renderer.
      private ModelImage imageB
      Model images A and B.
      private int leftPanelRenderMode
      The left panel renderer mode.
      private ModelLUT LUTa
      Lookup table of the imageA, B.
      private ModelLUT LUTb
      Lookup table of the imageA, B.
      private int m_iFilter
      Resample filter type, default: Trilinear Interpoloation.
      private javax.swing.JComboBox m_kFilterType
      Resample filter selection box.
      private java.lang.String m_kVolViewType
      Type of ViewJFrameVolumeView object (using WildMagic or not)
      private int nDim
      Number of available dimension.
      private float[] newRes
      Resample resolutioin corresponding to Power of 2.
      private javax.swing.JButton padButton
      Pad button is used for inserting blank images to the end of the image.
      private javax.swing.JRadioButton radioBrainSurfaceFlattenerR
      Radio button of the brainsurface flattener render mode in the right panel.
      private javax.swing.JRadioButton radioFlythruL
      Radio button of the fly througth mode in the left panel.
      private javax.swing.JRadioButton radioNoneR
      Radio button of the none mode in the right panel.
      private javax.swing.JRadioButton radioRaycastR
      Radio button of the raycast render mode in the right panel.
      private javax.swing.JRadioButton radioShearwarpR
      Radio button of the shearwarp render mode in the right panel.
      private javax.swing.JRadioButton radioSurfaceL
      Radio button of the surface render mode int the left panel.
      private javax.swing.JRadioButton radioSurfaceR
      Radio button of the surface render mode in the right panel.
      private javax.swing.JRadioButton radioSurfaceView
      Radio button of the surface view mode in the left panel.
      private float[] res
      Original resolutioin arrray.
      private ModelImage resampledImage
      Temp Model image.
      protected ModelRGB RGBTA
      Lookup table of the color imageA, B.
      protected ModelRGB RGBTB
      Lookup table of the color imageA, B.
      private int rightPanelRenderMode
      The right panel renderer mode.
      private ModelImage segmentationImage
      An image with areas designated as special (vessels, etc).
      private static long serialVersionUID
      Use serialVersionUID for interoperability.
      private ViewJFrameVolumeView sr
      Reference to ViewJFrameSurfaceRenderer.
      private java.lang.String startupCommand
      The action command to send to the volume renderer after we start it (can be used to open a tab).
      private int[] volExtents
      Resampled dimension value in Power of 2.
      private int volSize
      Volume size X*Y*Z.
      • Fields inherited from class javax.swing.JDialog

        accessibleContext, rootPane, rootPaneCheckingEnabled
      • Fields inherited from class java.awt.Dialog

        DEFAULT_MODALITY_TYPE
      • 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
    • Constructor Summary

      Constructors 
      Constructor Description
      JDialogVolViewResample​(ModelImage _imageA, ModelImage _imageB, java.lang.String kCommand)
      Creates the dialog, using the input parameters to place it on the screen.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void actionPerformed​(java.awt.event.ActionEvent event)
      On "OK", sets the name variable to the text entered.
      javax.swing.JButton buildNotResampleButton()
      Builds the Cancel button.
      private void buildPadButton()
      Builds the Pad button for padding the blank images.
      private javax.swing.JButton buildResampleButton()
      Builds the OK button.
      protected javax.swing.border.TitledBorder buildTitledBorder​(java.lang.String title, javax.swing.border.Border _border)
      Builds a titled border with the given title, an etched border, and the proper font and color.
      void disposeLocal()
      Dispose memory.
      void exec()
      Do resampling.
      protected void finalize()
      Clear up memory from gc.
      void init()
      Build the resample dialog.
      protected ModelLUT initLUT​(ModelImage img)
      Creates and initializes the LUT for an image.
      void itemStateChanged​(java.awt.event.ItemEvent event)
      Sets the flags for the checkboxes.
      void sendActionOnStart​(java.lang.String cmd)
      Sets a command that should be sent to the renderer after it is started.
      void setSegmentationImage​(ModelImage img)
      Set the image which we can check to see if the probe is hitting anything important (such as vessels, etc).
      • Methods inherited from class javax.swing.JDialog

        addImpl, createRootPane, dialogInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • Methods inherited from class java.awt.Dialog

        addNotify, getModalityType, getTitle, hide, isModal, isResizable, isUndecorated, setBackground, setModal, setModalityType, setOpacity, setResizable, setShape, setTitle, setUndecorated, show, toBack
      • 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, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeNotify, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImage, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, 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, remove, 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, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • serialVersionUID

        private static final long serialVersionUID
        Use serialVersionUID for interoperability.
        See Also:
        Constant Field Values
      • RGBTA

        protected ModelRGB RGBTA
        Lookup table of the color imageA, B.
      • RGBTB

        protected ModelRGB RGBTB
        Lookup table of the color imageA, B.
      • extents

        private int[] extents
        Original dimensions extents value array.
      • extXInput

        private javax.swing.JTextField extXInput
        Original X, Y, Z dimension extents values.
      • extYInput

        private javax.swing.JTextField extYInput
        Original X, Y, Z dimension extents values.
      • extZInput

        private javax.swing.JTextField extZInput
        Original X, Y, Z dimension extents values.
      • extXOutput

        private javax.swing.JTextField extXOutput
        Power of 2 X, Y, Z dimension extents values.
      • extYOutput

        private javax.swing.JTextField extYOutput
        Power of 2 X, Y, Z dimension extents values.
      • extZOutput

        private javax.swing.JTextField extZOutput
        Power of 2 X, Y, Z dimension extents values.
      • forcePadding

        private boolean forcePadding
        Flag to force the padding of blank images to the end of images.
      • forceResample

        private boolean forceResample
        Boolean flag to do resample images.
      • imageA

        private ModelImage imageA
        Model images A and B.
      • imageB

        private ModelImage imageB
        Model images A and B.
      • imageAOriginal

        private ModelImage imageAOriginal
        The non-cloned image which we want to load into the renderer.
      • leftPanelRenderMode

        private int leftPanelRenderMode
        The left panel renderer mode.
      • LUTa

        private ModelLUT LUTa
        Lookup table of the imageA, B.
      • LUTb

        private ModelLUT LUTb
        Lookup table of the imageA, B.
      • m_iFilter

        private int m_iFilter
        Resample filter type, default: Trilinear Interpoloation.
      • m_kFilterType

        private javax.swing.JComboBox m_kFilterType
        Resample filter selection box.
      • nDim

        private final int nDim
        Number of available dimension.
      • newRes

        private float[] newRes
        Resample resolutioin corresponding to Power of 2.
      • padButton

        private javax.swing.JButton padButton
        Pad button is used for inserting blank images to the end of the image. This approach creates the power of 2 image. Pad Button is only enabled when the power of 2 value is greater than the slices number.
      • radioBrainSurfaceFlattenerR

        private javax.swing.JRadioButton radioBrainSurfaceFlattenerR
        Radio button of the brainsurface flattener render mode in the right panel.
      • radioFlythruL

        private javax.swing.JRadioButton radioFlythruL
        Radio button of the fly througth mode in the left panel.
      • radioSurfaceView

        private javax.swing.JRadioButton radioSurfaceView
        Radio button of the surface view mode in the left panel.
      • radioNoneR

        private javax.swing.JRadioButton radioNoneR
        Radio button of the none mode in the right panel.
      • radioRaycastR

        private javax.swing.JRadioButton radioRaycastR
        Radio button of the raycast render mode in the right panel.
      • radioShearwarpR

        private javax.swing.JRadioButton radioShearwarpR
        Radio button of the shearwarp render mode in the right panel.
      • radioSurfaceL

        private javax.swing.JRadioButton radioSurfaceL
        Radio button of the surface render mode int the left panel.
      • radioSurfaceR

        private javax.swing.JRadioButton radioSurfaceR
        Radio button of the surface render mode in the right panel.
      • res

        private float[] res
        Original resolutioin arrray.
      • resampledImage

        private ModelImage resampledImage
        Temp Model image.
      • rightPanelRenderMode

        private int rightPanelRenderMode
        The right panel renderer mode.
      • segmentationImage

        private ModelImage segmentationImage
        An image with areas designated as special (vessels, etc).
      • startupCommand

        private java.lang.String startupCommand
        The action command to send to the volume renderer after we start it (can be used to open a tab). Used by RFAST to open up the RFA simulation immediately.
      • volExtents

        private int[] volExtents
        Resampled dimension value in Power of 2.
      • volSize

        private int volSize
        Volume size X*Y*Z.
      • m_kVolViewType

        private final java.lang.String m_kVolViewType
        Type of ViewJFrameVolumeView object (using WildMagic or not)
    • Constructor Detail

      • JDialogVolViewResample

        public JDialogVolViewResample​(ModelImage _imageA,
                                      ModelImage _imageB,
                                      java.lang.String kCommand)
        Creates the dialog, using the input parameters to place it on the screen.
        Parameters:
        _imageA - Model image A.
        _imageB - Model image B.
    • Method Detail

      • actionPerformed

        public void actionPerformed​(java.awt.event.ActionEvent event)
        On "OK", sets the name variable to the text entered. On "Cancel" disposes of this dialog and sets cancel flag.
        Specified by:
        actionPerformed in interface java.awt.event.ActionListener
        Overrides:
        actionPerformed in class JDialogBase
        Parameters:
        event - Event that triggered this method.
      • buildNotResampleButton

        public javax.swing.JButton buildNotResampleButton()
        Builds the Cancel button. Sets it internally as well return the just-built button.
        Returns:
        Return the noll resample button.
      • disposeLocal

        public void disposeLocal()
        Dispose memory.
      • exec

        public void exec()
        Do resampling.
      • init

        public void init()
        Build the resample dialog.
      • itemStateChanged

        public void itemStateChanged​(java.awt.event.ItemEvent event)
        Sets the flags for the checkboxes.
        Specified by:
        itemStateChanged in interface java.awt.event.ItemListener
        Overrides:
        itemStateChanged in class JDialogBase
        Parameters:
        event - event that triggered this function
      • sendActionOnStart

        public void sendActionOnStart​(java.lang.String cmd)
        Sets a command that should be sent to the renderer after it is started.
        Parameters:
        cmd - the action command
      • setSegmentationImage

        public void setSegmentationImage​(ModelImage img)
        Set the image which we can check to see if the probe is hitting anything important (such as vessels, etc).
        Parameters:
        img - segmentation image
      • buildTitledBorder

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

        protected void finalize()
                         throws java.lang.Throwable
        Clear up memory from gc.
        Overrides:
        finalize in class java.lang.Object
        Throws:
        java.lang.Throwable - Call the dispose local to dispose memory.
      • initLUT

        protected ModelLUT initLUT​(ModelImage img)
                            throws java.lang.OutOfMemoryError
        Creates and initializes the LUT for an image.
        Parameters:
        img - the image to create a LUT for
        Returns:
        a LUT for the image img (null if a color image)
        Throws:
        java.lang.OutOfMemoryError - if enough memory cannot be allocated for this method
      • buildPadButton

        private void buildPadButton()
        Builds the Pad button for padding the blank images.
      • buildResampleButton

        private javax.swing.JButton buildResampleButton()
        Builds the OK button. Sets it internally as well return the just-built button.
        Returns:
        Return the resample button built.