Class DialogDTIColorDisplay

  • All Implemented Interfaces:
    AlgorithmInterface, ViewImageUpdateInterface, java.awt.event.ActionListener, java.awt.event.ComponentListener, java.awt.event.FocusListener, java.awt.event.ItemListener, java.awt.event.KeyListener, java.awt.event.MouseListener, java.awt.event.MouseWheelListener, java.awt.event.WindowListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible, javax.swing.event.ChangeListener, javax.swing.RootPaneContainer, javax.swing.WindowConstants

    public class DialogDTIColorDisplay
    extends ViewJFrameBase
    implements AlgorithmInterface, javax.swing.event.ChangeListener, java.awt.event.ItemListener, java.awt.event.MouseListener, java.awt.event.MouseWheelListener, java.awt.event.KeyListener, java.awt.event.FocusListener
    Author:
    pandyan This is the main dialog for the DTI Color Display References: Developed in concert with Sinisa Pajevic from the NIH/CIT/DCB/MSCL group, Lin-Ching Chang D.Sc., Carlo Pierpaoli MD Ph.D., and Lindsay Walker MS from the the NIH/NICHD/LIMB/STBB group and Olga Vogt from the NIH/CIT/DCB/ISL/BIRSS group: Mathematical and Statistical Computing Laboratory (MSCL) Biomedical Imaging Research Services Section (BIRSS) Imaging Sciences Laboratory (ISL) Division of Cumputational Bioscience (DCB) Center for Informational Technology (CIT) Section on Tissue Biophysics and Biomimetics (STBB) Laboratory of Integrative and Medical Biophysics (LIMB) National Institute of Child Health & Humann Development National Institutes of Health Publication Reference: S. Pajevic and C. Pierpaoli, "Color Schemes to Represent the Orientation of Anisotropic Tissues from Diffusion Tensor Data: Application to White Matter Fiber Tract Mapping in the Human Brain," Magnetic Resonance in Medicine, vol. 42, no. 3, pp. 526-540, 1999
    See Also:
    Serialized Form
    • Field Detail

      • title

        private java.lang.String title
        dialog title and version *
      • mainPanel

        private javax.swing.JPanel mainPanel
        panels *
      • bottomPanel

        private javax.swing.JPanel bottomPanel
        panels *
      • refPanel

        private javax.swing.JPanel refPanel
        panels *
      • colorPanel

        private javax.swing.JPanel colorPanel
        panels *
      • colorWheelPanel

        private javax.swing.JPanel colorWheelPanel
        panels *
      • resultImagePanel

        private javax.swing.JPanel resultImagePanel
        panels *
      • optionsPanel

        private javax.swing.JPanel optionsPanel
        panels *
      • colorWheelChoicesPanel

        private javax.swing.JPanel colorWheelChoicesPanel
        panels *
      • heuristicParametersPanel

        private javax.swing.JPanel heuristicParametersPanel
        panels *
      • anisotropyMaxPanel

        private javax.swing.JPanel anisotropyMaxPanel
        panels *
      • anisotropyMinPanel

        private javax.swing.JPanel anisotropyMinPanel
        panels *
      • gammaPanel

        private javax.swing.JPanel gammaPanel
        panels *
      • stevensBetaPanel

        private javax.swing.JPanel stevensBetaPanel
        panels *
      • satBluePanel

        private javax.swing.JPanel satBluePanel
        panels *
      • dimGreenPanel

        private javax.swing.JPanel dimGreenPanel
        panels *
      • colorRangePanel

        private javax.swing.JPanel colorRangePanel
        panels *
      • satVsThetaPanel

        private javax.swing.JPanel satVsThetaPanel
        panels *
      • resultPanel

        private javax.swing.JPanel resultPanel
        panels *
      • resultImageSliderPanel

        private javax.swing.JPanel resultImageSliderPanel
        panels *
      • tempPanel

        private javax.swing.JPanel tempPanel
        panels *
      • toolbarPanel

        private javax.swing.JPanel toolbarPanel
        panels *
      • adjustExpPanel

        private javax.swing.JPanel adjustExpPanel
        panels *
      • truncMultPanel

        private javax.swing.JPanel truncMultPanel
        panels *
      • restoreDefaultsPanel

        private javax.swing.JPanel restoreDefaultsPanel
        panels *
      • saveLoadPanel

        private javax.swing.JPanel saveLoadPanel
        panels *
      • minAnisotropyMaxLabel

        private javax.swing.JLabel minAnisotropyMaxLabel
        labels *
      • maxAnisotropyMaxLabel

        private javax.swing.JLabel maxAnisotropyMaxLabel
        labels *
      • minAnisotropyMinLabel

        private javax.swing.JLabel minAnisotropyMinLabel
        labels *
      • maxAnisotropyMinLabel

        private javax.swing.JLabel maxAnisotropyMinLabel
        labels *
      • minGammaLabel

        private javax.swing.JLabel minGammaLabel
        labels *
      • maxGammaLabel

        private javax.swing.JLabel maxGammaLabel
        labels *
      • minStevensBetaLabel

        private javax.swing.JLabel minStevensBetaLabel
        labels *
      • maxStevensBetaLabel

        private javax.swing.JLabel maxStevensBetaLabel
        labels *
      • minSatBlueLabel

        private javax.swing.JLabel minSatBlueLabel
        labels *
      • maxSatBlueLabel

        private javax.swing.JLabel maxSatBlueLabel
        labels *
      • minDimGreenLabel

        private javax.swing.JLabel minDimGreenLabel
        labels *
      • maxDimGreenLabel

        private javax.swing.JLabel maxDimGreenLabel
        labels *
      • minColorRangeLabel

        private javax.swing.JLabel minColorRangeLabel
        labels *
      • maxColorRangeLabel

        private javax.swing.JLabel maxColorRangeLabel
        labels *
      • minSatVsThetaLabel

        private javax.swing.JLabel minSatVsThetaLabel
        labels *
      • maxSatVsThetaLabel

        private javax.swing.JLabel maxSatVsThetaLabel
        labels *
      • minResultImageSlicesLabel

        private javax.swing.JLabel minResultImageSlicesLabel
        labels *
      • maxResultImageSlicesLabel

        private javax.swing.JLabel maxResultImageSlicesLabel
        labels *
      • currentResultImageSlicesLabel

        private javax.swing.JLabel currentResultImageSlicesLabel
        labels *
      • magLabel

        private javax.swing.JLabel magLabel
        labels *
      • refLabel1

        private javax.swing.JLabel refLabel1
        labels *
      • refLabel2

        private javax.swing.JLabel refLabel2
        labels *
      • refLabel3

        private javax.swing.JLabel refLabel3
        labels *
      • minAdjustExpLabel

        private javax.swing.JLabel minAdjustExpLabel
        labels *
      • maxAdjustExpLabel

        private javax.swing.JLabel maxAdjustExpLabel
        labels *
      • minAnisotropyMax

        private float minAnisotropyMax
        mins and maxes for heuristic parameters*
      • maxAnisotropyMax

        private float maxAnisotropyMax
        mins and maxes for heuristic parameters*
      • minAnisotropyMin

        private float minAnisotropyMin
        mins and maxes for heuristic parameters*
      • maxAnisotropyMin

        private float maxAnisotropyMin
        mins and maxes for heuristic parameters*
      • minGamma

        private float minGamma
        mins and maxes for heuristic parameters*
      • maxGamma

        private float maxGamma
        mins and maxes for heuristic parameters*
      • minStevensBeta

        private float minStevensBeta
        mins and maxes for heuristic parameters*
      • maxStevensBeta

        private float maxStevensBeta
        mins and maxes for heuristic parameters*
      • minSatBlue

        private float minSatBlue
        mins and maxes for heuristic parameters*
      • maxSatBlue

        private float maxSatBlue
        mins and maxes for heuristic parameters*
      • minDimGreen

        private float minDimGreen
        mins and maxes for heuristic parameters*
      • maxDimGreen

        private float maxDimGreen
        mins and maxes for heuristic parameters*
      • minColorRange

        private float minColorRange
        mins and maxes for heuristic parameters*
      • maxColorRange

        private float maxColorRange
        mins and maxes for heuristic parameters*
      • minSatVsTheta

        private float minSatVsTheta
        mins and maxes for heuristic parameters*
      • maxSatVsTheta

        private float maxSatVsTheta
        mins and maxes for heuristic parameters*
      • minAdjustExp

        private float minAdjustExp
        mins and maxes for heuristic parameters*
      • maxAdjustExp

        private float maxAdjustExp
        mins and maxes for heuristic parameters*
      • resultScrollPanel

        private javax.swing.JScrollPane resultScrollPanel
        scroll pane for result image *
      • anisotropyMaxTextField

        private javax.swing.JTextField anisotropyMaxTextField
        textfields *
      • anisotropyMinTextField

        private javax.swing.JTextField anisotropyMinTextField
        textfields *
      • gammaTextField

        private javax.swing.JTextField gammaTextField
        textfields *
      • stevensBetaTextField

        private javax.swing.JTextField stevensBetaTextField
        textfields *
      • satBlueTextField

        private javax.swing.JTextField satBlueTextField
        textfields *
      • dimGreenTextField

        private javax.swing.JTextField dimGreenTextField
        textfields *
      • colorRangeTextField

        private javax.swing.JTextField colorRangeTextField
        textfields *
      • satVsThetaTextField

        private javax.swing.JTextField satVsThetaTextField
        textfields *
      • adjustExpTextField

        private javax.swing.JTextField adjustExpTextField
        textfields *
      • magButton

        private javax.swing.JButton magButton
        buttons *
      • unMagButton

        private javax.swing.JButton unMagButton
        buttons *
      • zoomOneButton

        private javax.swing.JButton zoomOneButton
        buttons *
      • captureImageButton

        private javax.swing.JButton captureImageButton
        buttons *
      • restoreDefaultsButton

        private javax.swing.JButton restoreDefaultsButton
        buttons *
      • saveButton

        private javax.swing.JButton saveButton
        buttons *
      • loadButton

        private javax.swing.JButton loadButton
        buttons *
      • eigvecSrcImage

        private ModelImage eigvecSrcImage
        eigenvector src image *
      • anisotropyImage

        private ModelImage anisotropyImage
        anisotropy src image *
      • eigvecFilename

        private java.lang.String eigvecFilename
        names of eigenvector and anisotropy files*
      • anisotropyFilename

        private java.lang.String anisotropyFilename
        names of eigenvector and anisotropy files*
      • resultImage

        private ModelImage resultImage
        result image *
      • colorWheel

        private ColorWheel colorWheel
        Color Wheels *
      • gbl

        private java.awt.GridBagLayout gbl
        GridBagLayout *
      • gbc

        private java.awt.GridBagConstraints gbc
        GridbagConstraints *
      • anisotropyMaxSlider

        public javax.swing.JSlider anisotropyMaxSlider
        various sliders in dialog *
      • anisotropyMinSlider

        public javax.swing.JSlider anisotropyMinSlider
        various sliders in dialog *
      • gammaSlider

        public javax.swing.JSlider gammaSlider
        various sliders in dialog *
      • stevensBetaSlider

        public javax.swing.JSlider stevensBetaSlider
        various sliders in dialog *
      • satBlueSlider

        public javax.swing.JSlider satBlueSlider
        various sliders in dialog *
      • dimGreenSlider

        public javax.swing.JSlider dimGreenSlider
        various sliders in dialog *
      • colorRangeSlider

        public javax.swing.JSlider colorRangeSlider
        various sliders in dialog *
      • satVsThetaSlider

        public javax.swing.JSlider satVsThetaSlider
        various sliders in dialog *
      • resultImageSlider

        public javax.swing.JSlider resultImageSlider
        various sliders in dialog *
      • adjustExpSlider

        public javax.swing.JSlider adjustExpSlider
        various sliders in dialog *
      • titledBorder

        private javax.swing.border.TitledBorder titledBorder
        titled border for certain components *
      • colorWheelComboBox

        private javax.swing.JComboBox colorWheelComboBox
        color wheel choices combo box *
      • anisotropyMax

        private float anisotropyMax
        anisotropy max *
      • anisotropyMin

        private float anisotropyMin
        anisotropy min *
      • adjustExp

        private float adjustExp
        adjust exp *
      • gamma

        private float gamma
        gamma correction *
      • stevensBeta

        private float stevensBeta
        steven's beta *
      • pB

        private float pB
        blue saturation *
      • pG

        private float pG
        green saturation *
      • pC

        private float pC
        color range *
      • pS

        private float pS
        saturation vs theta *
      • imageBufferA

        protected float[] imageBufferA
        Buffer used to store image intensities the presently viewed slice of image A.
      • resols

        protected float[] resols
        Storage of the image voxel resolutions. One resolution value per dimension.
      • pixBuffer

        protected int[] pixBuffer
        Integer buffer (4 bytes that stores the concatenated Alpha (1 byte), Red (1 byte), Green ( 1 byte ), Blue (1 byte ) data. The ARGB values are generated by using the imageA intensities as a index into a LUT.
      • units

        protected int[] units
        Storage of the resolution units of measure. For example, mm, cm, inches ...
      • zSlice

        private int zSlice
        current z slice *
      • widthResFactor

        protected float widthResFactor
        Storage for correction parameters where datasets have non isotropic values.
      • heightResFactor

        protected float heightResFactor
        Storage for correction parameters where datasets have non isotropic values.
      • tSlice

        protected int tSlice
        Image time sequence number of image that is displayed. Zero indexed based.
      • nImage

        protected int nImage
        Number of slices in a 3D dataset.
      • nTImage

        protected int nTImage
        Number of time sequences in a 4D dataset.
      • type

        private java.lang.String type
        type of color wheel ABSVAL, NOSYMM, ROTATIONALSYMM, MIRRORSYMM *
      • zoom

        private float zoom
        current zoom for result image *
      • numSlices

        private int numSlices
        num slices for result image *
      • currentRectangle

        private java.awt.Rectangle currentRectangle
        rectangle for screen capture*
      • truncMultRadioGroup

        private javax.swing.ButtonGroup truncMultRadioGroup
        radio group for truncate/multiply *
      • truncRadio

        private javax.swing.JRadioButton truncRadio
        radio buttons for truncate/multiply *
      • multRadio

        private javax.swing.JRadioButton multRadio
        radio buttons for truncate/multiply *
      • isMultiply

        private boolean isMultiply
        boolean for truncate/multiply *
      • flag

        private boolean flag
        flag needed when performing restore defaults *
      • in

        private java.io.BufferedReader in
        Buffered Reader for loading params *
      • out

        private java.io.BufferedWriter out
        Buffered Writer for saving params *
      • currentColorWheelType

        private java.lang.String currentColorWheelType
        String indicating current color wheel type *
      • m_afScreenResolutions

        private float[] m_afScreenResolutions
        Sets the correct resolutions for the image that is created by captureImage.
      • m_fSliceThickness

        private float m_fSliceThickness
        Sets the correct slice thickness
    • Constructor Detail

      • DialogDTIColorDisplay

        public DialogDTIColorDisplay​(boolean modal)
        Constructor
    • Method Detail

      • init

        public void init()
        init
      • actionPerformed

        public void actionPerformed​(java.awt.event.ActionEvent e)
        action performed
        Specified by:
        actionPerformed in interface java.awt.event.ActionListener
        Specified by:
        actionPerformed in class ViewJFrameBase
        Parameters:
        e - the event from the UI
      • callAlgorithm

        protected void callAlgorithm()
        call algorithm
      • stateChanged

        public void stateChanged​(javax.swing.event.ChangeEvent e)
        state changed
        Specified by:
        stateChanged in interface javax.swing.event.ChangeListener
        Overrides:
        stateChanged in class ViewJFrameBase
        Parameters:
        e - the change event
      • itemStateChanged

        public void itemStateChanged​(java.awt.event.ItemEvent event)
        item state changed
        Specified by:
        itemStateChanged in interface java.awt.event.ItemListener
      • updateCurrentColorWheel

        public void updateCurrentColorWheel()
        update current color wheel
      • mouseClicked

        public void mouseClicked​(java.awt.event.MouseEvent event)
        mouse clicked
        Specified by:
        mouseClicked in interface java.awt.event.MouseListener
      • mouseEntered

        public void mouseEntered​(java.awt.event.MouseEvent event)
        mouse entered
        Specified by:
        mouseEntered in interface java.awt.event.MouseListener
      • mouseExited

        public void mouseExited​(java.awt.event.MouseEvent event)
        mouse exited
        Specified by:
        mouseExited in interface java.awt.event.MouseListener
      • mousePressed

        public void mousePressed​(java.awt.event.MouseEvent event)
        mouse pressed
        Specified by:
        mousePressed in interface java.awt.event.MouseListener
      • mouseReleased

        public void mouseReleased​(java.awt.event.MouseEvent e)
        mouse released
        Specified by:
        mouseReleased in interface java.awt.event.MouseListener
      • magImage

        public void magImage()
        magnifies image
      • unMagImage

        public void unMagImage()
        un-magnifies image
      • zoomOne

        public void zoomOne()
        sets image zoom to 1
      • restoreDefaults

        public void restoreDefaults()
        restore default parameters
      • saveParams

        public void saveParams()
        save heuristic parameters
      • loadParams

        public void loadParams()
        loads heuristic parameter values
      • captureImage

        private boolean captureImage()
        Scrolls through all z slices of a 3d/4d image and captures them into a new ARGB ModelImage, then puts the ModelImage in a ViewJFrameImage.
        Returns:
      • windowClosing

        public void windowClosing​(java.awt.event.WindowEvent event)
        window closing
        Specified by:
        windowClosing in interface java.awt.event.WindowListener
        Overrides:
        windowClosing in class ViewJFrameBase
        Parameters:
        event - the window event that triggered this method
      • mouseWheelMoved

        public void mouseWheelMoved​(java.awt.event.MouseWheelEvent event)
        mouse wheel moved
        Specified by:
        mouseWheelMoved in interface java.awt.event.MouseWheelListener
        Parameters:
        event -
      • keyTyped

        public void keyTyped​(java.awt.event.KeyEvent event)
        key typed
        Specified by:
        keyTyped in interface java.awt.event.KeyListener
      • focusLost

        public void focusLost​(java.awt.event.FocusEvent event)
        focus lost
        Specified by:
        focusLost in interface java.awt.event.FocusListener
      • validateCurrentNum

        public float validateCurrentNum​(java.lang.String numString,
                                        float min,
                                        float max)
        validate current number
        Parameters:
        numString -
        min -
        max -
        Returns:
      • initImageBuffer

        protected static float[] initImageBuffer​(int[] extents,
                                                 boolean isColor)
        Create the intensity buffer for an image.
        Parameters:
        extents - the extents of the image
        isColor - whether the image is in color
        Returns:
        a buffer which is big enough to contain the image intensity data
      • initPixelBuffer

        protected static int[] initPixelBuffer​(int[] extents)
        Create the pixel buffer for an image.
        Parameters:
        extents - the extents of the image
        Returns:
        a buffer which is big enough to contain the image pixel data
      • initResolutions

        protected static float[] initResolutions​(ModelImage img)
        init resolutions
        Parameters:
        img -
        Returns:
      • initUnits

        protected static int[] initUnits​(ModelImage img)
        init units
        Parameters:
        img -
        Returns:
      • initResFactor

        protected static float[] initResFactor​(float[] imgResols,
                                               int[] imgUnits)
        Get the resolution correction needed for non-isotropic images.
        Parameters:
        imgResols - the image resolution
        imgUnits - the image units of measure
        Returns:
        the resolution correction factor in the x (the first element) and y (the second element) dimensions
      • initRGB

        public static ModelRGB initRGB​(ModelImage img)
                                throws java.lang.OutOfMemoryError
        Creates and initializes the ModelRGB for an image.
        Parameters:
        img - the image to create a ModelRGB for
        Returns:
        a ModelRGB for the image img (null if NOT a color image)
        Throws:
        java.lang.OutOfMemoryError - if enough memory cannot be allocated for this method
      • initExtentsVariables

        public void initExtentsVariables​(ModelImage img)
        Initializes the variables based on the image extents. (i.e. number of slices, number of time slices, the initial z-slice, etc.
        Parameters:
        img - the image to set the extent variables for
      • initSlicePositions

        protected static int[] initSlicePositions​(ModelImage img)
        Get the initial time and volume slice positions.
        Parameters:
        img - the image to get the slice positions of
        Returns:
        an array containing the slice in the volume (in the first element) and the time slice (in the second element)
      • initNumSlices

        protected static int[] initNumSlices​(ModelImage img)
        Get the total number of time slices and volume slices.
        Parameters:
        img - the image to get the slices of
        Returns:
        an array containing the number of volume slices (in the first element) and the number of time slices in the image (in the second element)
      • getRGBTA

        public ModelRGB getRGBTA()
        Gets the RGB LUT table for ARGB image A.
        Overrides:
        getRGBTA in class ViewJFrameBase
        Returns:
        RGBT the new RGB LUT to be applied to the image
      • setRGBTA

        public void setRGBTA​(ModelRGB RGBT)
        Sets the RGB LUT table for ARGB image A.
        Specified by:
        setRGBTA in class ViewJFrameBase
        Parameters:
        RGBT - the new RGB LUT to be applied to the image
      • setActiveImage

        public void setActiveImage​(int active)
        set active image
        Specified by:
        setActiveImage in class ViewJFrameBase
        Parameters:
        active - IMAGE_A or IMAGE_B
      • setAlphaBlend

        public void setAlphaBlend​(int value)
        set alpha blend
        Specified by:
        setAlphaBlend in class ViewJFrameBase
        Parameters:
        value - amount [0,100] that is the percentage of Image A to be displayed and (1-percentage) of Image B to be displayed
      • setEnabled

        public void setEnabled​(boolean flag)
        set enabled
        Specified by:
        setEnabled in class ViewJFrameBase
        Parameters:
        flag - if true the image/VOIs can be modified; if false image/VOIs can NOT be modified
      • setImageB

        public void setImageB​(ModelImage imageB)
        set image b
        Specified by:
        setImageB in class ViewJFrameBase
        Parameters:
        imageB - The image to make image-B in this frame.
      • setPaintBitmapSwitch

        public void setPaintBitmapSwitch​(boolean flag)
        set paint bitmap switch
        Specified by:
        setPaintBitmapSwitch in class ViewJFrameBase
        Parameters:
        flag - if true do not getMask on a setActiveImage command
      • setRGBTB

        public void setRGBTB​(ModelRGB RGBT)
        set rgbtb
        Specified by:
        setRGBTB in class ViewJFrameBase
        Parameters:
        RGBT - the RGB table to use for image B
      • setTimeSlice

        public void setTimeSlice​(int tSlice)
        set time slice
        Specified by:
        setTimeSlice in interface ViewImageUpdateInterface
        Parameters:
        tSlice - Current time volume
      • updateImages

        public boolean updateImages​(boolean flag)
        update images
        Specified by:
        updateImages in interface ViewImageUpdateInterface
        Parameters:
        flag - forces show to re import image and calc. java image
        Returns:
        boolean confirming successful update
      • updateImages

        public boolean updateImages​(ModelLUT LUTa,
                                    ModelLUT LUTb,
                                    boolean flag,
                                    int interpMode)
        update images
        Specified by:
        updateImages in interface ViewImageUpdateInterface
        Parameters:
        LUTa - LUT used to update imageA
        LUTb - LUT used to update imageB
        flag - forces show to re import image and calc. java image
        interpMode - image interpolation method (Nearest or Smooth)
        Returns:
        boolean confirming a successful update
      • focusGained

        public void focusGained​(java.awt.event.FocusEvent event)
        focus gained
        Specified by:
        focusGained in interface java.awt.event.FocusListener
      • keyPressed

        public void keyPressed​(java.awt.event.KeyEvent event)
        key pressed
        Specified by:
        keyPressed in interface java.awt.event.KeyListener
      • keyReleased

        public void keyReleased​(java.awt.event.KeyEvent event)
        key released
        Specified by:
        keyReleased in interface java.awt.event.KeyListener
      • setScreenImageResolutions

        public void setScreenImageResolutions​(float[] afResolutions,
                                              float fSlice)
        Sets the correct resolutions for the image that is created by captureImage.
        Parameters:
        afResolutions - correct image resolutions.
        fSlice - slice thickness