Class ViewJFrameBase

All Implemented Interfaces:
ViewImageUpdateInterface, ActionListener, ComponentListener, WindowListener, ImageObserver, MenuContainer, Serializable, EventListener, Accessible, ChangeListener, RootPaneContainer, WindowConstants
Direct Known Subclasses:
DialogDTIColorDisplay, DTIColorDisplay, ViewJFrameAnimate, ViewJFrameAnimateClip, ViewJFrameColocalizationEM, ViewJFrameColocalizationRegression, ViewJFrameHistoLUT, ViewJFrameHistoRGB, ViewJFrameImage, ViewJFrameLightBox, ViewJFramePaintVasculature, ViewJFramePlotterView, ViewJFrameRegistration, ViewJFrameRegistrationTool, ViewJFrameRenderCamera, ViewJFrameTriImage, ViewJFrameVolumeView

public abstract class ViewJFrameBase extends JFrame implements ViewImageUpdateInterface, ActionListener, WindowListener, ComponentListener, ChangeListener
This is an abstract class used to display images in a 2D planar format.
Version:
0.1 Oct 1, 1998
Author:
Matthew J. McAuliffe, Ph.D.
See Also:
  • Field Details

    • serialVersionUID

      private static final long serialVersionUID
      Use serialVersionUID for interoperability.
      See Also:
    • IMAGE_A

      public static final int IMAGE_A
      Display mode image A.
      See Also:
    • IMAGE_B

      public static final int IMAGE_B
      Display mode image B.
      See Also:
    • IMAGE_A_B

      public static final int IMAGE_A_B
      Display mode image A and B.
      See Also:
    • zoomMode

      protected int zoomMode
      DOCUMENT ME!
    • absoluteLabel

      protected JLabel absoluteLabel
      Labels for the current absolute position:.
    • absoluteLabelVals

      protected JLabel[] absoluteLabelVals
      Labels for the current absolute position values:.
    • absolutePanel

      protected JPanel absolutePanel
      JPanel containing the absoulte position labels:.
    • alphaBlend

      protected float alphaBlend
      Indicates the amount of blending when two images are loaded in the image frame.
    • displayMode

      protected int displayMode
      Indicates which image is to be acted upon when two images are displayed.
    • imageA

      protected ModelImage imageA
      Reference to the image A of this frame.
    • imageB

      protected ModelImage imageB
      Reference to the image B of this frame.
    • linkFrame

      protected ViewJFrameImage linkFrame
      Holds a reference (link) to another frame so that it be updated with this frame.
    • linkTriFrame

      protected ViewJFrameTriImage linkTriFrame
      Holds a reference (link) to another frame so that it can be updated with this frame.
    • defaultLUTa

      protected ModelLUT defaultLUTa
      Reference to LUT for image A and to the default LUT for image A.
    • LUTa

      protected ModelLUT LUTa
      Reference to LUT for image A and to the default LUT for image A.
    • defaultLUTb

      protected ModelLUT defaultLUTb
      Reference to LUT for image B and to the default LUT for image B.
    • LUTb

      protected ModelLUT LUTb
      Reference to LUT for image B and to the default LUT for image B.
    • progressBar

      protected ViewJProgressBar progressBar
      Reference to progress bar.
    • scannerLPSLabel

      protected JLabel scannerLPSLabel
      Labels for the current scanner position:.
    • scannerRASLabel

      protected JLabel scannerRASLabel
      Labels for the current scanner position:.
    • scannerLPSLabelVals

      protected JLabel[] scannerLPSLabelVals
      Labels for the current scanner position values:.
    • scannerRASLabelVals

      protected JLabel[] scannerRASLabelVals
      Labels for the current scanner position values:.
    • scannerLPSPanel

      protected JPanel scannerLPSPanel
      JPanel containing the scanner position labels:.
    • scannerRASPanel

      protected JPanel scannerRASPanel
      JPanel containing the scanner position labels:.
    • tabbedPane

      protected JTabbedPane tabbedPane
      The main tabbed pane in the volume view frame.
    • scannerTabbedPane

      protected JTabbedPane scannerTabbedPane
      The tabbed pane to hold teh LPS, RAS and absolution coordinate panels.
    • userInterface

      protected ViewUserInterface userInterface
      Reference to the user interface.
    • isClosing

      protected boolean isClosing
      Whether the frame's close() method is being called.
    • blue

      private int blue
      Blue channel value of the paint color.
    • enableCloseImageB

      private boolean enableCloseImageB
      Tells whether the ViewMenuBuilder should allow Close Image(B) after loading image B.
    • newFrameCreated

      private boolean newFrameCreated
    • green

      private int green
      Green channel value of the paint color.
    • lastState

      private int lastState
      Save if last state was iconified or normal.
    • opacity

      private float opacity
      Opacity value of the paint color.
    • paintBitmap

      private BitSet paintBitmap
      Reference to the BitSet map used in painting the image.
    • red

      private int red
      Red channel value of the paint color.
    • voiSavedFileName

      private String voiSavedFileName
      DOCUMENT ME!
    • linkedScrolling

      protected boolean linkedScrolling
      Variable indicating if images of like dimensions should be scrolled simult.
    • absoluteXLabel

      protected JLabel absoluteXLabel
      voxel absolute goto components*
    • absoluteYLabel

      protected JLabel absoluteYLabel
      voxel absolute goto components*
    • absoluteZLabel

      protected JLabel absoluteZLabel
      voxel absolute goto components*
    • absoluteXTextField

      protected JTextField absoluteXTextField
    • absoluteYTextField

      protected JTextField absoluteYTextField
    • absoluteZTextField

      protected JTextField absoluteZTextField
    • absoluteGoToButton

      protected JButton absoluteGoToButton
    • absoluteGoToPanel

      protected JPanel absoluteGoToPanel
    • scannerLPS_RLLabel

      protected JLabel scannerLPS_RLLabel
      scanner lps goto components*
    • scannerLPS_APLabel

      protected JLabel scannerLPS_APLabel
      scanner lps goto components*
    • scannerLPS_ISLabel

      protected JLabel scannerLPS_ISLabel
      scanner lps goto components*
    • scannerLPS_RLTextField

      protected JTextField scannerLPS_RLTextField
    • scannerLPS_APTextField

      protected JTextField scannerLPS_APTextField
    • scannerLPS_ISTextField

      protected JTextField scannerLPS_ISTextField
    • scannerLPS_GoToButton

      protected JButton scannerLPS_GoToButton
    • scannerLPS_GoToPanel

      protected JPanel scannerLPS_GoToPanel
    • scannerRAS_RLLabel

      protected JLabel scannerRAS_RLLabel
      scanner ras goto components*
    • scannerRAS_APLabel

      protected JLabel scannerRAS_APLabel
      scanner ras goto components*
    • scannerRAS_ISLabel

      protected JLabel scannerRAS_ISLabel
      scanner ras goto components*
    • scannerRAS_RLTextField

      protected JTextField scannerRAS_RLTextField
    • scannerRAS_APTextField

      protected JTextField scannerRAS_APTextField
    • scannerRAS_ISTextField

      protected JTextField scannerRAS_ISTextField
    • scannerRAS_GoToButton

      protected JButton scannerRAS_GoToButton
    • scannerRAS_GoToPanel

      protected JPanel scannerRAS_GoToPanel
    • talXLabel

      protected JLabel talXLabel
      talairach goto components*
    • talYLabel

      protected JLabel talYLabel
      talairach goto components*
    • talZLabel

      protected JLabel talZLabel
      talairach goto components*
    • talXTextField

      protected JTextField talXTextField
    • talYTextField

      protected JTextField talYTextField
    • talZTextField

      protected JTextField talZTextField
    • talGoToButton

      protected JButton talGoToButton
    • talGoToPanel

      protected JPanel talGoToPanel
  • Constructor Details

    • ViewJFrameBase

      public ViewJFrameBase(ModelImage _imageA, ModelImage _imageB)
      Makes an image frame.
      Parameters:
      _imageA - model image A
      _imageB - model image B
  • Method Details

    • actionPerformed

      public abstract void actionPerformed(ActionEvent event)
      Method to handle action events generated by the main UI when the current frame is selected. Implemented by specific frame classes.
      Specified by:
      actionPerformed in interface ActionListener
      Parameters:
      event - the event from the UI
    • getControls

      public abstract ViewControlsImage getControls()
      Gets the control widgets for the frame.
      Returns:
      the frame's image controls
    • getImageA

      public abstract ModelImage getImageA()
      Accessor that returns the imageA.
      Returns:
      imageA
    • getImageB

      public abstract ModelImage getImageB()
      Accessor that returns the imageB.
      Returns:
      imageB
    • removeControls

      public abstract void removeControls()
      Removes the menu and controls of the main frame so that a new frame can load the main frame with the proper controls. Abstract and must be extended.
    • setActiveImage

      public abstract void setActiveImage(int active)
      Sets the active image (image that should be processed for drawing VOIs and applying algorithms.
      Parameters:
      active - IMAGE_A or IMAGE_B
    • setAlphaBlend

      public abstract void setAlphaBlend(int value)
      Sets the alpha blending parameter for two image display.
      Parameters:
      value - amount [0,100] that is the percentage of Image A to be displayed and (1-percentage) of Image B to be displayed
    • setControls

      public abstract void setControls()
      Sets the menu and controls (i.e. toolbars) of the main frame! This puts only the menus and controls needed to controls the operations of this frame. Different image frames have different menu and controls.
    • setEnabled

      public abstract void setEnabled(boolean flag)
      Controls whether or not the images/VOIs of the frame can be modified.
      Overrides:
      setEnabled in class Component
      Parameters:
      flag - if true the image/VOIs can be modified; if false image/VOIs can NOT be modified
    • setImageB

      public abstract void setImageB(ModelImage imageB)
      Accessor that sets the imageB.
      Parameters:
      imageB - The image to make image-B in this frame.
    • setPaintBitmapSwitch

      public abstract void setPaintBitmapSwitch(boolean flag)
      If true do not getMask on a setActiveImage command so as to keep the mask from the old active image.
      Parameters:
      flag - if true do not getMask on a setActiveImage command
    • setRGBTA

      public abstract void setRGBTA(ModelRGB RGBT)
      Set the RGB table for image A.
      Parameters:
      RGBT - the RGB table to use for image A
    • setRGBTB

      public abstract void setRGBTB(ModelRGB RGBT)
      Set the RGB table for image B.
      Parameters:
      RGBT - the RGB table to use for image B
    • setTitle

      public abstract void setTitle()
      Sets the Title bar of the frame.
    • updateImageExtents

      public abstract boolean updateImageExtents()
      The extents on this image have changed, so the extents need to be read in again and menus, panes and slide bars adjusted accordingly.
      Specified by:
      updateImageExtents in interface ViewImageUpdateInterface
      Returns:
      true if the update was successful, false otherwise
      See Also:
    • about

      public void about(int zSlice, int tSlice)
      Makes an aboutDialog box that displays information about the image slice.
      Parameters:
      zSlice - index to slice in z-Plane about the specific image slice
      tSlice - index to slice in time about the specific image slice
    • buildLabelPanel

      public void buildLabelPanel()
      The label panel of the x, y, z slider position.
    • canCloseImageBAfterLoad

      public boolean canCloseImageBAfterLoad()
      Returns whether or not the close image B option should appear after loading.
      Returns:
      whether the "Close image B" option should appear after image B is loaded
    • newFrameBeenCreated

      public boolean newFrameBeenCreated()
    • close

      public void close()
      Closes both image A and image B (if it exists). It ensures the images are un-registered from the main-frame then removes any display listeners.
    • close

      public void close(boolean closeAll)
      Closes both image A and image B (if it exists). It ensures the images are un-registered from the main-frame then removes any display listeners.
    • closeImageB

      public void closeImageB()
      Removes image B from the frame and resets image A to be the active frame for all image controls. Ensures the image is removed, disconnected from the frame and un-registered. Also informs the garbage-collector to release any held memory.
    • componentHidden

      public void componentHidden(ComponentEvent event)
      Does nothing.
      Specified by:
      componentHidden in interface ComponentListener
      Parameters:
      event - the component event
    • componentMoved

      public void componentMoved(ComponentEvent event)
      Does nothing.
      Specified by:
      componentMoved in interface ComponentListener
      Parameters:
      event - the component event
    • componentResized

      public void componentResized(ComponentEvent event)
      Does nothing.
      Specified by:
      componentResized in interface ComponentListener
      Parameters:
      event - the component event
    • componentShown

      public void componentShown(ComponentEvent event)
      Does nothing.
      Specified by:
      componentShown in interface ComponentListener
      Parameters:
      event - the component event
    • getAlphaBlend

      public float getAlphaBlend()
      Returns a default alphaBlend value for blending of two images.
      Returns:
      a default alphaBlend value
    • getDisplayMode

      public int getDisplayMode()
      Accessor that returns displayMode.
      Returns:
      displayMode
    • getImageNameA

      public String getImageNameA()
      Accessor that returns the title of image A.
      Returns:
      frame title for Image A
    • getImageNameB

      public String getImageNameB()
      Accessor that returns the title of image B.
      Returns:
      frame title for Image B
    • getLastState

      public int getLastState()
      getLastState.
      Returns:
      lastState Should be either Frame.NORMAL or Frame.ICONIFIED
    • getLUTa

      public ModelLUT getLUTa()
      Accessor that returns LUTa.
      Returns:
      LUTa
    • getLUTb

      public ModelLUT getLUTb()
      Accessor that returns LUTb.
      Returns:
      LUTb
    • getDefaultLUTa

      public ModelLUT getDefaultLUTa()
      Accessor that returns the default LUTa for the frame.
      Returns:
      defaultLUTa
    • getDefaultLUTb

      public ModelLUT getDefaultLUTb()
      Accessor that returns the default LUTb for the frame.
      Returns:
      defaultLUTb
    • getRGBTA

      public ModelRGB getRGBTA()
      Get the RGB table for image A.
      Returns:
      null (may be overridden by inheriting classes)
    • getRGBTB

      public ModelRGB getRGBTB()
      Get the RGB table for image B.
      Returns:
      null (may be overridden by inheriting classes)
    • getTriImg

      public ViewJFrameTriImage getTriImg()
      Get the ViewJFrameTriImage reference.
      Returns:
      linkTriFrame ViewJFrameTriImage.
    • getUserInterface

      public ViewUserInterface getUserInterface()
      Accessor that returns the user interface.
      Returns:
      the user interface
    • loadAllVOIs

      public void loadAllVOIs(boolean quietMode)
      This method loads all VOIs to the active image from the default VOI directory for that image.
      Parameters:
      quietMode - if true indicates that warnings should not be displayed.
    • loadAllVOIsFrom

      public void loadAllVOIsFrom(String voiDir, boolean quietMode)
      This method loads all VOIs to the active image from a given directory.
      Parameters:
      voiDir - the directory to load voi's from
      quietMode - if true indicates that warnings should not be displayed.
    • loadImage

      public boolean loadImage(Object obj, ViewJComponentEditImage compImage, boolean stackFlag, boolean doOrigins, boolean doOrients, double defaultValue, double defaultRed, double defaultGreen, double defaultBlue, boolean isQuiet)
      Loads an image into imageB slot of frame. Matches the imageB resolutions and dimensions to imageA, and can optionally match the images' origins and orientations.
      Parameters:
      obj - an object which is either a ModelImage to be loaded into the modelimage (as say, imageB, imported from another frame) or a File to be read in via FileIO.readImage(...)
      compImage - image component where image is set so that it can be displayed.
      stackFlag - flag indicating multi file
      doOrigins - when calling MatchImages to match resolutions and dimensions, should origins be matched too?
      doOrients - when calling MatchImages to match resolutions and dimensions, should orientations be matched too?
      Returns:
      true if the load was successful, false otherwise
      See Also:
    • matchImages

      private void matchImages(ModelImage imageA, ModelImage imageB, boolean doOrigins, boolean doOrients, double defaultValue, double defaultRed, double defaultGreen, double defaultBlue)
    • loadLUT

      public void loadLUT(boolean loadAll, boolean quietMode)
      This method loads the LUT for the active image. If the image is not a color image then both the functions and the LUT data are loaded. If this is a color image, then only the functions are loaded.
      Parameters:
      loadAll - boolean indicating that both lut and transfer functions should be loaded. If false, then only transfer functions are loaded.
      quietMode - if true indicates that warnings should not be displayed.
    • loadLUTandTransferFunctionFrom

      public void loadLUTandTransferFunctionFrom(boolean loadAll, String filename, String dirName, boolean quietMode)
      This method loads the LUT for the active image. If the image is not a color image then both the functions and the LUT data are loaded. If this is a color image, then only the functions are loaded.
      Parameters:
      loadAll - boolean indicating that both lut and transfer functions should be loaded. If false, then only transfer functions are loaded.
      filename - filename to save LUT as
      dirName - directory to save LUT to
      quietMode - if true indicates that warnings should not be displayed.
    • loadLUTandTransferFunctionFrom

      public static void loadLUTandTransferFunctionFrom(ModelImage image, ModelStorageBase lut, boolean loadAll, String filename, String dirName, boolean quietMode)
      Reads the input LUT (ModelLUT or ModelRGB) from file.
      Parameters:
      image -
      lut -
      loadAll -
      filename -
      dirName -
      quietMode -
    • openVOI

      public boolean openVOI(boolean quietMode, boolean doLabels)
      This method opens an existing VOI.
      Parameters:
      quietMode - if true indicates that warnings should not be displayed.
      doLabels - DOCUMENT ME!
      Returns:
      whether a VOI was successfully opened (ie - the dialog wasn't cancelled)
    • openVOI

      public VOI[] openVOI(ModelImage image, boolean quietMode)
      This method opens an existing VOI.
      Parameters:
      image - image where VOI(s) are to registered
      quietMode - if true indicates that warnings should not be displayed.
      Returns:
      the VOI(s)
    • pickImageFile

      public File pickImageFile()
      Brings up a FileChooser to pick a file.
      Returns:
      File the File the chooser picks.
    • save

      public void save(FileWriteOptions options, int filterType)
      Creates save dialog so that the image can be saved // This should be moved to imageModel.save();
      Parameters:
      options - File-write options.
      filterType - only used if >= 0
    • save

      public void save(ModelImage img, FileWriteOptions options, int filterType)
      Creates save dialog so that the image can be saved // This should be moved to imageModel.save();
      Parameters:
      img - DOCUMENT ME!
      options - DOCUMENT ME!
      filterType - only used if value >= 0
    • save

      public void save(ModelImage img, FileWriteOptions options, int filterType, boolean operateQuiet)
      Creates save dialog so that the image can be saved // This should be moved to imageModel.save();
      Parameters:
      img - DOCUMENT ME!
      options - DOCUMENT ME!
      filterType - only used if value >= 0
      operateQuiet - informs the FileIO to not notify user of errors or interrogate for more information.
    • saveAllVOIs

      public void saveAllVOIs()
      This method saves all VOIs for the active image to the default VOI directory for that image.
    • saveAllVOIsTo

      public void saveAllVOIsTo(String voiDir)
      This method saves all VOIs for the active image to a given directory.
      Parameters:
      voiDir - directory that contains VOIs for this image.
    • saveLabels

      public void saveLabels(boolean saveAll)
      DOCUMENT ME!
      Parameters:
      saveAll - DOCUMENT ME!
    • saveLUT

      public void saveLUT(boolean saveAll)
      This method saves the LUT for the active image. If the image is not a color image then both the functions and the LUT data are saved. If this is a color image, then only the functions are saved.
      Parameters:
      saveAll - - boolean indicating that both lut and transfer functions should be saved. If false, then only transfer functions are saved.
    • saveLUTAs

      public void saveLUTAs(boolean saveAll, String filename, String dirName)
      This method saves the LUT for the active image. If the image is not a color image then both the functions and the LUT data are saved. If this is a color image, then only the functions are saved.
      Parameters:
      saveAll - boolean indicating that both lut and transfer functions should be saved. If false, then only transfer functions are saved.

      If either filename or directory is null, then the user will be prompted for a filename.

      filename - filename to save LUT as
      dirName - directory to save LUT to
    • saveLUTAs

      public static void saveLUTAs(ModelImage image, ModelStorageBase lut, boolean saveAll)
      Saves the LUT associated with the input image (either a ModelLUT or ModelRGB).
      Parameters:
      image -
      lut -
      saveAll -
    • saveLUTandTransferFunction

      public void saveLUTandTransferFunction(String filename, String dirName)
      This method saves the LUT for the active image. If the image is not a color image then both the functions and the LUT data are saved. If this is a color image, then only the functions are saved.
      Parameters:
      filename - filename to save LUT as
      dirName - directory to save LUT to
    • saveLUTandTransferFunction

      public static void saveLUTandTransferFunction(ModelImage image, ModelLUT lut, String filename, String dirName)
      Saves the ModelLUT and transfer function.
      Parameters:
      image -
      lut -
      filename -
      dirName -
    • saveVOI

      public void saveVOI(boolean saveAllContours)
      This method saves a selected VOI - should this be in VOI structure ??!!!
      Parameters:
      saveAllContours - if true all contours are saved
    • saveVOIAs

      public String saveVOIAs()
      DOCUMENT ME!
      Returns:
      DOCUMENT ME!
    • saveVOIAs

      public void saveVOIAs(boolean saveAllContours)
      This method allows the user to choose how to save the VOI.
      Parameters:
      saveAllContours - if true all contours are saved
    • saveVOIIntensities

      public void saveVOIIntensities()
      Save intensities in VOI to a text file of format x,y,z,intensity on each line if not color or complex. If color use format x,y,z,a,r,g,b on each line and if complex use format x,y,z,real,imaginary on each line.
    • saveVOIIntensitiesTo

      public void saveVOIIntensitiesTo(String voiIntensitiesDir)
      Save intensities in VOI to a text file of format x,y,z,intensity on each line if not color or complex. If color use format x,y,z,a,r,g,b on each line and if complex use format x,y,z,real,imaginary on each line.
    • setEnableCloseImageBAfterLoad

      public void setEnableCloseImageBAfterLoad(boolean enable)
      Sets whether the close image B option should appear after loading.
      Parameters:
      enable - whether the "Close image B" option should appear after image B is loaded
    • setImageA

      public void setImageA(ModelImage image)
      Accessor that sets the imageA.
      Parameters:
      image - The image to make image-A in this frame.
    • setLastState

      public void setLastState(int state)
      setLastState.
      Parameters:
      state - Should be either Frame.NORMAL or Frame.ICONIFIED
    • setLinkedFrame

      public void setLinkedFrame(ViewJFrameImage linkFrame)
      Accessor that sets the link Frame.
      Parameters:
      linkFrame - set frame to link to.
    • setLinkedTriFrame

      public void setLinkedTriFrame(ViewJFrameTriImage linkTriFrame)
      Accessor that sets the link Frame.
      Parameters:
      linkTriFrame - set frame to link to.
    • setLUTa

      public void setLUTa(ModelLUT lut)
      Accessor that sets LUTa.
      Parameters:
      lut - DOCUMENT ME!
    • setLUTb

      public void setLUTb(ModelLUT lut)
      Accessor that sets LUTb.
      Parameters:
      lut - DOCUMENT ME!
    • setLUTs

      public void setLUTs(ModelLUT _LUTa, ModelLUT _LUTb)
      Sets LUTa and LUTb.
      Parameters:
      _LUTa - DOCUMENT ME!
      _LUTb - DOCUMENT ME!
    • setMessageText

      public final void setMessageText(String str)
      Accessor to set the text of the main frame's text field.
      Parameters:
      str - string to be display in the main frame's text field
    • setOpacityInfo

      public void setOpacityInfo(float _OPACITY, float _alphaBlend)
      Sets RGB Information.
      Parameters:
      _OPACITY - DOCUMENT ME!
      _alphaBlend - DOCUMENT ME!
    • setpaintBitmap

      public void setpaintBitmap(BitSet _paintBitmap)
      Sets the paint Bitmap.
      Parameters:
      _paintBitmap - DOCUMENT ME!
    • stateChanged

      public void stateChanged(ChangeEvent event)
      Does nothing.
      Specified by:
      stateChanged in interface ChangeListener
      Parameters:
      event - the change event
    • windowActivated

      public void windowActivated(WindowEvent event)
      Tells the UI that this frame is the currently active one.
      Specified by:
      windowActivated in interface WindowListener
      Parameters:
      event - the window event
    • windowClosed

      public void windowClosed(WindowEvent event)
      Does nothing.
      Specified by:
      windowClosed in interface WindowListener
      Parameters:
      event - the window event
    • windowClosing

      public void windowClosing(WindowEvent event)
      Cleans up the frame before closing.
      Specified by:
      windowClosing in interface WindowListener
      Parameters:
      event - the window event that triggered this method
    • windowDeactivated

      public void windowDeactivated(WindowEvent event)
      Does nothing.
      Specified by:
      windowDeactivated in interface WindowListener
      Parameters:
      event - the window event
    • windowDeiconified

      public void windowDeiconified(WindowEvent event)
      Does nothing.
      Specified by:
      windowDeiconified in interface WindowListener
      Parameters:
      event - the window event
    • windowIconified

      public void windowIconified(WindowEvent event)
      Does nothing.
      Specified by:
      windowIconified in interface WindowListener
      Parameters:
      event - the window event
    • windowOpened

      public void windowOpened(WindowEvent event)
      Does nothing.
      Specified by:
      windowOpened in interface WindowListener
      Parameters:
      event - the window event
    • finalize

      protected void finalize() throws Throwable
      Cleans memory.
      Overrides:
      finalize in class Object
      Throws:
      Throwable - the Exception raised by this method
    • makeString

      protected String makeString(float number, int decPts)
      Makes a string of a float with a specific number of decimal points.
      Parameters:
      number - number to be converted to a string
      decPts - the number of decimal points
      Returns:
      string representation of the number
    • setAbsPositionLabels

      protected void setAbsPositionLabels(WildMagic.LibFoundation.Mathematics.Vector3f position)
      Sets the Absolute position label.
      Parameters:
      position - DOCUMENT ME!
    • setScannerPosition

      protected void setScannerPosition(WildMagic.LibFoundation.Mathematics.Vector3f position)
      Sets the Scanner position label.
      Parameters:
      position - DOCUMENT ME!
    • handleZoomPopupMenu

      protected void handleZoomPopupMenu(Component component, MouseEvent event)
      DOCUMENT ME!
      Parameters:
      component - DOCUMENT ME!
      event - DOCUMENT ME!
    • handleMaskPopupMenu

      public static void handleMaskPopupMenu(Component component, MouseEvent event)
      Handles the popup menu for the Quick Mask buttons
      Parameters:
      component - DOCUMENT ME!
      event - DOCUMENT ME!
    • handlePaintToMaskPopupMenu

      protected void handlePaintToMaskPopupMenu(Component component, MouseEvent event)
      Handles the pop-up menu for Paint to Mask buttons (inside/outside)
      Parameters:
      component - DOCUMENT ME!
      event - DOCUMENT ME!
    • initExtents

      protected static int[] initExtents(ModelImage img)
      Get the extents of an image. (don't know why this is really needed...)
      Parameters:
      img - the image
      Returns:
      the image's extents
    • initImageBuffer

      protected static float[] initImageBuffer(int[] extents, boolean isColor, int imageType)
      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
    • 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)
    • 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
    • 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
    • initResolutions

      protected static float[] initResolutions(ModelImage img)
      DOCUMENT ME!
      Parameters:
      img - DOCUMENT ME!
      Returns:
      DOCUMENT ME!
    • 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)
    • initUnits

      protected static int[] initUnits(ModelImage img)
      DOCUMENT ME!
      Parameters:
      img - DOCUMENT ME!
      Returns:
      DOCUMENT ME!
    • initLUT

      public static ModelLUT initLUT(ModelImage img) throws 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:
      OutOfMemoryError - if enough memory cannot be allocated for this method
    • initRGB

      public static ModelRGB initRGB(ModelImage img) throws 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:
      OutOfMemoryError - if enough memory cannot be allocated for this method
    • initZoom

      protected static float initZoom(ModelImage img, float xResFactor, float yResFactor, int screenX, int screenY)
      Initializes the zoom variables for an image.
      Parameters:
      img - the image to use to initialize the zoom
      xResFactor - correction factor in the x direction for images that are do not have isotropic voxels
      yResFactor - correction factor in the x direction for images that are do not have isotropic voxels
      Returns:
      the initial zoom to use for this image
    • findFilter

      private FileFilter findFilter(JFileChooser chooser, int filterType)
      Finds the FileFilter that matches the file type.
      Parameters:
      chooser - JFileChooser
      filterType - int the file filter type
      Returns:
      FileFilter the filter that matches the filter type.
    • isImageResampleable

      private boolean isImageResampleable(ModelImage image)
      Returns whether an image can be resampled to match imageA for loading into the imageB slot of the frame.
      Parameters:
      image - the image to check
      Returns:
      true if the image is either 3D or 4D (but not if the 4th dim differs)
    • isResampleNeeded

      private boolean isResampleNeeded(ModelImage image)
      Returns whether a image should be resampled to match the extents and resolutions of imageA.
      Parameters:
      image - the image to check against imageA
      Returns:
      true if a resampling of the image is required
    • loadResampledImage

      private void loadResampledImage(ModelImage image)
      Resamples an image and loads it into the imageB slot. This image should already be matched against imageA.
      Parameters:
      image - the image to resample and load as imageB
    • reorderAfni

      private boolean reorderAfni(ModelImage image, int[] axisA, int[] axisB)
      Reorders the AFNI image based on the axis orientations. B0 to A1 indicates changing x to y; B0 to A2 indicates a change from x to z.
      Parameters:
      image - Image to reorder.
      axisA - axis indices orientation of reordered image
      axisB - axis indices orientation of original image
      Returns:
      true if the reordering of the Afni file is successful, false otherwise
    • setImageBAfni

      private int setImageBAfni(ModelImage imageA, ModelImage image)
      Sets image B to an AFNI image, performing the appropriate transformations.
      Parameters:
      imageA - Image A.
      image - AFNI image to set to image A.
      Returns:
      -1 if failure; 0 if no tranformation needed; and 1 if transformation and set successful.
    • transformACPC

      private void transformACPC(ModelImage image, float[] imgBuffer, TransMatrix xfrm, float iXres, float iYres, float iZres, int iXdim, int iYdim, int iZdim, int iTdim, int planeGap, int[] gapArray, boolean doNN, float oXres, float oYres, float oZres, int oXdim, int oYdim, int oZdim)
      This routine is designed to transform AFNI functional images which have already been transformed to match AFNI original images to match AFNI +acpc images.

      AFNI:Software for Analysis and Visualization of Functional Magnetic Resonance Neuroimages by Robert W. Cox states:

      "In some applications, gaps are present between the functional slices. For example, some investigators using sagittal functional images do not collect data that spans the longitudinal fissure, but instead leave a 3-5 mm gap there. The auxiliary program abut can provide zero-filled images to fill in the gaps, and can resample the nonzero slices to a finer mesh if needed(e.g., to fill a 2 mm gap in a series of 4 mm functional slices). Resampling in the slice select direction between contiguous input slices can be done using nearest- neighbor, linear, or cubic interpolation, at the user's discretion. Interpolation is not done across the boundaries between the gap-filling zero images and the nonzero user-supplied images; that is, interpolation is only done inside spatially contiguous blocks of actual input data."

      A second special consideration exists in the interpolation of functional data. The MCW AFNI - User Manual states: "In this version of AFNI, the threshold data (e.g., correlation coefficient) is always resampled using the nearest neighbor method. This is because thresholding with an interpolated nonlinear statistic is a somewhat dubious procedure." At another point the manual states: "Threshold data in functional datasets is always resampled using the nearest neighbor mode. This is becasue it is somewhat unreasonable to interpolate a nonlinear statistic (such as correlation coefficient) between voxels, and then to interpret this statistic using probabilistic models that assume independence."

      Thus, the intensity data is interpolated with trilinear interpolation and the threshold data is interpolated with nearest neighbor interpolation.

      Parameters:
      image - image being created
      imgBuffer - source image array
      xfrm - transformation matrix to be applied
      iXres - input x resolution
      iYres - input y resolution
      iZres - input z resolution
      iXdim - input x dimesnion
      iYdim - input y dimension
      iZdim - input z dimension
      iTdim - input t dimension
      planeGap - -1 if no zero filled gaps, 0 for x axis gaps, 1 for y axis, 2 for z axis
      gapArray - array of coordinates at which the zero filled planes occur
      doNN - true if functional, false if anatomical
      oXres - output x resolution
      oYres - output y resolution
      oZres - output z resolution
      oXdim - output x dimension
      oYdim - output y dimension
      oZdim - output z dimension
    • transformAFNI

      private void transformAFNI(ModelImage image, float[] imgBuffer, float iXres, float iYres, float iZres, int iXdim, int iYdim, int iZdim, int iTdim, float ilowXmm, float ilowYmm, float ilowZmm, float ihighXmm, float ihighYmm, float ihighZmm, int planeGap, int[] gapArray, boolean doNN, float oXres, float oYres, float oZres, int oXdim, int oYdim, int oZdim, float olowXmm, float olowYmm, float olowZmm, float ohighXmm, float ohighYmm, float ohighZmm)
      This routine is designed to transform AFNI functional images and AFNI 3D + time anatomical images to match AFNI original 3D anatomical images. Here the 3 axes of the 2 images are parallel and the spatial orientation of the 2 sets of axes are identical.

      AFNI:Software for Analysis and Visualization of Functional Magnetic Resonance Neuroimages by Robert W. Cox states:

      "In some applications, gaps are present between the functional slices. For example, some investigators using sagittal functional images do not collect data that spans the longitudinal fissure, but instead leave a 3-5 mm gap there. The auxiliary program abut can provide zero-filled images to fill in the gaps, and can resample the nonzero slices to a finer mesh if needed(e.g., to fill a 2 mm gap in a series of 4 mm functional slices). Resampling in the slice select direction between contiguous input slices can be done using nearest- neighbor, linear, or cubic interpolation, at the user's discretion. Interpolation is not done across the boundaries between the gap-filling zero images and the nonzero user-supplied images; that is, interpolation is only done inside spatially contiguous blocks of actual input data."

      A second special consideration exists in the interpolation of functional data. The MCW AFNI - User Manual states: "In this version of AFNI, the threshold data (e.g., correlation coefficient) is always resampled using the nearest neighbor method. This is because thresholding with an interpolated nonlinear statistic is a somewhat dubious procedure."

      At another point the manual states: "Threshold data in functional datasets is always resampled using the nearest neighbor mode. This is becasue it is somewhat unreasonable to interpolate a nonlinear statistic (such as correlation coefficient) between voxels, and then to interpret this statistic using probabilistic models that assume independence."

      Thus, the intensity data is interpolated with trilinear interpolation and the threshold data is interpolated with nearest neighbor interpolation.

      Parameters:
      image - image being created
      imgBuffer - source image array
      iXres - input x resolution
      iYres - input y resolution
      iZres - input z resolution
      iXdim - input x dimesnion
      iYdim - input y dimension
      iZdim - input z dimension
      iTdim - input t dimension
      ilowXmm - lowest valid input x location in space in millimeters
      ilowYmm - lowest valid input y location in space in millimeters
      ilowZmm - lowest valid input z location in space in millimeters
      ihighXmm - highest valid input x location in space in millimeters
      ihighYmm - highest valid input y location in space in millimeters
      ihighZmm - highest valid input z location in space in millimeters
      planeGap - -1 if no zero filled gaps, 0 for x axis gaps, 1 for y axis, 2 for z axis
      gapArray - array of coordinates at which the zero filled planes occur
      doNN - true if functional, false if anatomical
      oXres - output x resolution
      oYres - output y resolution
      oZres - output z resolution
      oXdim - output x dimension
      oYdim - output y dimension
      oZdim - output z dimension
      olowXmm - lowest valid output x location in space in millimeters
      olowYmm - lowest valid output y location in space in millimeters
      olowZmm - lowest valid output z location in space in millimeters
      ohighXmm - highest valid output x location in space in millimeters
      ohighYmm - highest valid output y location in space in millimeters
      ohighZmm - highest valid output z location in space in millimeters
    • transformTalairach

      private void transformTalairach(ModelImage image, float[] imgBuffer, TransMatrix xfrm, float iXres, float iYres, float iZres, int iXdim, int iYdim, int iZdim, int iTdim, int planeGap, int[] gapArray, boolean doNN, float oXres, float oYres, float oZres, int oXdim, int oYdim, int oZdim, int botX, int botY, int botZ, int topX, int topY, int topZ)
      This routine is designed to transform AFNI functional images which have already been transformed to match AFNI original images to match AFNI +tlrc images.

      AFNI:Software for Analysis and Visualization of Functional Magnetic Resonance Neuroimages by Robert W. Cox states:

      "In some applications, gaps are present between the functional slices. For example, some investigators using sagittal functional images do not collect data that spans the longitudinal fissure, but instead leave a 3-5 mm gap there. The auxiliary program abut can provide zero-filled images to fill in the gaps, and can resample the nonzero slices to a finer mesh if needed(e.g., to fill a 2 mm gap in a series of 4 mm functional slices). Resampling in the slice select direction between contiguous input slices can be done using nearest- neighbor, linear, or cubic interpolation, at the user's discretion. Interpolation is not done across the boundaries between the gap-filling zero images and the nonzero user-supplied images; that is, interpolation is only done inside spatially contiguous blocks of actual input data."

      A second special consideration exists in the interpolation of functional data. The MCW AFNI - User Manual states: "In this version of AFNI, the threshold data (e.g., correlation coefficient) is always resampled using the nearest neighbor method. This is because thresholding with an interpolated nonlinear statistic is a somewhat dubious procedure." At another point the manual states: "Threshold data in functional datasets is always resampled using the nearest neighbor mode. This is becasue it is somewhat unreasonable to interpolate a nonlinear statistic (such as correlation coefficient) between voxels, and then to interpret this statistic using probabilistic models that assume independence."

      Thus, the intensity data is interpolated with trilinear interpolation and the threshold data is interpolated with nearest neighbor interpolation.

      Parameters:
      image - image being created
      imgBuffer - source image array
      xfrm - transformation matrix to be applied
      iXres - input x resolution
      iYres - input y resolution
      iZres - input z resolution
      iXdim - input x dimesnion
      iYdim - input y dimension
      iZdim - input z dimension
      iTdim - input t dimension
      planeGap - -1 if no zero filled gaps, 0 for x axis gaps, 1 for y axis, 2 for z axis
      gapArray - array of coordinates at which the zero filled planes occur
      doNN - true if functional, false if anatomical
      oXres - output x resolution
      oYres - output y resolution
      oZres - output z resolution
      oXdim - output x dimension
      oYdim - output y dimension
      oZdim - output z dimension
      botX - lowest x output value in this 1 of the 12 Talairach regions
      botY - lowest y output value in this 1 of the 12 Talairach regions
      botZ - lowest z output value in this 1 of the 12 Talairach regions
      topX - highest x output value in this 1 of the 12 Talairach regions
      topY - highest y output value in this 1 of the 12 Talairach regions
      topZ - highest z output value in this 1 of the 12 Talairach regions