Class JDialogVOIStatistics

All Implemented Interfaces:
AlgorithmInterface, ScriptableActionInterface, VOIVectorListener, VOIStatisticList, DialogDefaultsInterface, ActionListener, FocusListener, ItemListener, WindowListener, ImageObserver, MenuContainer, Serializable, EventListener, Accessible, RootPaneContainer, WindowConstants

public class JDialogVOIStatistics extends JDialogScriptableBase implements AlgorithmInterface, VOIStatisticList, VOIVectorListener
Dialog for calculating statistics of a (set of) Volumes of Interest. User selects a Volume of Interest (or more than one) to act on, selects the statistics from a selectable checklist panel. The User selects "Calculate"; the output from the statistics is reported in a "log-panel" and may be sent to a file.

$Logfile: /mipav/src/gov/nih/mipav/view/dialogs/JDialogVOIStatistics.java $

See Also:
  • Field Details

    • serialVersionUID

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

      protected static final int VOI_TAB
      VOI Tab.
      See Also:
    • STAT_TAB

      protected static final int STAT_TAB
      Statistics Tab.
      See Also:
    • LOG_TAB

      protected static final int LOG_TAB
      Logging Tab.
      See Also:
    • APPEND

      private static final int APPEND
      File handler output mode - append.
      See Also:
    • OVERWRITE

      private static final int OVERWRITE
      File handler output mode - overwriteBox.
      See Also:
    • addremove

      Panel to push/pull VOIs from full list to selectable list.
    • calculator

      protected AlgorithmVOIProps calculator
      DOCUMENT ME!
    • checkBoxPanel

      protected JPanelStatisticsList checkBoxPanel
      Panel holding statistics options.
    • checkList

      protected boolean[] checkList
      boolean array mirroring checkbox panel's selection.
    • doForce

      private boolean doForce
      force precision to display at maximum.
    • everything

      protected JTabbedPane everything
      Tabbed pane that holds all components.
    • fileSelectorPanel

      private JPanelFileSelection fileSelectorPanel
      Panel to select files.
    • highlighter

      Operator to provide listener access... could be done by /this/
    • image

      protected ModelImage image
      Global image reference to the currently active image during script running and recording.
    • logFileText

      private StringBuffer logFileText
      The text of the log process to be written to file.
    • logModel

      protected ViewTableModel logModel
      Model where data is stored for the table.
    • logTable

      private JTable logTable
      Table holding log of statistics calculated.
    • noisyProcess

      private final boolean noisyProcess
      Flag where true means notifying the user of stupid errors.
      See Also:
    • outputOptionsPanel

      protected JDialogVOIStatistics.JPanelStatisticsOptions outputOptionsPanel
      Panel holding statistics output options.
    • overwriteBox

      private JCheckBoxMenuItem overwriteBox
      Check box item indicating if we're to always overwriteBox the statistics file.
    • precision

      private int precision
      Number of digits after decimal place to allow.
    • processType

      protected int processType
      DOCUMENT ME!
    • activeVolume

      private int activeVolume
    • initialActiveVolume

      private int initialActiveVolume
    • tDim

      private int tDim
    • subsetAlgo

      private AlgorithmSubset subsetAlgo
    • subsetImage

      private ModelImage subsetImage
    • doAllVolumes

      private boolean doAllVolumes
    • processList

      private ViewVOIVector processList
    • r

    • rangeMaximum

      private float rangeMaximum
      DOCUMENT ME!
    • rangeMinimum

      private float rangeMinimum
      DOCUMENT ME!
    • rangeMaximumR

      private float rangeMaximumR
    • rangeMinimumR

      private float rangeMinimumR
    • rangeMaximumG

      private float rangeMaximumG
    • rangeMinimumG

      private float rangeMinimumG
    • rangeMaximumB

      private float rangeMaximumB
    • rangeMinimumB

      private float rangeMinimumB
    • selectedList

      protected JList selectedList
      List of selected VOIs.
    • showTotals

      protected boolean showTotals
      DOCUMENT ME!
    • tableDestination

      private File tableDestination
      Log file destination.
    • tableDestinationUsage

      private int tableDestinationUsage
      Indicates options for OVERWRITE, APPEND for the xlat file.
    • toolBar

      protected JToolBar toolBar
      Toolbar.
    • userInterface

      protected ViewUserInterface userInterface
      Icon and log access.
    • volumesList

      private final JList volumesList
      List of available VOIs.
    • xUnits

      protected int xUnits
      The units printed to the logModel, set in createNewLogile
    • yUnits

      protected int yUnits
      The units printed to the logModel, set in createNewLogile
    • zUnits

      protected int zUnits
      The units printed to the logModel, set in createNewLogile
    • scriptRange

      When running as a script, holds the pixel exclusion range.
  • Constructor Details

    • JDialogVOIStatistics

      public JDialogVOIStatistics()
      Empty constructor needed for dynamic instantiation.
    • JDialogVOIStatistics

      public JDialogVOIStatistics(VOIVector voiList)
      builds and packs the frame. does not set it visible.

      install the panels of source directory, destination directory, the checkbox for approving the translation-table file and the panel containing the ok and cancel buttons. Installs the checkbox panel.

      Parameters:
      voiList - DOCUMENT ME!
    • JDialogVOIStatistics

      public JDialogVOIStatistics(ModelImage srcImage, VOIVector voiList)
      builds and packs the frame. does not set it visible.

      install the panels of source directory, destination directory, the checkbox for approving the translation-table file and the panel containing the ok and cancel buttons. Installs the checkbox panel.

      Parameters:
      srcImage - input image
      voiList - DOCUMENT ME!
  • Method Details

    • actionPerformed

      public void actionPerformed(ActionEvent ae)
      when a button is clicked.
      Specified by:
      actionPerformed in interface ActionListener
      Overrides:
      actionPerformed in class JDialogBase
      Parameters:
      ae - DOCUMENT ME!
    • addedVOI

      public void addedVOI(VOIVectorEvent voiEvent)
      resets the volumes list to the current VOIVector. adds the highlighter to the new VOI.
      Specified by:
      addedVOI in interface VOIVectorListener
      Parameters:
      voiEvent - DOCUMENT ME!
    • algorithmPerformed

      public void algorithmPerformed(AlgorithmBase event)
      the standard thread-done event for AlgorithmBase.
      Specified by:
      algorithmPerformed in interface AlgorithmInterface
      Parameters:
      event - the event
    • anotherCall

      private void anotherCall()
    • refreshVOIList

      public void refreshVOIList(VOIVector VOIlist)
      Refreshes the list of available and selected VOIs.
      Parameters:
      VOIlist - imageActive's current VOIVector
    • removedVOI

      public void removedVOI(VOIVectorEvent voiEvent)
      resets the volumes list to the current VOIVector. removes the highlighter from the removed VOI.
      Specified by:
      removedVOI in interface VOIVectorListener
      Parameters:
      voiEvent - DOCUMENT ME!
    • vectorSelected

      public void vectorSelected(VOIVectorEvent voiEvent)
      un-implemented.
      Specified by:
      vectorSelected in interface VOIVectorListener
      Parameters:
      voiEvent - DOCUMENT ME!
    • callAlgorithm

      protected void callAlgorithm()
      Once all the necessary variables are set, call the VOI Props algorithm to run the statistic calculation.
      Specified by:
      callAlgorithm in class JDialogScriptableBase
    • cleanUpAndDispose

      protected void cleanUpAndDispose()
      Clean up some things done by the dialog which may affect other parts of MIPAV.
    • doPostAlgorithmActions

      protected void doPostAlgorithmActions()
      Used to perform actions after the execution of the algorithm is completed (e.g., put the result image in the image table). Defaults to no action, override to actually have it do something.
      Overrides:
      doPostAlgorithmActions in class JDialogScriptableBase
    • setGUIFromParams

      protected void setGUIFromParams()
      Set the dialog GUI using the script parameters while running this algorithm as part of a script.
      Specified by:
      setGUIFromParams in class JDialogScriptableBase
    • storeParamsFromGUI

      protected void storeParamsFromGUI() throws ParserException
      Record the parameters just used to run this algorithm in a script.
      Specified by:
      storeParamsFromGUI in class JDialogScriptableBase
      Throws:
      ParserException - If there is a problem creating/recording the new parameters.
    • buildCheckBoxPanel

      protected void buildCheckBoxPanel()
    • buildDialog

      protected void buildDialog(VOIVector voiList)
      Builds main dialog.
    • buildLogPanel

      protected JScrollPane buildLogPanel()
      creates a panel for the output log.
      Returns:
      DOCUMENT ME!
    • buildMenuEntries

      protected JMenuBar buildMenuEntries()
      Builds a small menu with "Clear log" and "Overwrite" options.
      Returns:
      DOCUMENT ME!
    • buildOKCancelPanel

      protected JPanel buildOKCancelPanel()
      creates the panel which consists of the OKAY button and the Cancel button.
      Returns:
      DOCUMENT ME!
    • buildSelectedListing

      private JPanel buildSelectedListing()
      creates the visual display in which to list all selected directories in the directory tree. The panel is 240 pixels wide though that is supposed to be the minimum size
      Returns:
      the panel which is to hold the list of selected items
    • buildSourceListingPanel

      private JPanel buildSourceListingPanel(VOIVector VOIlist)
      Creates the panel holding the directory tree.
      Parameters:
      VOIlist - DOCUMENT ME!
      Returns:
      Panel.
    • buildSourcePanel

      private JPanel buildSourcePanel(VOIVector VOIlist)
      creates the source panel which consists of the directory line, the browse button, and a check box approving the anonymize in sub-directories.
      Parameters:
      VOIlist - DOCUMENT ME!
      Returns:
      DOCUMENT ME!
    • buildToolBar

      protected void buildToolBar()
      Build the toolbar control.
    • buildVOIPanel

      protected JPanel buildVOIPanel(VOIVector VOIlist)
      creates the source panel for the VOI tab which consists of the directory line, the browse button, and a check box approving the anonymize in sub-directories. Also includes the file-format selection for the output file.
      Parameters:
      VOIlist - DOCUMENT ME!
      Returns:
      DOCUMENT ME!
    • createNewLogModel

      protected void createNewLogModel()
      This method resets the logModel in preparation for writing new statistics values
    • isStatisticSelectionOkay

      private boolean isStatisticSelectionOkay()
      checks to see if the checklist has had any selections made to it. If it hasn't, then the "Statistics Options" tab is brought to the front (it contains the checklist), and the warning message "No statistics were selected! Select a statistic." is displayed.
      Returns:
      boolean if a selection in the JPanelAnonymizeImage has been made, returns true. Otherwise, returns false.
      See Also:
    • isTableDestinationOkay

      private boolean isTableDestinationOkay()
      Locates the translation/key-file destination directory. If the directory is not there already, the directory is made. If there is a problem in creating the destination directory, the "Directory" tab is brought to the front; the warning message describing the error is displayed; then the text field with the destination directory is given focus, and all available text is displayed. If the translation/key-file is already present in the chosen directory, there will be an options dialog allowing the user to Overwrite the old translation/key-file, to append the the new translation/key to the end of the current file, or to cancel the entire operation (to look for a new location).
      Returns:
      boolean if the selected destination has been made, returns true. Otherwise, returns false.
    • setupNew

      private File setupNew(File selected) throws IOException, SecurityException
      makes the submitted directory as given by the inputted File, or the text as given in the given given textField. Priority is given to the text in the textfield, so if the File's path does not agree with the path in the text field, the directory will be made with the path in the text field. Should the text field not have any path, an IOException will be thrown indicating this problem. If the directory does not exist, it will be created; if there are errors in creating the directory, an IOException will be thrown, with error message describing the problem, with a possible remedy as a suggestion.
      Parameters:
      selected - DOCUMENT ME!
      Returns:
      File a directory
      Throws:
      IOException - -- failure to create the directory
      SecurityException - DOCUMENT ME!
    • setVariables

      private boolean setVariables()
      use the GUI results to set up the variables needed to run the algorithm.
      Returns:
      true if parameters set successfully, falseotherwise.
    • updateDialog

      protected void updateDialog()
      Method for updating the GUI after the algorithm has completed, should not be called when scripting.
    • updateStatLog

      protected void updateStatLog()
      Method for updating the table after the algorithm has completed. All relevant statistics are stored in the log model.
    • updateDialogRow

      protected void updateDialogRow(VOI voi, Vector<VOIBase>[] contours, VOIStatisticalProperties properties, ListModel list, int i, String[] rowData, String[] totalData)
      Writes the statistic data for contours
      Parameters:
      voi -
    • updateRowStatistics

      protected String[] updateRowStatistics(VOI voi, VOIStatisticalProperties properties, String[] rowData, String[] totalData, String end, int count)
      Writes general statistics data for any VOI structure given a valid "end" modifier to specify the property being fetched.
      Parameters:
      voi -
    • writeLogHeader

      protected void writeLogHeader()
      Writes the column titles of selected statistics calculations to the logModel.
    • writeLogModelToString

      protected StringBuffer writeLogModelToString()
      Converts the current logModel into either a tab-delimited text file or an XML file. TODO: Fix XML functionality.
      Returns:
    • writeStatisticFile

      protected void writeStatisticFile()
      Writes out the statistics file based on the current logModel