Class ViewUserInterface

  • All Implemented Interfaces:
    ScriptRecordingListener, CommandLineParser, java.awt.event.ActionListener, java.awt.event.KeyListener, java.awt.event.WindowListener, java.util.EventListener

    public class ViewUserInterface
    extends java.lang.Object
    implements java.awt.event.ActionListener, java.awt.event.WindowListener, java.awt.event.KeyListener, ScriptRecordingListener, CommandLineParser
    This class is the _glue_ keeps a record of the present structure of the application. It keeps a list of all the image frames presently being displayed and keeps a hash table of all the images (ModelImage) open in the application. In addition, this class keeps a reference to the main MIPAV frame and the message frame with much of the imaging results are output.
    Version:
    1.1 June 1, 2012
    Author:
    Justin Senseney, Matthew McAuliffe, Ph.D.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected java.util.Vector<javax.swing.JMenuBar> aloneMenu
      Stores all stand-alone menus that have been created by the user.
      private javax.swing.JButton btnGpuComp
      The button indicating that MIPAV is set to run OpenCL -- GPU based algorithms
      private javax.swing.JButton btnMultiCore
      The button indicating that MIPAV is set to run in a threaded environment
      private TransMatrix clippedMatrix
      Matrix for copy/paste actions in image's or between image's matrix edit panel.
      private java.util.Vector<java.util.Vector<WildMagic.LibFoundation.Mathematics.Vector3f>> clippedScannerVectors
      DOCUMENT ME!
      private ViewVOIVector clippedVOIs
      Vector to hold clipped VOIs (multiple).
      private java.lang.String cmdLineArguments
      String holding the command line arguments for data provenance usage.
      private java.util.Vector<VOIBase> copyVOIList
      Vector to hold clipped VOIs (multiple).
      private java.util.Vector<java.lang.String> copyVOINameList
      Vector to hold VOI names (multiple).
      private DICOM_Receiver DICOMcatcher
      Reference to the DICOM receiver that listens for DICOM formatted images sent by a DICOM server.
      private ViewJFrameDICOMQuery DICOMQueryFrame
      DICOM query frame for sending and receiving DICOM images.
      private JDialogDataProvenance dpDialog
      Dialog to display the mipav system data provenance
      private static java.io.File exceptions
      Exception logging file
      private boolean exitCmdLineOnError
      error handling for cmd line, if set to false will not exit on MipavUtil.displayError()
      private boolean forceAlgorithmInPlace
      boolean to force the algorithm to replace the image rather than opening a new frame
      private java.awt.Dimension frameLocation
      Location of new image frames.
      private java.util.Vector<java.awt.Frame> imageFrameVector
      Stores array of images frames the first of which is the active image frame.
      private CustomHashtable<ModelImage> imageHashtable
      A list of image models currently open in MIPAV.
      private ViewJFrameRegisteredImages imgMonitorFrame
      Frame that monitors the registered images.
      private boolean isAppFrameVisible
      Whether the mipav GUI should be shown; set by the -hide command line option.
      private boolean isPlugInFrameVisible
      Whether a plugin standalone frame is visible
      private JarClassLoader jarClassLoader
      Class/resource loader for plugins that are in jars
      private boolean lastStackFlag
      Indicates the user's last choice of whether to open images as multi-file (stack) or single file in the file open dialog.
      private static java.lang.String LOADING_STR
      String to use as the progress bar loading prefix.
      protected javax.swing.JFrame mainFrame
      The main menu bar that runs MIPAV.
      private JDialogMemoryAllocation mallocFrame
      Dialog that allows changes to the amount of heap requested of the system by the java Virtual Machine for MIPAV during java start.
      private ViewJFrameMemory memoryFrame
      Dialog that displays the used and available memory.
      private javax.swing.JLabel memoryUsageLabel
      The label showing the current memory usage of MIPAV.
      private ViewUserInterface.MemoryUsageUpdater memoryUsageUpdater
      The periodic thread which updates the memory usage display once every second.
      protected ViewMenuBuilder menuBuilder
      The object used to build and enable/select the menus.
      protected javax.swing.JTextField messageField
      Message line at the bottom of the mainFrame.
      protected ViewJFrameMessage messageFrame
      Message area for multi-line text output.
      private int numTileSheets
      if user selects to open images as tiles, then this counter tells us how many tile sheets there are*
      private static java.lang.String OPENING_STR
      String to use as the progress bar opening prefix.
      protected javax.swing.JMenuBar openingMenuBar
      Initial menubar for MIPAV.
      private JDialogMipavOptions optionsDialog
      Dialog that allows changes to the amount of heap requested of the system by the java Virtual Machine for MIPAV during java start.
      private static java.lang.String outputDir
      This is the outputDir path that the user entered as a command line argument when running a script *
      private javax.swing.JMenu pluginsMenu
      Stores the plugins menu so that it can be removed/updated when plugins are installed.
      private java.lang.String progressBarPrefix
      The current progress bar prefix to use.
      private static boolean providedOutputDir
      This boolean tells if the user has provided an ouputDir parameter as a command line argument when running a script
      private static boolean providedUserDefaultDir
      This boolean tells if the user has provided an inputDir parameter as a command line argument when running a script
      private static JDialogShortcutEditor shortcutEd
      Key shortcut editor dialog.
      private boolean shortcutRecording
      Indicates whether the user is currently recording a new keyboard shortcut using the shortcut editor dialog.
      private ProvenanceHolder systemDPHolder
      System DP holder (separate from images data provenance...this has everything).
      private static java.util.Vector<java.lang.String> tempDirList  
      private static java.lang.String userDefaultDir
      This is the inputDir path that the user entered as a command line argument when running a script *
      protected static ViewUserInterface userInterfaceReference
      A reference to the only ViewUserInterface object in MIPAV.
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected ViewUserInterface()
      Constructs main UI frame.
      protected ViewUserInterface​(boolean forceQuiet)
      Constructs main UI frame.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      void about()
      Creates simple dialog that describes basic info about MIPAV, with MIPAV as the title.
      void about​(java.lang.String title, java.lang.String filename)
      Creates a fairly simple plain-text viewing box.
      void aboutDataProvenance()
      Displays the system data provenance using a simple dialog with table and jtextarea (for current selection).
      void aboutJava()
      Creates simple dialog that describes basic info about the version of Java.
      void actionPerformed​(java.awt.event.ActionEvent event)
      Calls various methods based on the user's actions.
      boolean addAloneMenu​(javax.swing.JMenuBar menu)
      Adds a standalone menu to the user interface.
      private void addPluginToMenu​(java.lang.Class<?> plugin, java.lang.String pluginName, java.lang.String name, javax.swing.JMenu currentMenu, java.awt.event.ActionListener al, java.lang.String jarContainer)  
      static void addToTempDirList​(java.lang.String path)  
      void buildAnonDirectoryDialog()
      Builds the anonymize directory dialog and displays it.
      JDialogDicomDir buildDICOMDIRFrame()
      Builds the image tree dialog and displays it.
      ViewJFrameDICOMParser buildDICOMFrame()
      Builds the image tree dialog and displays it.
      void buildEditDICOMFrame()
      Builds the edit dicom tag interface.
      javax.swing.JMenuBar buildMenu()
      Builds menus for the User Interface.
      ViewJFrameMessage buildMessageFrame()
      Builds the message frame where user/program data can be displayed.
      javax.swing.JMenu buildPlugInsMenu​(java.awt.event.ActionListener al)
      Called by either userInterface (this) or by another actionlistener (ViewJFrameImage) to build the plugins menu bar.
      void buildTreeDialog()
      Builds the image tree dialog and displays it.
      void changeRecordingStatus​(int recorderStatus)
      Alerts the listener to a change in whether the ScriptRecorder is currently recording a script.
      private void checkHeapMaxAgainstPreferences()
      Test for VM memory sizes being the same as last run in preferences: displays a user-warning that the preferences & VM config files disagree and presents the JDialogMemoryAllocation dialog with "use preference" buttons to quicken the matching process.
      static void checkPrefDirCommand​(java.lang.String[] args, int initArg)
      If the preferences name command is about to be performed before an existing preferences directory command, this guarantees that the directory command will be executed first.
      void cleanupAndExit()  
      void clearAllDataText()
      Accessor to clear all of data frame.
      void clearClippedVOIs()
      Deprecated. 
      void closeAllImages()
      this method closes all registered images
      void copyClippedVOIs​(ViewVOIVector copyList)
      Deprecated. 
      void copyVOIs​(java.util.Vector<VOIBase> copyList)  
      static ViewUserInterface create()
      This method should only be called once, and it should only be called by MipavMain to during the initialization of MIPAV.
      ModelImage createBlankImage​(FileInfoBase fileInfo)
      Creates a blank Image based on the information found in the fileInfo object and places it in a frame.
      ModelImage createBlankImage​(FileInfoBase fileInfo, boolean doDisplay, boolean allowRecording)
      Creates a blank Image based on the information found in the fileInfo object.
      ModelImage createEmptyImage​(FileInfoBase fileInfo)
      Creates a blank Image based on the information found in the default fileInfo object.
      private void deleteItem​(java.lang.String name, boolean deleteFrame, boolean runGC)
      Deletes the item specified by name.
      private void deleteMenu​(javax.swing.JMenu menu)
      Recursive deletion algorithm to delete JMenus which contain no JMenuItems exclusive of JMenus in any children.
      boolean doExitCmdLineOnError()
      Tells whether or not to exit on an error when running from the command line
      boolean doForceInPlace()
      Checks whether the dialog should force the algorithm to replace the image (no new frame)
      void enableOutputWindow​(boolean doShowFrame)
      Toggles the display of the Output window and updates all JFrameImages so that the menu checkbox will reflect the status of the output window.
      static java.lang.String generateCmdUsageInfo()
      Generates automatic list of available commands.
      ViewJFrameImage getActiveImageFrame()
      Accessor that returns the active image frame vector.
      java.lang.String getAppTitle()
      Accessor to get the title of this application.
      TransMatrix getClippedMatrix()
      Retrieves the clipped matrix for paste action.
      java.util.Vector<java.util.Vector<WildMagic.LibFoundation.Mathematics.Vector3f>> getClippedScannerVectors()
      Deprecated. 
      ViewVOIVector getClippedVOIs()
      Deprecated. 
      java.lang.String getCmdLineArguments()
      Returns the Command line arguments (as one string, each separated by a space) .
      java.util.Vector<java.lang.String> getCopyVOINames()  
      java.util.Vector<VOIBase> getCopyVOIs()  
      java.lang.String getDefaultDirectory()
      Accessor to get directory location of last file access.
      java.lang.String getDefaultScriptDirectory()
      Accessor to get directory location of script files.
      DICOM_Receiver getDICOMCatcher()
      Accessor to get the DICOM receiver.
      ViewJFrameDICOMQuery getDICOMQueryFrame()
      Accessor to get the DICOM query frame.
      static java.util.Vector<java.lang.Class<ActionDiscovery>> getDiscoverableActionList()  
      static java.util.Vector<java.lang.Class<ActionDiscovery>> getDiscoverableActionList​(java.lang.String baseDir)  
      static java.io.File getExceptions()  
      ViewJFrameImage getFrameContainingImage​(ModelImage image)
      Accessor that returns the active image frame vector.
      java.util.Vector<java.awt.Frame> getImageFrameVector()
      Accessor that returns frame vector.
      JarClassLoader getJarClassLoader()  
      java.lang.String getLastScript()
      Returns the last script file used from the preferences.
      boolean getLastStackFlag()
      Gets the last checkbox entry for "multi-file" for opening images.
      javax.swing.JFrame getMainFrame()
      Accessor that returns the main user interface frame.
      ViewMenuBuilder getMenuBuilder()
      Returns the interface's menu builder.
      ViewJFrameMessage getMessageFrame()
      Accessor that returns the message frame.
      java.lang.String getMessageText()
      Accessor to get text of message field.
      java.awt.Dimension getNewFrameLocation​(int newImageXDim, int newImageYDim)
      Changes location of image when first displayed.
      java.awt.Dimension getNewFrameYLocation()
      Changes vertical location of image when first displayed.
      static java.lang.String getOutputDir()  
      java.lang.String getProgressBarPrefix()
      Gets the string "Opening " or "Loading " based on what the progress bar should be displaying.
      ProvenanceHolder getProvenanceHolder()
      Accessor for the mipav's data provenance .
      static ViewUserInterface getReference()
      Get a reference to the ViewUserInterface object.
      int getRegisteredFramedImagesNum()
      Return an num of images with frames(elements) from the image hashtable.
      ModelImage getRegisteredImageByName​(java.lang.String name)
      Return a registered image from the image hashtable based on the name of the image.
      java.util.Enumeration<java.lang.String> getRegisteredImageNames()
      Return an enumeration of keys (image names) from the image hashtable.
      java.util.Enumeration<ModelImage> getRegisteredImages()
      Return an enumeration of images (elements) from the image hashtable.
      int getRegisteredImagesNum()
      Return an num of images (elements) from the image hashtable.
      static java.io.File getSecondaryPluginsDir()  
      static java.lang.String getUserDefaultDir()  
      void imageRegistryMonitoring()
      Display image registry frame.
      void imagesToFront()
      Brings all images and message frame to the front.
      protected javax.swing.JPanel initCreateMemoryUsagePanel()
      Construct the panel which displays the current memory usage/limit and a garbage collection button.
      protected void initCreateMessageBar()
      Create the panel containing components which show the application title initially, and will later be used to show image coordinates and intensities.
      protected javax.swing.JTextField initCreateMessageField​(java.lang.String title)
      Creates the message field for the main frame using the title given.
      protected javax.swing.JPanel initCreateMultiCoreGpuIndicatorPanel()
      Construct the panel which displays whether the CPU and GPU could be utilized by algorithms based on the preferences settings by the user.
      protected void initDicomReceiver()
      Starts the DICOM receiver if the flag in the preference file is true.
      void initializeGui()
      Initializes the user interface.
      protected void initMacintoshJDKversionCheck()
      Method checks to verify that when running on a Machintosh, the JDK version is at least 1�x2e;4.
      protected void initPrefsFile()
      Set the preferences file to use (Preferences defaults to mipav.preferences).
      protected void initPrefsTrim()
      Gets the TRIM_VOI, TRIM_MASK and TRIM_FLAG values from the preferences file, and if it cannot find them, it sets to some default value: TRIM_VOI will be 0.3, TRIM_MASK will be 0.0, and TRIM_FLAG will be true.
      protected void initSetMainFrameDefaults​(java.awt.LayoutManager prefLayout, boolean resize)
      Sets the layout of the Main Frame with the given, preferred layout manager; makes the main frame resizable as given; makes this class a window-listener; sets the default operation to do nothing on close; and the icon is set.
      protected void initSetTitles​(java.lang.String mainFrameTitle, java.lang.String appTitle)
      Sets the titles for for the main frame and the application using the strings given.
      protected void initUsingPreferences()
      Performs a variety of start-up operations based on user-preferences; First, it tries to read from the preferences file; if it cannot, it sets the user directory.
      boolean isAppFrameVisible()
      Accessor to check whether the application frame visible or not.
      boolean isImageHashtableEmpty()
      Indicates if the image hashtable is empty.
      boolean isImageRegistered​(java.lang.String imageName)
      Indicates if the image name is found in the hashtable.
      boolean isPlugInFrameVisible()
      Accessor to see if a stand-alone plugin frame is visible (not app frame)
      static boolean isProvidedOutputDir()
      This is the getter for providedOutputDir providedOutputDir: This boolean tells if the user has provided an ouputDir parameter as a command line argument when running a script
      static boolean isProvidedUserDefaultDir()  
      boolean isShorcutRecording()
      Determines if the UserInterface is currently recording an action command as a shortcut.
      void keyPressed​(java.awt.event.KeyEvent e)
      Pass the key event to the selected image frame (if one exists).
      void keyReleased​(java.awt.event.KeyEvent e)
      Pass the key event to the selected image frame (if one exists).
      void keyTyped​(java.awt.event.KeyEvent e)
      Pass the key event to the selected image frame (if one exists).
      private void loadMouseDrivers()  
      void memoryAllocation()
      Display memory allocation frame (request more from the JVM on next JVM-start).
      void memoryFrame()
      Display memory usage frame.
      void openImageFrame()
      This method opens an image and puts it into a frame.
      void openImageFrame​(java.lang.String imageFile)
      Open an image and put it into a new frame, given the image file name.
      void openImageFrame​(java.lang.String imageFile, boolean multiFile)
      Open an image or images and put it into a new frame, given the image file name.
      void openImageFrame​(java.lang.String imageFileName, java.lang.String imageFileDir)
      Open an image and put it into a new frame, given the image file name.
      void openJSONImageFrames()  
      void openLastImage​(int index)
      Attempts to open an image from the quicklist.
      void options()
      Display Options dialog for all mipav options (including image specific options) to allow user to adjust display in one place.
      int parseArguments​(java.lang.String[] args, int initArg)
      Required by the CommandLineParser interface.
      static int parseStaticArguments​(java.lang.String[] args, int initArg)
      Required by the CommandLineParser interface.
      static void printUsageAndExit()
      Displays command line help information on usage of all commands and then exits.
      static void printUsageAndExit​(Argument c)
      Displays command line help information on usage to standard out and then into an informational dialog box then exits the MIPAV application.
      void regFrame​(java.awt.Frame frame)
      Method that registers an image frame by putting it in the image frame vector and does NOT loads controls.
      void registerFrame​(java.awt.Frame frame)
      Method that registers an image frame by adding it to the vector and loads controls.
      java.lang.String registerImage​(ModelImage image)
      Register image model by adding it to the image hashtable.
      java.lang.String registerImage​(java.lang.String key, ModelImage image)
      Register image model by adding it to the image hashtable.
      boolean removeAloneMenu​(javax.swing.JMenuBar menu)
      Removes the stand-alone menu from the user interface.
      protected void runCmdLine​(java.lang.String scriptFile, java.util.Vector<ViewUserInterface.OpenFileInfo> imageList, java.util.Vector<java.util.Vector<java.lang.String>> voiList)
      This method is used when running MIPAV from the command line.
      void setActiveFrame​(java.awt.Frame frame)
      Method sets the parameter frame to top and active.
      void setAppFrameVisible​(boolean isVisible)
      Tells the application to show the MIPAV UI or suppress it (progress bars, image frames, etc).
      void setClippedMatrix​(TransMatrix tMat)
      Sets the clipped matrix for copy/paste actions.
      void setControls()
      Sets the menu for the main frame.
      void setDataText​(java.lang.String str)
      Accessor to set text of data FRAME.
      void setDefaultDirectory​(java.lang.String defaultDirectory)
      Sets directory location of last file access.
      void setDefaultScriptDirectory​(java.lang.String dir)
      Sets directory location of the script files.
      void setDICOMCatcher​(DICOM_Receiver rcv)
      Accessor to set the DICOM receiver.
      void setDICOMQueryFrame​(ViewJFrameDICOMQuery frame)
      Accessor to set the DICOM query frame.
      void setExitCmdLineOnError​(boolean doExit)
      Sets MIPAV to exit (true) or not (false) on an error when running from the command line
      void setForceInPlace​(boolean doForce)
      Sets the dialogs to only replace the image (no new frame)
      void setGlobalDataText​(java.lang.String str)
      Accessor to set text of global data FRAME.
      void setJarClassLoader​(JarClassLoader jarClassLoader)  
      void setLastScript​(java.lang.String script)
      Sets last used script files in preferences.
      void setLastStackFlag​(boolean lastStackFlag)
      Sets the last value for opened multi-files (or single).
      void setLoad​(boolean doLoad)
      Tells the progress bar to say "Loading" rather than "Opening" for images being loaded if true.
      private void setMenuActionListeners​(java.awt.Component comp, java.awt.event.ActionListener frame)  
      void setMessageText​(java.lang.String str)
      Accessor to set text of message field.
      static void setOutputDir​(java.lang.String outputDir)  
      void setPlugInFrameVisible​(boolean isVisible)
      Tells the UI that a standalone plugin frame is visible
      static void setProvidedOutputDir​(boolean providedOutputDir)  
      static void setProvidedUserDefaultDir​(boolean providedUserDefaultDir)  
      static void setSecondaryPluginsDir​(java.io.File secondaryPluginsDir)  
      void setShortcutRecording​(boolean doRecord)
      Sets the UI to either be/not be recording action command.
      void setTitle​(java.lang.String str)
      Gets the application title from the preference file and prepends to the string passed into the method and displays the resultant string in the title of the main frame.
      static void setUserDefaultDir​(java.lang.String userDefaultDir)  
      void setUseVOIName​(boolean useName)
      Sets the Preference to use VOI Names instead of labels, then updates all frames to reflect this change with their VOIs.
      void setVisible​(boolean visible)
      Change whether the GUI should be visible.
      void showLicense()
      Displays the MIPAV Software Transfer Agreement in a JDialogText window.
      void showLicense​(java.lang.String title, java.lang.String filename)
      Displays the MIPAV Software Transfer Agreement in a JDialogText window.
      void showShortcutEditor​(boolean doUpdate)
      Opens a dialog for viewing/modifying shortcuts.
      void showSplashGraphics()
      Shows the MIPAV splash screen for a few seconds, or until the user clicks it.
      void unregisterFrame​(java.awt.Frame frame)
      Method that unregisters an image frame by removing it from the image frame vector.
      void unregisterFrame​(java.awt.Frame frame, boolean closeAll)
      Method that unregisters an image frame by removing it from the image frame vector.
      void unRegisterImage​(ModelImage image)
      Unregister image model by removing it from the image hashtable.
      void unRegisterImage​(java.lang.String imageKey)
      Unregister image model by removing it from the image hashtable given the key to the hashtable.
      void updateGpuUsage()
      This method updates the "whether algorithms will use the GPU" when the relevant button has been pushed in either the preferences pane.
      void updateMemoryUsage()
      This method is a callback method.
      void updateMultiCoreUsage()
      This method updates the "whether multi-core should be used" button when the relevant button has been pushed in either the preferences pane.
      void updateScript​(java.lang.String newScriptText)
      Do nothing - required by ScriptRecordingListener interface.
      void windowActivated​(java.awt.event.WindowEvent event)
      Do nothing.
      void windowClosed​(java.awt.event.WindowEvent event)
      Do nothing.
      void windowClosing​(java.awt.event.WindowEvent event)
      Confirms if the user really wants to exit, then closes the application.
      void windowDeactivated​(java.awt.event.WindowEvent event)
      Do nothing.
      void windowDeiconified​(java.awt.event.WindowEvent event)
      Deiconify only the other frames who's last state was normal (ie- restore other frames to their lastState).
      void windowIconified​(java.awt.event.WindowEvent event)
      Iconify all other frames associateed with MIPAV.
      void windowOpened​(java.awt.event.WindowEvent event)
      Do nothing.
      void writeDataProvenance()
      Writes Mipav's data provenance to the default location.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • OPENING_STR

        private static final java.lang.String OPENING_STR
        String to use as the progress bar opening prefix.
        See Also:
        Constant Field Values
      • LOADING_STR

        private static final java.lang.String LOADING_STR
        String to use as the progress bar loading prefix.
        See Also:
        Constant Field Values
      • providedUserDefaultDir

        private static boolean providedUserDefaultDir
        This boolean tells if the user has provided an inputDir parameter as a command line argument when running a script
      • userDefaultDir

        private static java.lang.String userDefaultDir
        This is the inputDir path that the user entered as a command line argument when running a script *
      • providedOutputDir

        private static boolean providedOutputDir
        This boolean tells if the user has provided an ouputDir parameter as a command line argument when running a script
      • outputDir

        private static java.lang.String outputDir
        This is the outputDir path that the user entered as a command line argument when running a script *
      • mainFrame

        protected javax.swing.JFrame mainFrame
        The main menu bar that runs MIPAV.
      • menuBuilder

        protected ViewMenuBuilder menuBuilder
        The object used to build and enable/select the menus.
      • messageField

        protected javax.swing.JTextField messageField
        Message line at the bottom of the mainFrame.
      • messageFrame

        protected ViewJFrameMessage messageFrame
        Message area for multi-line text output. The message area has the ability to save/copy/paste the data to a file or clip board. This frame contains the Global Data, Data, Logging and Debug text areas. The Global and Debug text areas are common to all images (i.e. there is only one). The Data and logging window are unique and associated to their respect image.
      • openingMenuBar

        protected javax.swing.JMenuBar openingMenuBar
        Initial menubar for MIPAV.
      • clippedMatrix

        private TransMatrix clippedMatrix
        Matrix for copy/paste actions in image's or between image's matrix edit panel.
      • clippedScannerVectors

        private final java.util.Vector<java.util.Vector<WildMagic.LibFoundation.Mathematics.Vector3f>> clippedScannerVectors
        DOCUMENT ME!
      • clippedVOIs

        private final ViewVOIVector clippedVOIs
        Vector to hold clipped VOIs (multiple).
      • copyVOIList

        private java.util.Vector<VOIBase> copyVOIList
        Vector to hold clipped VOIs (multiple).
      • copyVOINameList

        private final java.util.Vector<java.lang.String> copyVOINameList
        Vector to hold VOI names (multiple).
      • jarClassLoader

        private JarClassLoader jarClassLoader
        Class/resource loader for plugins that are in jars
      • cmdLineArguments

        private java.lang.String cmdLineArguments
        String holding the command line arguments for data provenance usage.
      • DICOMcatcher

        private DICOM_Receiver DICOMcatcher
        Reference to the DICOM receiver that listens for DICOM formatted images sent by a DICOM server.
      • DICOMQueryFrame

        private ViewJFrameDICOMQuery DICOMQueryFrame
        DICOM query frame for sending and receiving DICOM images.
      • frameLocation

        private final java.awt.Dimension frameLocation
        Location of new image frames. This location is updated with each additional image opened.
        See Also:
        #getNewFrameLocation()
      • imageFrameVector

        private final java.util.Vector<java.awt.Frame> imageFrameVector
        Stores array of images frames the first of which is the active image frame.
      • isAppFrameVisible

        private boolean isAppFrameVisible
        Whether the mipav GUI should be shown; set by the -hide command line option.
      • isPlugInFrameVisible

        private boolean isPlugInFrameVisible
        Whether a plugin standalone frame is visible
      • lastStackFlag

        private boolean lastStackFlag
        Indicates the user's last choice of whether to open images as multi-file (stack) or single file in the file open dialog.
      • mallocFrame

        private JDialogMemoryAllocation mallocFrame
        Dialog that allows changes to the amount of heap requested of the system by the java Virtual Machine for MIPAV during java start.
      • memoryFrame

        private ViewJFrameMemory memoryFrame
        Dialog that displays the used and available memory.
      • memoryUsageLabel

        private javax.swing.JLabel memoryUsageLabel
        The label showing the current memory usage of MIPAV.
      • btnMultiCore

        private javax.swing.JButton btnMultiCore
        The button indicating that MIPAV is set to run in a threaded environment
      • btnGpuComp

        private javax.swing.JButton btnGpuComp
        The button indicating that MIPAV is set to run OpenCL -- GPU based algorithms
      • optionsDialog

        private JDialogMipavOptions optionsDialog
        Dialog that allows changes to the amount of heap requested of the system by the java Virtual Machine for MIPAV during java start.
      • pluginsMenu

        private javax.swing.JMenu pluginsMenu
        Stores the plugins menu so that it can be removed/updated when plugins are installed.
      • aloneMenu

        protected java.util.Vector<javax.swing.JMenuBar> aloneMenu
        Stores all stand-alone menus that have been created by the user.
      • progressBarPrefix

        private java.lang.String progressBarPrefix
        The current progress bar prefix to use.
      • shortcutRecording

        private boolean shortcutRecording
        Indicates whether the user is currently recording a new keyboard shortcut using the shortcut editor dialog.
      • systemDPHolder

        private ProvenanceHolder systemDPHolder
        System DP holder (separate from images data provenance...this has everything).
      • forceAlgorithmInPlace

        private boolean forceAlgorithmInPlace
        boolean to force the algorithm to replace the image rather than opening a new frame
      • exitCmdLineOnError

        private boolean exitCmdLineOnError
        error handling for cmd line, if set to false will not exit on MipavUtil.displayError()
      • numTileSheets

        private int numTileSheets
        if user selects to open images as tiles, then this counter tells us how many tile sheets there are*
      • exceptions

        private static java.io.File exceptions
        Exception logging file
      • tempDirList

        private static java.util.Vector<java.lang.String> tempDirList
    • Constructor Detail

      • ViewUserInterface

        protected ViewUserInterface()
        Constructs main UI frame. Accesses the .preferences file to set up variables. Sets up DICOM hashtable for reading in DICOM files and starts the catcher, if appropriate. This method cannot be called directly. To use this constructor, you must call createReference. This class is a singleton, which means that only one type of this class is allowed to be instantiated in a single VM.
      • ViewUserInterface

        protected ViewUserInterface​(boolean forceQuiet)
        Constructs main UI frame. Accesses the .preferences file to set up variables. Sets up DICOM hashtable for reading in DICOM files and starts the catcher, if appropriate. This method cannot be called directly. To use this constructor, you must call createReference. This class is a singleton, which means that only one type of this class is allowed to be instantiated in a single VM.
        Parameters:
        forceQuiet - Mipav will not display any error, warning, or info messages. If a error displays MIPAV will exit.
    • Method Detail

      • create

        public static ViewUserInterface create()
        This method should only be called once, and it should only be called by MipavMain to during the initialization of MIPAV.
        Returns:
        ViewUserInterface
      • getReference

        public static ViewUserInterface getReference()
        Get a reference to the ViewUserInterface object.
        Returns:
        ViewUserInterface
      • about

        public void about()
        Creates simple dialog that describes basic info about MIPAV, with MIPAV as the title.
      • about

        public void about​(java.lang.String title,
                          java.lang.String filename)
        Creates a fairly simple plain-text viewing box.
        Parameters:
        title - the title for the about frame.
        filename - the filename of the about file to display.
      • aboutDataProvenance

        public void aboutDataProvenance()
        Displays the system data provenance using a simple dialog with table and jtextarea (for current selection).

        .

      • aboutJava

        public void aboutJava()
        Creates simple dialog that describes basic info about the version of Java.
      • addAloneMenu

        public boolean addAloneMenu​(javax.swing.JMenuBar menu)
        Adds a standalone menu to the user interface.
        Parameters:
        menu - the standalone JMenu
        Returns:
        whether addition to the vector was successful
      • actionPerformed

        public void actionPerformed​(java.awt.event.ActionEvent event)
        Calls various methods based on the user's actions.
        Specified by:
        actionPerformed in interface java.awt.event.ActionListener
        Parameters:
        event - Event that triggered this function.
      • createEmptyImage

        public ModelImage createEmptyImage​(FileInfoBase fileInfo)
        Creates a blank Image based on the information found in the default fileInfo object.
        Parameters:
        fileInfo - This object contains the enough image information to build a ModelImage with nothing inside (eg. blank image).
        image - Created blank image.
      • copyClippedVOIs

        @Deprecated
        public void copyClippedVOIs​(ViewVOIVector copyList)
        Deprecated.
        Copies into the VOI clipboard.
        Parameters:
        voi - VOI
      • copyVOIs

        public void copyVOIs​(java.util.Vector<VOIBase> copyList)
      • buildAnonDirectoryDialog

        public void buildAnonDirectoryDialog()
        Builds the anonymize directory dialog and displays it.
      • buildDICOMFrame

        public ViewJFrameDICOMParser buildDICOMFrame()
        Builds the image tree dialog and displays it.
      • buildEditDICOMFrame

        public void buildEditDICOMFrame()
        Builds the edit dicom tag interface.
      • buildDICOMDIRFrame

        public JDialogDicomDir buildDICOMDIRFrame()
        Builds the image tree dialog and displays it.
      • buildMenu

        public javax.swing.JMenuBar buildMenu()
        Builds menus for the User Interface.
      • buildMessageFrame

        public ViewJFrameMessage buildMessageFrame()
        Builds the message frame where user/program data can be displayed.
      • buildPlugInsMenu

        public javax.swing.JMenu buildPlugInsMenu​(java.awt.event.ActionListener al)
        Called by either userInterface (this) or by another actionlistener (ViewJFrameImage) to build the plugins menu bar.
        Parameters:
        al - the listener that wants to know about actions on the plugins menu
        Returns:
        the new plugin menu
      • addPluginToMenu

        private void addPluginToMenu​(java.lang.Class<?> plugin,
                                     java.lang.String pluginName,
                                     java.lang.String name,
                                     javax.swing.JMenu currentMenu,
                                     java.awt.event.ActionListener al,
                                     java.lang.String jarContainer)
      • deleteMenu

        private void deleteMenu​(javax.swing.JMenu menu)
        Recursive deletion algorithm to delete JMenus which contain no JMenuItems exclusive of JMenus in any children.
        Parameters:
        menu - The menu to run through deletion
      • loadMouseDrivers

        private void loadMouseDrivers()
      • buildTreeDialog

        public void buildTreeDialog()
        Builds the image tree dialog and displays it.
      • changeRecordingStatus

        public void changeRecordingStatus​(int recorderStatus)
        Alerts the listener to a change in whether the ScriptRecorder is currently recording a script..*
        Specified by:
        changeRecordingStatus in interface ScriptRecordingListener
        Parameters:
        recorderStatus - DOCUMENT ME!
      • clearAllDataText

        public final void clearAllDataText()
        Accessor to clear all of data frame.
      • clearClippedVOIs

        @Deprecated
        public void clearClippedVOIs()
        Deprecated.
        DOCUMENT ME!
      • createBlankImage

        public ModelImage createBlankImage​(FileInfoBase fileInfo)
        Creates a blank Image based on the information found in the fileInfo object and places it in a frame.
        Parameters:
        fileInfo - This object contains the enough image information to build a ModelImage with nothing inside (eg. blank image).
      • createBlankImage

        public ModelImage createBlankImage​(FileInfoBase fileInfo,
                                           boolean doDisplay,
                                           boolean allowRecording)
        Creates a blank Image based on the information found in the fileInfo object.
        Parameters:
        fileInfo - This object contains the enough image information to build a ModelImage with nothing inside (eg. blank image).
        doDisplay -
        allowRecording -
      • enableOutputWindow

        public void enableOutputWindow​(boolean doShowFrame)
        Toggles the display of the Output window and updates all JFrameImages so that the menu checkbox will reflect the status of the output window.
        Parameters:
        doShowFrame - Whether the output window should be shown.
      • getActiveImageFrame

        public ViewJFrameImage getActiveImageFrame()
        Accessor that returns the active image frame vector. If the top frame is not an image frame, then the frame vector is iterated until an image frame is found. If none is found then null is returned.
        Returns:
        The vector that has a list of frames visible in the GUI.
      • getAppTitle

        public java.lang.String getAppTitle()
        Accessor to get the title of this application.
        Returns:
        The title of this application.
      • getClippedMatrix

        public TransMatrix getClippedMatrix()
        Retrieves the clipped matrix for paste action.
        Returns:
        clippedMatrix
      • getClippedScannerVectors

        @Deprecated
        public java.util.Vector<java.util.Vector<WildMagic.LibFoundation.Mathematics.Vector3f>> getClippedScannerVectors()
        Deprecated.
        DOCUMENT ME!
        Returns:
        DOCUMENT ME!
      • getClippedVOIs

        @Deprecated
        public ViewVOIVector getClippedVOIs()
        Deprecated.
        Returns the VOIs copied into the clip board. For copying and pasting VOIs between images.
        Returns:
        Vector
      • getCopyVOIs

        public java.util.Vector<VOIBase> getCopyVOIs()
      • getCopyVOINames

        public java.util.Vector<java.lang.String> getCopyVOINames()
      • getCmdLineArguments

        public java.lang.String getCmdLineArguments()
        Returns the Command line arguments (as one string, each separated by a space) .@return command line arguments concatenated with spaces
        Returns:
        DOCUMENT ME!
      • getDefaultDirectory

        public java.lang.String getDefaultDirectory()
        Accessor to get directory location of last file access.
        Returns:
        The last file directory
      • getDefaultScriptDirectory

        public java.lang.String getDefaultScriptDirectory()
        Accessor to get directory location of script files.
        Returns:
        The script file directory
      • getDICOMCatcher

        public DICOM_Receiver getDICOMCatcher()
        Accessor to get the DICOM receiver.
        Returns:
        the DICOM receiver
      • getDICOMQueryFrame

        public ViewJFrameDICOMQuery getDICOMQueryFrame()
        Accessor to get the DICOM query frame.
        Returns:
        The DICOM query frame.
      • getFrameContainingImage

        public ViewJFrameImage getFrameContainingImage​(ModelImage image)
        Accessor that returns the active image frame vector. If the top frame is not an image frame, then the frame vector is iterated until an image frame is found. If none is found then null is returned.
        Parameters:
        image - the image to find the frame for.
        Returns:
        The vector that has a list of frames visible in the GUI.
      • getImageFrameVector

        public java.util.Vector<java.awt.Frame> getImageFrameVector()
        Accessor that returns frame vector.
        Returns:
        The vector that has a list of frames visible in the GUI.
      • getLastScript

        public java.lang.String getLastScript()
        Returns the last script file used from the preferences.
        Returns:
        LastScript
      • getLastStackFlag

        public boolean getLastStackFlag()
        Gets the last checkbox entry for "multi-file" for opening images.
        Returns:
        boolean
      • getMainFrame

        public javax.swing.JFrame getMainFrame()
        Accessor that returns the main user interface frame.
        Returns:
        The main user interface frame.
      • getMenuBuilder

        public ViewMenuBuilder getMenuBuilder()
        Returns the interface's menu builder.
      • getMessageFrame

        public ViewJFrameMessage getMessageFrame()
        Accessor that returns the message frame.
        Returns:
        The message frame.
      • getMessageText

        public java.lang.String getMessageText()
        Accessor to get text of message field.
      • getNewFrameLocation

        public java.awt.Dimension getNewFrameLocation​(int newImageXDim,
                                                      int newImageYDim)
        Changes location of image when first displayed.
        Returns:
        The new location.
      • getNewFrameYLocation

        public java.awt.Dimension getNewFrameYLocation()
        Changes vertical location of image when first displayed.
        Returns:
        The new location.
      • getProgressBarPrefix

        public java.lang.String getProgressBarPrefix()
        Gets the string "Opening " or "Loading " based on what the progress bar should be displaying.
        Returns:
        String OPENING_STR or LOADING_STR
      • getProvenanceHolder

        public ProvenanceHolder getProvenanceHolder()
        Accessor for the mipav's data provenance .@return mipav's data provenance holder
        Returns:
        DOCUMENT ME!
      • getRegisteredFramedImagesNum

        public int getRegisteredFramedImagesNum()
        Return an num of images with frames(elements) from the image hashtable.
        Returns:
        images number
        See Also:
        CustomHashtable
      • getRegisteredImageByName

        public ModelImage getRegisteredImageByName​(java.lang.String name)
        Return a registered image from the image hashtable based on the name of the image. This works as long as the image was registered and the name is unique.
        Parameters:
        name - The name of the image to be retrieved.
        Returns:
        the ImageModel associated with this name.
        Throws:
        java.lang.IllegalArgumentException - if the name is not in the image hastable.
        See Also:
        CustomHashtable
      • getRegisteredImageNames

        public java.util.Enumeration<java.lang.String> getRegisteredImageNames()
        Return an enumeration of keys (image names) from the image hashtable.
        Returns:
        An Enumeration containing the keys (image names).
        See Also:
        CustomHashtable
      • getRegisteredImages

        public java.util.Enumeration<ModelImage> getRegisteredImages()
        Return an enumeration of images (elements) from the image hashtable.
        Returns:
        An Enumeration containing the elements (images).
        See Also:
        CustomHashtable
      • getRegisteredImagesNum

        public int getRegisteredImagesNum()
        Return an num of images (elements) from the image hashtable.
        Returns:
        images number
        See Also:
        CustomHashtable
      • imageRegistryMonitoring

        public void imageRegistryMonitoring()
        Display image registry frame.
      • imagesToFront

        public void imagesToFront()
        Brings all images and message frame to the front.
      • isAppFrameVisible

        public boolean isAppFrameVisible()
        Accessor to check whether the application frame visible or not.
        Returns:
        isAppFrameVisible application frame visibility flag
      • isImageHashtableEmpty

        public boolean isImageHashtableEmpty()
        Indicates if the image hashtable is empty.
        Returns:
        A boolean showing state of hashtable.
        See Also:
        CustomHashtable
      • isImageRegistered

        public boolean isImageRegistered​(java.lang.String imageName)
        Indicates if the image name is found in the hashtable.
        Parameters:
        imageName - the image name (key).
        Returns:
        A boolean indicating that image name.
        See Also:
        CustomHashtable
      • isPlugInFrameVisible

        public boolean isPlugInFrameVisible()
        Accessor to see if a stand-alone plugin frame is visible (not app frame)
        Returns:
      • isShorcutRecording

        public boolean isShorcutRecording()
        Determines if the UserInterface is currently recording an action command as a shortcut.
        Returns:
        boolean is it recording
      • setAppFrameVisible

        public void setAppFrameVisible​(boolean isVisible)
        Tells the application to show the MIPAV UI or suppress it (progress bars, image frames, etc).
        Parameters:
        isVisible - Set to false to hide the MIPAV UI.
      • setPlugInFrameVisible

        public void setPlugInFrameVisible​(boolean isVisible)
        Tells the UI that a standalone plugin frame is visible
        Parameters:
        isVisible - is the plugin frame visible
      • keyPressed

        public void keyPressed​(java.awt.event.KeyEvent e)
        Pass the key event to the selected image frame (if one exists). If not, check the shortcut table and attempt to handle it here.
        Specified by:
        keyPressed in interface java.awt.event.KeyListener
        Parameters:
        e - a key event generated by the user
      • keyReleased

        public void keyReleased​(java.awt.event.KeyEvent e)
        Pass the key event to the selected image frame (if one exists).
        Specified by:
        keyReleased in interface java.awt.event.KeyListener
        Parameters:
        e - a key event generated by the user
      • keyTyped

        public void keyTyped​(java.awt.event.KeyEvent e)
        Pass the key event to the selected image frame (if one exists).
        Specified by:
        keyTyped in interface java.awt.event.KeyListener
        Parameters:
        e - a key event generated by the user
      • memoryAllocation

        public void memoryAllocation()
        Display memory allocation frame (request more from the JVM on next JVM-start).
      • memoryFrame

        public void memoryFrame()
        Display memory usage frame.
      • closeAllImages

        public void closeAllImages()
        this method closes all registered images
      • deleteItem

        private void deleteItem​(java.lang.String name,
                                boolean deleteFrame,
                                boolean runGC)
        Deletes the item specified by name. If false, only the model image is deleted
        Parameters:
        name - the object to delete
        deleteFrame - whether the frame should be deleted along with the image
        runGC - whether to run application-wide garbage collector once item is deleted
      • openJSONImageFrames

        public void openJSONImageFrames()
      • openImageFrame

        public void openImageFrame()
        This method opens an image and puts it into a frame.
      • openImageFrame

        public void openImageFrame​(java.lang.String imageFile)
        Open an image and put it into a new frame, given the image file name.
        Parameters:
        imageFile - the image file name with the path.
      • openImageFrame

        public void openImageFrame​(java.lang.String imageFileName,
                                   java.lang.String imageFileDir)
        Open an image and put it into a new frame, given the image file name.
        Parameters:
        imageFileName - the file name, without the path
        imageFileDir - the directory where the file is
      • openImageFrame

        public void openImageFrame​(java.lang.String imageFile,
                                   boolean multiFile)
        Open an image or images and put it into a new frame, given the image file name.
        Parameters:
        imageFile - the image file name with the path.
        multiFile - If true, the image is composed of image slices each in their own file.
      • openLastImage

        public void openLastImage​(int index)
        Attempts to open an image from the quicklist.
        Parameters:
        index - int index of image on quicklist
      • options

        public void options()
        Display Options dialog for all mipav options (including image specific options) to allow user to adjust display in one place.
      • parseArguments

        public int parseArguments​(java.lang.String[] args,
                                  int initArg)
        Required by the CommandLineParser interface. Processes MIPAV command line arguments that require MIPAV to have already been initialized. Returns the next argument to be processed (finished if returns args.length)
        Specified by:
        parseArguments in interface CommandLineParser
        Parameters:
        args - command arguments
        Returns:
        the location of the next command to be processed, if equal to args.length, then no further processing is necessary
      • regFrame

        public void regFrame​(java.awt.Frame frame)
        Method that registers an image frame by putting it in the image frame vector and does NOT loads controls.
        Parameters:
        frame - Frame to be registered with this the main UI.
      • registerFrame

        public void registerFrame​(java.awt.Frame frame)
        Method that registers an image frame by adding it to the vector and loads controls.
        Parameters:
        frame - Frame to be registered with this the main UI. The zero element frame is the active image. Any new image registered is made the active window.
      • setMenuActionListeners

        private void setMenuActionListeners​(java.awt.Component comp,
                                            java.awt.event.ActionListener frame)
      • registerImage

        public java.lang.String registerImage​(ModelImage image)
        Register image model by adding it to the image hashtable. Use the image name as the key. If the name is not unique then the CustomHashtable will attempt to make it unique. The image name will be reset with the new name. Classes calling this method need to check the returned key (image name) from this method.
        Parameters:
        image - Image to be registered.
        Returns:
        the String value of the key (image name)
        See Also:
        CustomHashtable
      • registerImage

        public java.lang.String registerImage​(java.lang.String key,
                                              ModelImage image)
        Register image model by adding it to the image hashtable. Use the String provided as the key. If the key is not unique then the CustomHashtable will attempt to make it unique. The actual key used will be returned.
        Parameters:
        key - the desired image key
        image - Image to be registered.
        Returns:
        the actual image key used (unique)
        See Also:
        CustomHashtable
      • removeAloneMenu

        public boolean removeAloneMenu​(javax.swing.JMenuBar menu)
        Removes the stand-alone menu from the user interface.
        Parameters:
        menu - the menu to be removed.
      • setActiveFrame

        public void setActiveFrame​(java.awt.Frame frame)
        Method sets the parameter frame to top and active.
        Parameters:
        frame - Frame to be set active (i.e. to the top of the list).
      • setClippedMatrix

        public void setClippedMatrix​(TransMatrix tMat)
        Sets the clipped matrix for copy/paste actions.
        Parameters:
        tMat - transmatrix for copy/paste
      • setControls

        public void setControls()
        Sets the menu for the main frame.
      • setDataText

        public final void setDataText​(java.lang.String str)
        Accessor to set text of data FRAME.
        Parameters:
        str - String to be displayed in text panel.
      • setDefaultDirectory

        public void setDefaultDirectory​(java.lang.String defaultDirectory)
        Sets directory location of last file access.
        Parameters:
        defaultDirectory - Directory to set it to.
      • setDefaultScriptDirectory

        public void setDefaultScriptDirectory​(java.lang.String dir)
        Sets directory location of the script files.
        Parameters:
        dir - Directory to set the script directory to.
      • setDICOMCatcher

        public void setDICOMCatcher​(DICOM_Receiver rcv)
        Accessor to set the DICOM receiver.
        Parameters:
        rcv - the DICOM receiver
      • setDICOMQueryFrame

        public void setDICOMQueryFrame​(ViewJFrameDICOMQuery frame)
        Accessor to set the DICOM query frame.
        Parameters:
        frame - The DICOM query frame.
      • setExitCmdLineOnError

        public void setExitCmdLineOnError​(boolean doExit)
        Sets MIPAV to exit (true) or not (false) on an error when running from the command line
        Parameters:
        doExit -
      • doExitCmdLineOnError

        public boolean doExitCmdLineOnError()
        Tells whether or not to exit on an error when running from the command line
        Returns:
        boolean whether to exit
      • doForceInPlace

        public boolean doForceInPlace()
        Checks whether the dialog should force the algorithm to replace the image (no new frame)
        Returns:
        if only algorithm image replacement is allowed
      • setForceInPlace

        public void setForceInPlace​(boolean doForce)
        Sets the dialogs to only replace the image (no new frame)
        Parameters:
        doForce - do force the dialog to replace the image (in-place)
      • setGlobalDataText

        public final void setGlobalDataText​(java.lang.String str)
        Accessor to set text of global data FRAME.
        Parameters:
        str - String to be displayed in text panel.
      • setJarClassLoader

        public void setJarClassLoader​(JarClassLoader jarClassLoader)
      • setLastScript

        public void setLastScript​(java.lang.String script)
        Sets last used script files in preferences.
        Parameters:
        script - Script to set the LastScript to.
      • setLastStackFlag

        public void setLastStackFlag​(boolean lastStackFlag)
        Sets the last value for opened multi-files (or single).
        Parameters:
        lastStackFlag - boolean
      • setLoad

        public void setLoad​(boolean doLoad)
        Tells the progress bar to say "Loading" rather than "Opening" for images being loaded if true.
        Parameters:
        doLoad - boolean do set progress bar to load
      • setMessageText

        public void setMessageText​(java.lang.String str)
        Accessor to set text of message field.
        Parameters:
        str - String to be displayed in text field.
      • setShortcutRecording

        public void setShortcutRecording​(boolean doRecord)
        Sets the UI to either be/not be recording action command.
        Parameters:
        doRecord - boolean true = is recording, false = not
      • setTitle

        public void setTitle​(java.lang.String str)
        Gets the application title from the preference file and prepends to the string passed into the method and displays the resultant string in the title of the main frame.
        Parameters:
        str - the application title
      • setUseVOIName

        public void setUseVOIName​(boolean useName)
        Sets the Preference to use VOI Names instead of labels, then updates all frames to reflect this change with their VOIs.
        Parameters:
        useName - boolean show name instead of label
      • setVisible

        public void setVisible​(boolean visible)
        Change whether the GUI should be visible. The order is strage because we want the main frame to be first on the taskbar, but also focused when the windows show up.
        Parameters:
        visible - whether the message and main frames should be shown on the screen
      • showLicense

        public void showLicense()
        Displays the MIPAV Software Transfer Agreement in a JDialogText window.

        The "license.html" file is read (using the GetPath class) and displayed as HTML with a JDialogText. If the file is not found, or there is a problem opening it, a notation is made in the Preferences.debug window and is otherwise ignored. A warning box is displayed when the license dialog cannot be created (and throws a NullPointerException). Finally, the main frame does not record this item in its list of windows, so many instances of this window may be made.

      • showLicense

        public void showLicense​(java.lang.String title,
                                java.lang.String filename)
        Displays the MIPAV Software Transfer Agreement in a JDialogText window.

        The "license.html" file is read (using the GetPath class) and displayed as HTML with a JDialogText. If the file is not found, or there is a problem opening it, a notation is made in the Preferences.debug window and is otherwise ignored. A warning box is displayed when the license dialog cannot be created (and throws a NullPointerException). Finally, the main frame does not record this item in its list of windows, so many instances of this window may be made.

        Parameters:
        title - The title of the frame
        filename - the name of the license file.
      • showShortcutEditor

        public void showShortcutEditor​(boolean doUpdate)
        Opens a dialog for viewing/modifying shortcuts.
        Parameters:
        doUpdate - whether to update the shortcut table
      • showSplashGraphics

        public void showSplashGraphics()
        Shows the MIPAV splash screen for a few seconds, or until the user clicks it.
      • unregisterFrame

        public void unregisterFrame​(java.awt.Frame frame)
        Method that unregisters an image frame by removing it from the image frame vector.
        Parameters:
        frame - Frame to be unregistered with this the main UI.
      • unregisterFrame

        public void unregisterFrame​(java.awt.Frame frame,
                                    boolean closeAll)
        Method that unregisters an image frame by removing it from the image frame vector.
        Parameters:
        frame - Frame to be unregistered with this the main UI.
      • unRegisterImage

        public void unRegisterImage​(ModelImage image)
        Unregister image model by removing it from the image hashtable. Assume that the imageName is the key to the image. Display an error if the image key is not found.
        Parameters:
        image - Image to be unregistered.
        Throws:
        java.lang.IllegalArgumentException - if image is null
      • unRegisterImage

        public void unRegisterImage​(java.lang.String imageKey)
        Unregister image model by removing it from the image hashtable given the key to the hashtable. Display an error if the image key is not found.
        Parameters:
        imageKey - The key to the image to be unregistered (a string).
        Throws:
        java.lang.IllegalArgumentException - if imageKey is null
      • updateMemoryUsage

        public void updateMemoryUsage()
        This method is a callback method. The purpose is to update the memory usage readout every one second. A separate thread calls this method every one second.
      • updateMultiCoreUsage

        public void updateMultiCoreUsage()
        This method updates the "whether multi-core should be used" button when the relevant button has been pushed in either the preferences pane.
      • updateGpuUsage

        public void updateGpuUsage()
        This method updates the "whether algorithms will use the GPU" when the relevant button has been pushed in either the preferences pane.
      • updateScript

        public void updateScript​(java.lang.String newScriptText)
        Do nothing - required by ScriptRecordingListener interface.
        Specified by:
        updateScript in interface ScriptRecordingListener
        Parameters:
        newScriptText - Ignored.
      • windowActivated

        public void windowActivated​(java.awt.event.WindowEvent event)
        Do nothing.
        Specified by:
        windowActivated in interface java.awt.event.WindowListener
        Parameters:
        event - the window event.
      • windowClosed

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

        public void windowClosing​(java.awt.event.WindowEvent event)
        Confirms if the user really wants to exit, then closes the application.
        Specified by:
        windowClosing in interface java.awt.event.WindowListener
        Parameters:
        event - Event that triggered this function.
      • cleanupAndExit

        public void cleanupAndExit()
      • windowDeactivated

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

        public void windowDeiconified​(java.awt.event.WindowEvent event)
        Deiconify only the other frames who's last state was normal (ie- restore other frames to their lastState).
        Specified by:
        windowDeiconified in interface java.awt.event.WindowListener
        Parameters:
        event - the deiconify window event.
      • windowIconified

        public void windowIconified​(java.awt.event.WindowEvent event)
        Iconify all other frames associateed with MIPAV.
        Specified by:
        windowIconified in interface java.awt.event.WindowListener
        Parameters:
        event - the iconify window event.
      • windowOpened

        public void windowOpened​(java.awt.event.WindowEvent event)
        Do nothing.
        Specified by:
        windowOpened in interface java.awt.event.WindowListener
        Parameters:
        event - the window event.
      • writeDataProvenance

        public void writeDataProvenance()
        Writes Mipav's data provenance to the default location.

        .

      • initCreateMemoryUsagePanel

        protected javax.swing.JPanel initCreateMemoryUsagePanel()
        Construct the panel which displays the current memory usage/limit and a garbage collection button.
        Returns:
        the memory usage panel
      • initCreateMultiCoreGpuIndicatorPanel

        protected javax.swing.JPanel initCreateMultiCoreGpuIndicatorPanel()
        Construct the panel which displays whether the CPU and GPU could be utilized by algorithms based on the preferences settings by the user.
        Returns:
        the memory usage panel
      • initCreateMessageBar

        protected void initCreateMessageBar()
        Create the panel containing components which show the application title initially, and will later be used to show image coordinates and intensities.
      • initCreateMessageField

        protected javax.swing.JTextField initCreateMessageField​(java.lang.String title)
        Creates the message field for the main frame using the title given. For other applications, extend this method to call the super method with the appropriate title.
        Parameters:
        title - the string use in the newly-created message field.
        Returns:
        the message field (displays coordinate info when an image is opened)
      • initDicomReceiver

        protected void initDicomReceiver()
        Starts the DICOM receiver if the flag in the preference file is true.
      • initMacintoshJDKversionCheck

        protected void initMacintoshJDKversionCheck()
        Method checks to verify that when running on a Machintosh, the JDK version is at least 1�x2e;4. It sets the start up file "Info.plist" to use java1.4 if it can. The check for these routines is System.getProperty("os.name").indexOf("Mac"), and we simply return doing nothing if the property for os.name is something different. If the os.name does not contain "Mac", and the Info.plist file is found,

        "Info.plist" file to hold its startup arguments, so we need that file anyway. All exceptions caught here are not propogated.

      • initPrefsFile

        protected void initPrefsFile()
        Set the preferences file to use (Preferences defaults to mipav.preferences).
      • initPrefsTrim

        protected void initPrefsTrim()
        Gets the TRIM_VOI, TRIM_MASK and TRIM_FLAG values from the preferences file, and if it cannot find them, it sets to some default value: TRIM_VOI will be 0.3, TRIM_MASK will be 0.0, and TRIM_FLAG will be true.

        Over-ride this method if these defaults are unnacceptable.

      • initSetMainFrameDefaults

        protected void initSetMainFrameDefaults​(java.awt.LayoutManager prefLayout,
                                                boolean resize)
        Sets the layout of the Main Frame with the given, preferred layout manager; makes the main frame resizable as given; makes this class a window-listener; sets the default operation to do nothing on close; and the icon is set. The image icon is set by the preferences.

        Over-riding classes can alter the preferred layout most easily by over-riding this method, but calling this method with a different layout and desired size-setting. To change the default close-operation with an over-riding class, call this super method, then set the default close operation, rather than creating a custom re-implemention of this method.

        Parameters:
        prefLayout - A layout manager to handle the main frame.
        resize - Whether to allow resizing of the main frame.
        See Also:
        JFrame.setDefaultCloseOperation(int), Preferences.getIconName()
      • initSetTitles

        protected void initSetTitles​(java.lang.String mainFrameTitle,
                                     java.lang.String appTitle)
        Sets the titles for for the main frame and the application using the strings given. For other applications, extend this method to call the super method with the appropriate title.
        Parameters:
        mainFrameTitle - The string to use as the title for the main frame.
        appTitle - The string to put in the main frame's bottom status field.
      • initUsingPreferences

        protected void initUsingPreferences()
        Performs a variety of start-up operations based on user-preferences; First, it tries to read from the preferences file; if it cannot, it sets the user directory. It then follows from the preferences file:
        1. splash screen
        2. checks the VM heap size max
        3. sets the default directory
        4. debug output
        5. sets the TRIM

        Over-riding classes should not over-ride this method unless one of these intermediate operations is not desired or more operations are needed. To modify the defaults used in creating a preferences file, over-ride one of the called methods.

        See Also:
        setDefaultDirectory(String), showSplashGraphics(), checkHeapMaxAgainstPreferences(), Preferences.print(), initPrefsTrim()
      • runCmdLine

        protected void runCmdLine​(java.lang.String scriptFile,
                                  java.util.Vector<ViewUserInterface.OpenFileInfo> imageList,
                                  java.util.Vector<java.util.Vector<java.lang.String>> voiList)
        This method is used when running MIPAV from the command line.
        Parameters:
        scriptFile - The script to run.
        imageList - A list of OpenImageFile objects to use in the script.
        voiList - A list of VOIs to put into the various images.
        See Also:
        printUsageAndExit()
      • checkHeapMaxAgainstPreferences

        private void checkHeapMaxAgainstPreferences()
        Test for VM memory sizes being the same as last run in preferences: displays a user-warning that the preferences & VM config files disagree and presents the JDialogMemoryAllocation dialog with "use preference" buttons to quicken the matching process.

        Note, this method does not throw any NullPointerExceptions.

      • printUsageAndExit

        public static void printUsageAndExit()
        Displays command line help information on usage of all commands and then exits.
      • printUsageAndExit

        public static void printUsageAndExit​(Argument c)
        Displays command line help information on usage to standard out and then into an informational dialog box then exits the MIPAV application. Help display just shows the different options, display help, load image, load script, load VOI, and hide menu bar, as well as examples of use.
      • generateCmdUsageInfo

        public static java.lang.String generateCmdUsageInfo()
        Generates automatic list of available commands.
      • isProvidedOutputDir

        public static boolean isProvidedOutputDir()
        This is the getter for providedOutputDir providedOutputDir: This boolean tells if the user has provided an ouputDir parameter as a command line argument when running a script
        Returns:
      • isProvidedUserDefaultDir

        public static boolean isProvidedUserDefaultDir()
      • getDiscoverableActionList

        public static java.util.Vector<java.lang.Class<ActionDiscovery>> getDiscoverableActionList()
      • getDiscoverableActionList

        public static java.util.Vector<java.lang.Class<ActionDiscovery>> getDiscoverableActionList​(java.lang.String baseDir)
      • getExceptions

        public static java.io.File getExceptions()
        Returns:
        the exceptions
      • getOutputDir

        public static java.lang.String getOutputDir()
      • getSecondaryPluginsDir

        public static java.io.File getSecondaryPluginsDir()
      • getUserDefaultDir

        public static java.lang.String getUserDefaultDir()
      • setProvidedOutputDir

        public static void setProvidedOutputDir​(boolean providedOutputDir)
      • setProvidedUserDefaultDir

        public static void setProvidedUserDefaultDir​(boolean providedUserDefaultDir)
      • setOutputDir

        public static void setOutputDir​(java.lang.String outputDir)
      • setSecondaryPluginsDir

        public static void setSecondaryPluginsDir​(java.io.File secondaryPluginsDir)
      • setUserDefaultDir

        public static void setUserDefaultDir​(java.lang.String userDefaultDir)
      • parseStaticArguments

        public static int parseStaticArguments​(java.lang.String[] args,
                                               int initArg)
        Required by the CommandLineParser interface. Processes MIPAV command line arguments that DO NOT require MIPAV to have already been initialized. In cases like the plugins directory, it is specifically required that MIPAV has not been initialized yet. Returns the next argument to be processed (finished if returns args.length)
      • checkPrefDirCommand

        public static void checkPrefDirCommand​(java.lang.String[] args,
                                               int initArg)
        If the preferences name command is about to be performed before an existing preferences directory command, this guarantees that the directory command will be executed first.
      • addToTempDirList

        public static void addToTempDirList​(java.lang.String path)