Class ViewUserInterface
- All Implemented Interfaces:
ScriptRecordingListener,CommandLineParser,ActionListener,KeyListener,WindowListener,EventListener
- Version:
- 1.1 June 1, 2012
- Author:
- Justin Senseney, Matthew McAuliffe, Ph.D.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate classprivate classHandles drag and drop events to the main mipav gui.private classprivate classStores file name and switch for multifile. -
Field Summary
FieldsModifier and TypeFieldDescriptionStores all stand-alone menus that have been created by the user.private JButtonThe button indicating that MIPAV is set to run OpenCL -- GPU based algorithmsprivate JButtonThe button indicating that MIPAV is set to run in a threaded environmentprivate TransMatrixMatrix for copy/paste actions in image's or between image's matrix edit panel.DOCUMENT ME!private final ViewVOIVectorVector to hold clipped VOIs (multiple).private StringString holding the command line arguments for data provenance usage.Vector to hold clipped VOIs (multiple).Vector to hold VOI names (multiple).private DICOM_ReceiverReference to the DICOM receiver that listens for DICOM formatted images sent by a DICOM server.private ViewJFrameDICOMQueryDICOM query frame for sending and receiving DICOM images.private JDialogDataProvenanceDialog to display the mipav system data provenanceprivate static FileException logging fileprivate booleanerror handling for cmd line, if set to false will not exit on MipavUtil.displayError()private booleanboolean to force the algorithm to replace the image rather than opening a new frameprivate final DimensionLocation of new image frames.Stores array of images frames the first of which is the active image frame.private final CustomHashtable<ModelImage> A list of image models currently open in MIPAV.private ViewJFrameRegisteredImagesFrame that monitors the registered images.private booleanWhether the mipav GUI should be shown; set by the -hide command line option.private booleanWhether a plugin standalone frame is visibleprivate JarClassLoaderClass/resource loader for plugins that are in jarsprivate booleanIndicates the user's last choice of whether to open images as multi-file (stack) or single file in the file open dialog.private static final StringString to use as the progress bar loading prefix.protected JFrameThe main menu bar that runs MIPAV.private JDialogMemoryAllocationDialog that allows changes to the amount of heap requested of the system by the java Virtual Machine for MIPAV during java start.private ViewJFrameMemoryDialog that displays the used and available memory.private JLabelThe label showing the current memory usage of MIPAV.The periodic thread which updates the memory usage display once every second.protected ViewMenuBuilderThe object used to build and enable/select the menus.protected JTextFieldMessage line at the bottom of the mainFrame.protected ViewJFrameMessageMessage area for multi-line text output.private intif user selects to open images as tiles, then this counter tells us how many tile sheets there are*private static final StringString to use as the progress bar opening prefix.protected JMenuBarInitial menubar for MIPAV.private JDialogMipavOptionsDialog that allows changes to the amount of heap requested of the system by the java Virtual Machine for MIPAV during java start.private static StringThis is the outputDir path that the user entered as a command line argument when running a script *private JMenuStores the plugins menu so that it can be removed/updated when plugins are installed.private StringThe current progress bar prefix to use.private static booleanThis boolean tells if the user has provided an ouputDir parameter as a command line argument when running a scriptprivate static booleanThis boolean tells if the user has provided an inputDir parameter as a command line argument when running a scriptprivate static JDialogShortcutEditorKey shortcut editor dialog.private booleanIndicates whether the user is currently recording a new keyboard shortcut using the shortcut editor dialog.private ProvenanceHolderSystem DP holder (separate from images data provenance...this has everything).private static StringThis is the inputDir path that the user entered as a command line argument when running a script *protected static ViewUserInterfaceA reference to the only ViewUserInterface object in MIPAV. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedConstructs main UI frame.protectedViewUserInterface(boolean forceQuiet) Constructs main UI frame. -
Method Summary
Modifier and TypeMethodDescriptionvoidabout()Creates simple dialog that describes basic info about MIPAV, with MIPAV as the title.voidCreates a fairly simple plain-text viewing box.voidDisplays the system data provenance using a simple dialog with table and jtextarea (for current selection).voidCreates simple dialog that describes basic info about the version of Java.voidactionPerformed(ActionEvent event) Calls various methods based on the user's actions.booleanaddAloneMenu(JMenuBar menu) Adds a standalone menu to the user interface.private voidaddPluginToMenu(Class<?> plugin, String pluginName, String name, JMenu currentMenu, ActionListener al, String jarContainer) static voidaddToTempDirList(String path) voidBuilds the anonymize directory dialog and displays it.Builds the image tree dialog and displays it.Builds the image tree dialog and displays it.voidBuilds the edit dicom tag interface.Builds menus for the User Interface.Builds the message frame where user/program data can be displayed.Called by either userInterface (this) or by another actionlistener (ViewJFrameImage) to build the plugins menu bar.voidBuilds the image tree dialog and displays it.voidchangeRecordingStatus(int recorderStatus) Alerts the listener to a change in whether the ScriptRecorder is currently recording a script.private voidTest 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 voidcheckPrefDirCommand(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.voidfinal voidAccessor to clear all of data frame.voidDeprecated.voidthis method closes all registered imagesvoidcopyClippedVOIs(ViewVOIVector copyList) Deprecated.voidstatic ViewUserInterfacecreate()This method should only be called once, and it should only be called by MipavMain to during the initialization of MIPAV.createBlankImage(FileInfoBase fileInfo) Creates a blank Image based on the information found in the fileInfo object and places it in a frame.createBlankImage(FileInfoBase fileInfo, boolean doDisplay, boolean allowRecording) Creates a blank Image based on the information found in the fileInfo object.createEmptyImage(FileInfoBase fileInfo) Creates a blank Image based on the information found in the default fileInfo object.private voiddeleteItem(String name, boolean deleteFrame, boolean runGC) Deletes the item specified by name.private voiddeleteMenu(JMenu menu) Recursive deletion algorithm to delete JMenus which contain no JMenuItems exclusive of JMenus in any children.booleanTells whether or not to exit on an error when running from the command linebooleanChecks whether the dialog should force the algorithm to replace the image (no new frame)voidenableOutputWindow(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 StringGenerates automatic list of available commands.Accessor that returns the active image frame vector.Accessor to get the title of this application.Retrieves the clipped matrix for paste action.Deprecated.Deprecated.Returns the Command line arguments (as one string, each separated by a space) .Accessor to get directory location of last file access.Accessor to get directory location of script files.Accessor to get the DICOM receiver.Accessor to get the DICOM query frame.static Vector<Class<ActionDiscovery>> static Vector<Class<ActionDiscovery>> getDiscoverableActionList(String baseDir) static FileAccessor that returns the active image frame vector.Accessor that returns frame vector.Returns the last script file used from the preferences.booleanGets the last checkbox entry for "multi-file" for opening images.Accessor that returns the main user interface frame.Returns the interface's menu builder.Accessor that returns the message frame.Accessor to get text of message field.getNewFrameLocation(int newImageXDim, int newImageYDim) Changes location of image when first displayed.Changes vertical location of image when first displayed.static StringGets the string "Opening " or "Loading " based on what the progress bar should be displaying.Accessor for the mipav's data provenance .static ViewUserInterfaceGet a reference to the ViewUserInterface object.intReturn an num of images with frames(elements) from the image hashtable.Return a registered image from the image hashtable based on the name of the image.Return an enumeration of keys (image names) from the image hashtable.Return an enumeration of images (elements) from the image hashtable.intReturn an num of images (elements) from the image hashtable.static Filestatic StringvoidDisplay image registry frame.voidBrings all images and message frame to the front.protected JPanelConstruct the panel which displays the current memory usage/limit and a garbage collection button.protected voidCreate the panel containing components which show the application title initially, and will later be used to show image coordinates and intensities.protected JTextFieldinitCreateMessageField(String title) Creates the message field for the main frame using the title given.protected JPanelConstruct the panel which displays whether the CPU and GPU could be utilized by algorithms based on the preferences settings by the user.protected voidStarts the DICOM receiver if the flag in the preference file istrue.voidInitializes the user interface.protected voidMethod checks to verify that when running on a Machintosh, the JDK version is at least 1invalid input: '�'x2e;4.protected voidSet the preferences file to use (Preferences defaults to mipav.preferences).protected voidGets 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 voidinitSetMainFrameDefaults(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 voidinitSetTitles(String mainFrameTitle, String appTitle) Sets the titles for for the main frame and the application using the strings given.protected voidPerforms 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.booleanAccessor to check whether the application frame visible or not.booleanIndicates if the image hashtable is empty.booleanisImageRegistered(String imageName) Indicates if the image name is found in the hashtable.booleanAccessor to see if a stand-alone plugin frame is visible (not app frame)static booleanThis 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 scriptstatic booleanbooleanDetermines if the UserInterface is currently recording an action command as a shortcut.voidPass the key event to the selected image frame (if one exists).voidPass the key event to the selected image frame (if one exists).voidPass the key event to the selected image frame (if one exists).private voidvoidDisplay memory allocation frame (request more from the JVM on next JVM-start).voidDisplay memory usage frame.voidThis method opens an image and puts it into a frame.voidopenImageFrame(String imageFile) Open an image and put it into a new frame, given the image file name.voidopenImageFrame(String imageFile, boolean multiFile) Open an image or images and put it into a new frame, given the image file name.voidopenImageFrame(String imageFileName, String imageFileDir) Open an image and put it into a new frame, given the image file name.voidvoidopenLastImage(int index) Attempts to open an image from the quicklist.voidoptions()Display Options dialog for all mipav options (including image specific options) to allow user to adjust display in one place.intparseArguments(String[] args, int initArg) Required by the CommandLineParser interface.static intparseStaticArguments(String[] args, int initArg) Required by the CommandLineParser interface.static voidDisplays command line help information on usage of all commands and then exits.static voidDisplays command line help information on usage to standard out and then into an informational dialog box then exits the MIPAV application.voidMethod that registers an image frame by putting it in the image frame vector and does NOT loads controls.voidregisterFrame(Frame frame) Method that registers an image frame by adding it to the vector and loads controls.registerImage(ModelImage image) Register image model by adding it to the image hashtable.registerImage(String key, ModelImage image) Register image model by adding it to the image hashtable.booleanremoveAloneMenu(JMenuBar menu) Removes the stand-alone menu from the user interface.protected voidrunCmdLine(String scriptFile, Vector<ViewUserInterface.OpenFileInfo> imageList, Vector<Vector<String>> voiList) This method is used when running MIPAV from the command line.voidsetActiveFrame(Frame frame) Method sets the parameter frame to top and active.voidsetAppFrameVisible(boolean isVisible) Tells the application to show the MIPAV UI or suppress it (progress bars, image frames, etc).voidsetClippedMatrix(TransMatrix tMat) Sets the clipped matrix for copy/paste actions.voidSets the menu for the main frame.final voidsetDataText(String str) Accessor to set text of data FRAME.voidsetDefaultDirectory(String defaultDirectory) Sets directory location of last file access.voidSets directory location of the script files.voidAccessor to set the DICOM receiver.voidAccessor to set the DICOM query frame.voidsetExitCmdLineOnError(boolean doExit) Sets MIPAV to exit (true) or not (false) on an error when running from the command linevoidsetForceInPlace(boolean doForce) Sets the dialogs to only replace the image (no new frame)final voidsetGlobalDataText(String str) Accessor to set text of global data FRAME.voidsetJarClassLoader(JarClassLoader jarClassLoader) voidsetLastScript(String script) Sets last used script files in preferences.voidsetLastStackFlag(boolean lastStackFlag) Sets the last value for opened multi-files (or single).voidsetLoad(boolean doLoad) Tells the progress bar to say "Loading" rather than "Opening" for images being loaded if true.private voidsetMenuActionListeners(Component comp, ActionListener frame) voidsetMessageText(String str) Accessor to set text of message field.static voidsetOutputDir(String outputDir) voidsetPlugInFrameVisible(boolean isVisible) Tells the UI that a standalone plugin frame is visiblestatic voidsetProvidedOutputDir(boolean providedOutputDir) static voidsetProvidedUserDefaultDir(boolean providedUserDefaultDir) static voidsetSecondaryPluginsDir(File secondaryPluginsDir) voidsetShortcutRecording(boolean doRecord) Sets the UI to either be/not be recording action command.voidGets 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 voidsetUserDefaultDir(String userDefaultDir) voidsetUseVOIName(boolean useName) Sets the Preference to use VOI Names instead of labels, then updates all frames to reflect this change with their VOIs.voidsetVisible(boolean visible) Change whether the GUI should be visible.voidDisplays the MIPAV Software Transfer Agreement in a JDialogText window.voidshowLicense(String title, String filename) Displays the MIPAV Software Transfer Agreement in a JDialogText window.voidshowShortcutEditor(boolean doUpdate) Opens a dialog for viewing/modifying shortcuts.voidShows the MIPAV splash screen for a few seconds, or until the user clicks it.voidunregisterFrame(Frame frame) Method that unregisters an image frame by removing it from the image frame vector.voidunregisterFrame(Frame frame, boolean closeAll) Method that unregisters an image frame by removing it from the image frame vector.voidunRegisterImage(ModelImage image) Unregister image model by removing it from the image hashtable.voidunRegisterImage(String imageKey) Unregister image model by removing it from the image hashtable given the key to the hashtable.voidThis method updates the "whether algorithms will use the GPU" when the relevant button has been pushed in either the preferences pane.voidThis method is a callback method.voidThis method updates the "whether multi-core should be used" button when the relevant button has been pushed in either the preferences pane.voidupdateScript(String newScriptText) Do nothing - required by ScriptRecordingListener interface.voidwindowActivated(WindowEvent event) Do nothing.voidwindowClosed(WindowEvent event) Do nothing.voidwindowClosing(WindowEvent event) Confirms if the user really wants to exit, then closes the application.voidwindowDeactivated(WindowEvent event) Do nothing.voidwindowDeiconified(WindowEvent event) Deiconify only the other frames who's last state was normal (ie- restore other frames to their lastState).voidwindowIconified(WindowEvent event) Iconify all other frames associateed with MIPAV.voidwindowOpened(WindowEvent event) Do nothing.voidWrites Mipav's data provenance to the default location.
-
Field Details
-
userInterfaceReference
A reference to the only ViewUserInterface object in MIPAV.- See Also:
-
OPENING_STR
String to use as the progress bar opening prefix.- See Also:
-
LOADING_STR
String to use as the progress bar loading prefix.- See Also:
-
shortcutEd
Key shortcut editor dialog. -
providedUserDefaultDir
private static boolean providedUserDefaultDirThis boolean tells if the user has provided an inputDir parameter as a command line argument when running a script -
userDefaultDir
This is the inputDir path that the user entered as a command line argument when running a script * -
providedOutputDir
private static boolean providedOutputDirThis boolean tells if the user has provided an ouputDir parameter as a command line argument when running a script -
outputDir
This is the outputDir path that the user entered as a command line argument when running a script * -
mainFrame
The main menu bar that runs MIPAV. -
messageField
Message line at the bottom of the mainFrame. -
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
Initial menubar for MIPAV. -
clippedMatrix
Matrix for copy/paste actions in image's or between image's matrix edit panel. -
clippedScannerVectors
DOCUMENT ME! -
clippedVOIs
Vector to hold clipped VOIs (multiple). -
copyVOIList
Vector to hold clipped VOIs (multiple). -
copyVOINameList
Vector to hold VOI names (multiple). -
jarClassLoader
Class/resource loader for plugins that are in jars -
cmdLineArguments
String holding the command line arguments for data provenance usage. -
DICOMcatcher
Reference to the DICOM receiver that listens for DICOM formatted images sent by a DICOM server. -
DICOMQueryFrame
DICOM query frame for sending and receiving DICOM images. -
frameLocation
Location of new image frames. This location is updated with each additional image opened.- See Also:
-
imageFrameVector
Stores array of images frames the first of which is the active image frame. -
imageHashtable
A list of image models currently open in MIPAV. -
imgMonitorFrame
Frame that monitors the registered images. -
isAppFrameVisible
private boolean isAppFrameVisibleWhether the mipav GUI should be shown; set by the -hide command line option. -
isPlugInFrameVisible
private boolean isPlugInFrameVisibleWhether a plugin standalone frame is visible -
lastStackFlag
private boolean lastStackFlagIndicates the user's last choice of whether to open images as multi-file (stack) or single file in the file open dialog. -
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
Dialog that displays the used and available memory. -
dpDialog
Dialog to display the mipav system data provenance -
memoryUsageLabel
The label showing the current memory usage of MIPAV. -
btnMultiCore
The button indicating that MIPAV is set to run in a threaded environment -
btnGpuComp
The button indicating that MIPAV is set to run OpenCL -- GPU based algorithms -
memoryUsageUpdater
The periodic thread which updates the memory usage display once every second.- See Also:
-
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
Stores the plugins menu so that it can be removed/updated when plugins are installed. -
aloneMenu
Stores all stand-alone menus that have been created by the user. -
progressBarPrefix
The current progress bar prefix to use. -
shortcutRecording
private boolean shortcutRecordingIndicates whether the user is currently recording a new keyboard shortcut using the shortcut editor dialog. -
systemDPHolder
System DP holder (separate from images data provenance...this has everything). -
forceAlgorithmInPlace
private boolean forceAlgorithmInPlaceboolean to force the algorithm to replace the image rather than opening a new frame -
exitCmdLineOnError
private boolean exitCmdLineOnErrorerror handling for cmd line, if set to false will not exit on MipavUtil.displayError() -
numTileSheets
private int numTileSheetsif user selects to open images as tiles, then this counter tells us how many tile sheets there are* -
exceptions
Exception logging file -
tempDirList
-
-
Constructor Details
-
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 Details
-
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
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
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
Adds a standalone menu to the user interface.- Parameters:
menu- the standalone JMenu- Returns:
- whether addition to the vector was successful
-
actionPerformed
Calls various methods based on the user's actions.- Specified by:
actionPerformedin interfaceActionListener- Parameters:
event- Event that triggered this function.
-
createEmptyImage
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.Copies into the VOI clipboard.- Parameters:
voi- VOI
-
copyVOIs
-
buildAnonDirectoryDialog
public void buildAnonDirectoryDialog()Builds the anonymize directory dialog and displays it. -
buildDICOMFrame
Builds the image tree dialog and displays it. -
buildEditDICOMFrame
public void buildEditDICOMFrame()Builds the edit dicom tag interface. -
buildDICOMDIRFrame
Builds the image tree dialog and displays it. -
buildMenu
Builds menus for the User Interface. -
buildMessageFrame
Builds the message frame where user/program data can be displayed. -
buildPlugInsMenu
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
-
deleteMenu
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:
changeRecordingStatusin interfaceScriptRecordingListener- Parameters:
recorderStatus- DOCUMENT ME!
-
clearAllDataText
public final void clearAllDataText()Accessor to clear all of data frame. -
clearClippedVOIs
Deprecated.DOCUMENT ME! -
createBlankImage
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
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
Accessor to get the title of this application.- Returns:
- The title of this application.
-
getClippedMatrix
Retrieves the clipped matrix for paste action.- Returns:
- clippedMatrix
-
getClippedScannerVectors
@Deprecated public Vector<Vector<WildMagic.LibFoundation.Mathematics.Vector3f>> getClippedScannerVectors()Deprecated.DOCUMENT ME!- Returns:
- DOCUMENT ME!
-
getClippedVOIs
Deprecated.Returns the VOIs copied into the clip board. For copying and pasting VOIs between images.- Returns:
- Vector
-
getCopyVOIs
-
getCopyVOINames
-
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
Accessor to get directory location of last file access.- Returns:
- The last file directory
-
getDefaultScriptDirectory
Accessor to get directory location of script files.- Returns:
- The script file directory
-
getDICOMCatcher
Accessor to get the DICOM receiver.- Returns:
- the DICOM receiver
-
getDICOMQueryFrame
Accessor to get the DICOM query frame.- Returns:
- The DICOM query frame.
-
getFrameContainingImage
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
Accessor that returns frame vector.- Returns:
- The vector that has a list of frames visible in the GUI.
-
getJarClassLoader
-
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
Accessor that returns the main user interface frame.- Returns:
- The main user interface frame.
-
getMenuBuilder
Returns the interface's menu builder. -
getMessageFrame
Accessor that returns the message frame.- Returns:
- The message frame.
-
getMessageText
Accessor to get text of message field. -
getNewFrameLocation
Changes location of image when first displayed.- Returns:
- The new location.
-
getNewFrameYLocation
Changes vertical location of image when first displayed.- Returns:
- The new location.
-
getProgressBarPrefix
Gets the string "Opening " or "Loading " based on what the progress bar should be displaying.- Returns:
- String OPENING_STR or LOADING_STR
-
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:
-
getRegisteredImageByName
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:
IllegalArgumentException- if the name is not in the image hastable.- See Also:
-
getRegisteredImageNames
Return an enumeration of keys (image names) from the image hashtable.- Returns:
- An Enumeration containing the keys (image names).
- See Also:
-
getRegisteredImages
Return an enumeration of images (elements) from the image hashtable.- Returns:
- An Enumeration containing the elements (images).
- See Also:
-
getRegisteredImagesNum
public int getRegisteredImagesNum()Return an num of images (elements) from the image hashtable.- Returns:
- images number
- See Also:
-
imageRegistryMonitoring
public void imageRegistryMonitoring()Display image registry frame. -
imagesToFront
public void imagesToFront()Brings all images and message frame to the front. -
initializeGui
public void initializeGui()Initializes the user interface. Starts by reading out some starting options out of the preferences file; setting up the main frame; building the message frame and setting the message frame into the preferences; building the menu; setting controls; initialising the DICOM dictionary; setting up the message field that is used in the main frame; setting the application titles; and showing the main frame.Recommendations for how to most easily perform modifications to the initialisation procedure are included with the individual method comments, although in most cases, it suffices to simply over-ride an individual method.
- See Also:
-
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:
-
isImageRegistered
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:
-
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
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:
keyPressedin interfaceKeyListener- Parameters:
e- a key event generated by the user
-
keyReleased
Pass the key event to the selected image frame (if one exists).- Specified by:
keyReleasedin interfaceKeyListener- Parameters:
e- a key event generated by the user
-
keyTyped
Pass the key event to the selected image frame (if one exists).- Specified by:
keyTypedin interfaceKeyListener- 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
Deletes the item specified by name. If false, only the model image is deleted- Parameters:
name- the object to deletedeleteFrame- whether the frame should be deleted along with the imagerunGC- 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
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
Open an image and put it into a new frame, given the image file name.- Parameters:
imageFileName- the file name, without the pathimageFileDir- the directory where the file is
-
openImageFrame
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
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:
parseArgumentsin interfaceCommandLineParser- 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
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
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
-
registerImage
Register image model by adding it to the image hashtable. Use the image name as the key. If the name is not unique then theCustomHashtablewill 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:
-
registerImage
Register image model by adding it to the image hashtable. Use the String provided as the key. If the key is not unique then theCustomHashtablewill attempt to make it unique. The actual key used will be returned.- Parameters:
key- the desired image keyimage- Image to be registered.- Returns:
- the actual image key used (unique)
- See Also:
-
removeAloneMenu
Removes the stand-alone menu from the user interface.- Parameters:
menu- the menu to be removed.
-
setActiveFrame
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
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
Accessor to set text of data FRAME.- Parameters:
str- String to be displayed in text panel.
-
setDefaultDirectory
Sets directory location of last file access.- Parameters:
defaultDirectory- Directory to set it to.
-
setDefaultScriptDirectory
Sets directory location of the script files.- Parameters:
dir- Directory to set the script directory to.
-
setDICOMCatcher
Accessor to set the DICOM receiver.- Parameters:
rcv- the DICOM receiver
-
setDICOMQueryFrame
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
Accessor to set text of global data FRAME.- Parameters:
str- String to be displayed in text panel.
-
setJarClassLoader
-
setLastScript
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
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
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
GetPathclass) 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 thePreferences.debugwindow and is otherwise ignored. A warning box is displayed when the license dialog cannot be created (and throws aNullPointerException). Finally, the main frame does not record this item in its list of windows, so many instances of this window may be made. -
showLicense
Displays the MIPAV Software Transfer Agreement in a JDialogText window.The "license.html" file is read (using the
GetPathclass) 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 thePreferences.debugwindow and is otherwise ignored. A warning box is displayed when the license dialog cannot be created (and throws aNullPointerException). 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 framefilename- 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
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
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
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:
IllegalArgumentException- if image isnull
-
unRegisterImage
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:
IllegalArgumentException- if imageKey isnull
-
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
Do nothing - required by ScriptRecordingListener interface.- Specified by:
updateScriptin interfaceScriptRecordingListener- Parameters:
newScriptText- Ignored.
-
windowActivated
Do nothing.- Specified by:
windowActivatedin interfaceWindowListener- Parameters:
event- the window event.
-
windowClosed
Do nothing.- Specified by:
windowClosedin interfaceWindowListener- Parameters:
event- the window event.
-
windowClosing
Confirms if the user really wants to exit, then closes the application.- Specified by:
windowClosingin interfaceWindowListener- Parameters:
event- Event that triggered this function.
-
cleanupAndExit
public void cleanupAndExit() -
windowDeactivated
Do nothing.- Specified by:
windowDeactivatedin interfaceWindowListener- Parameters:
event- the window event.
-
windowDeiconified
Deiconify only the other frames who's last state was normal (ie- restore other frames to their lastState).- Specified by:
windowDeiconifiedin interfaceWindowListener- Parameters:
event- the deiconify window event.
-
windowIconified
Iconify all other frames associateed with MIPAV.- Specified by:
windowIconifiedin interfaceWindowListener- Parameters:
event- the iconify window event.
-
windowOpened
Do nothing.- Specified by:
windowOpenedin interfaceWindowListener- Parameters:
event- the window event.
-
writeDataProvenance
public void writeDataProvenance()Writes Mipav's data provenance to the default location..
-
initCreateMemoryUsagePanel
Construct the panel which displays the current memory usage/limit and a garbage collection button.- Returns:
- the memory usage panel
-
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
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 istrue. -
initMacintoshJDKversionCheck
protected void initMacintoshJDKversionCheck()Method checks to verify that when running on a Machintosh, the JDK version is at least 1invalid input: '�'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
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:
-
initSetTitles
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:- splash screen
- checks the VM heap size max
- sets the default directory
- debug output
- 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:
-
runCmdLine
protected void runCmdLine(String scriptFile, Vector<ViewUserInterface.OpenFileInfo> imageList, Vector<Vector<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:
-
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
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
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
-
getDiscoverableActionList
-
getExceptions
- Returns:
- the exceptions
-
getOutputDir
-
getSecondaryPluginsDir
-
getUserDefaultDir
-
setProvidedOutputDir
public static void setProvidedOutputDir(boolean providedOutputDir) -
setProvidedUserDefaultDir
public static void setProvidedUserDefaultDir(boolean providedUserDefaultDir) -
setOutputDir
-
setSecondaryPluginsDir
-
setUserDefaultDir
-
parseStaticArguments
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
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
-