whistleClassifier
Class WhistleClassifierControl

java.lang.Object
  extended by PamController.PamControlledUnit
      extended by whistleClassifier.WhistleClassifierControl
All Implemented Interfaces:
PamSettings

public class WhistleClassifierControl
extends PamControlledUnit
implements PamSettings

Whistle Classifier control class.

Two main run modes / Three main tasks.

While running PAMGUARD, the classifier can either accumulate contours in training data files, or it can run a species classifier.

While PAMGUARD is idle, the user can run the training dialog which will take a set of training contours for various species and use them to tune a classifier.

The output from the classifier training is held in the normal module settings (in the psg files), but there is a facility for the specific training data to be exported to other files so that they can be loaded separately into different PAMGUARD configurations.

Author:
Doug

Nested Class Summary
(package private)  class WhistleClassifierControl.DetectionSettings
           
(package private)  class WhistleClassifierControl.MenuTraining
           
 
Field Summary
static java.lang.String classifierFileEnd
          File end for whistle classifier data (i.e.
private  ClassifierOffline classifierOffline
           
private  Classifier fragmentClassifier
           
private  FragmentParameteriser fragmentParameteriser
           
private  boolean isViewer
           
static java.lang.String trainingFileEnd
          File end for training data (contour) files
private  WhistleClassificationParameters whistleClassificationParameters
           
protected  WhistleClassifierProcess whistleClassifierProcess
           
private  WhistleClassifierTabPanelControl whistleClassifierTabPanel
           
private  WhistleFragmenter whistleFragmenter
           
 
Constructor Summary
WhistleClassifierControl(java.lang.String unitName)
           
 
Method Summary
 javax.swing.JMenuItem createDetectionMenu(java.awt.Frame parentFrame)
          Create a JMenu object containing MenuItems associated with PamProcesses
 Classifier getFragmentClassifier()
           
 FragmentParameteriser getFragmentParameteriser()
           
 java.io.Serializable getSettingsReference()
           
 long getSettingsVersion()
           
 PamTabPanel getTabPanel()
          Gets a reference to a panel to be added to a view
 WhistleClassificationParameters getWhistleClassificationParameters()
           
 WhistleClassifierProcess getWhistleClassifierProcess()
           
 WhistleFragmenter getWhistleFragmenter()
           
 FragmentClassifierParams loadFragmentClassifierParams(java.awt.Frame frame, WhistleClassificationParameters whistleClassificationParameters)
           
 void notifyModelChanged(int changeType)
          General notification when the PAMGAURD model changes.
 void pamHasStopped()
          Called for all controlled units after Pam acquisition has stopped
 boolean restoreSettings(PamControlledUnitSettings pamControlledUnitSettings)
           
 boolean saveClassifierParams(java.awt.Frame frame, FragmentClassifierParams params)
          Save a set of classifier params.
 void setFragmentClassifier(Classifier fragmentClassifier)
           
 void setFragmentParameteriser(FragmentParameteriser fragmentParameteriser)
           
 void settingsDialog(java.awt.Frame parentFrame)
           
private  boolean setupClassifier()
          SEts up a classifier with classifier specific settings Future versions, which will support > 1 type of classifier will have to look at the class in the parameters and create the correct type of classifier.
private  void setupProcess()
           
 void setWhistleClassificationParameters(WhistleClassificationParameters whistleClassificationParameters)
           
 void setWhistleFragmenter(WhistleFragmenter whistleFragmenter)
           
private  void trainingDialog(java.awt.Frame parentFrame)
           
 void updateClassification(boolean ok)
          called from the Classification Process whenever the statistical model has run
 
Methods inherited from class PamController.PamControlledUnit
addOtherRelatedMenuItems, addPamProcess, addRelatedMenuItems, canClose, createDisplayMenu, createFileMenu, createHelpMenu, fillXMLElement, fillXMLParameters, getFrameNumber, getNumPamProcesses, getPamController, getPamModuleInfo, getPamProcess, getPamView, getSidePanel, getTabClipCopier, getTabSpecificMenuBar, getUnitName, getUnitType, gotoTab, notifyArrayChanged, pamToStart, removePamProcess, removeUnit, rename, saveViewerData, setFrameNumber, setPamController, setPamModuleInfo, setPamView, setSidePanel, setTabPanel, setupControlledUnit, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface PamController.PamSettings
getUnitName, getUnitType
 

Field Detail

whistleClassifierProcess

protected WhistleClassifierProcess whistleClassifierProcess

whistleClassifierTabPanel

private WhistleClassifierTabPanelControl whistleClassifierTabPanel

whistleClassificationParameters

private WhistleClassificationParameters whistleClassificationParameters

whistleFragmenter

private WhistleFragmenter whistleFragmenter

fragmentParameteriser

private FragmentParameteriser fragmentParameteriser

fragmentClassifier

private Classifier fragmentClassifier

classifierOffline

private ClassifierOffline classifierOffline

trainingFileEnd

public static final java.lang.String trainingFileEnd
File end for training data (contour) files

See Also:
Constant Field Values

classifierFileEnd

public static final java.lang.String classifierFileEnd
File end for whistle classifier data (i.e. Eigen matrixes and that stuff)

See Also:
Constant Field Values

isViewer

private boolean isViewer
Constructor Detail

WhistleClassifierControl

public WhistleClassifierControl(java.lang.String unitName)
Method Detail

getWhistleClassifierProcess

public WhistleClassifierProcess getWhistleClassifierProcess()
Returns:
the whistleClassifierProcess

createDetectionMenu

public javax.swing.JMenuItem createDetectionMenu(java.awt.Frame parentFrame)
Description copied from class: PamControlledUnit
Create a JMenu object containing MenuItems associated with PamProcesses

Overrides:
createDetectionMenu in class PamControlledUnit
Parameters:
parentFrame - The owner frame of the menu
Returns:
reference to a JMenu which can be added to an existing menu or menu bar

Note that if multiple views are to use the same menu, then they should each create a new menu (by setting Create to true) the first time they call this method.


settingsDialog

public void settingsDialog(java.awt.Frame parentFrame)

trainingDialog

private void trainingDialog(java.awt.Frame parentFrame)

setupProcess

private void setupProcess()

setupClassifier

private boolean setupClassifier()
SEts up a classifier with classifier specific settings Future versions, which will support > 1 type of classifier will have to look at the class in the parameters and create the correct type of classifier. For now though, assume that a linear classifier has already been created as default.

Returns:
true if parameters were there and can be set up.

pamHasStopped

public void pamHasStopped()
Description copied from class: PamControlledUnit
Called for all controlled units after Pam acquisition has stopped

Overrides:
pamHasStopped in class PamControlledUnit

notifyModelChanged

public void notifyModelChanged(int changeType)
Description copied from class: PamControlledUnit
General notification when the PAMGAURD model changes.

Overrides:
notifyModelChanged in class PamControlledUnit
Parameters:
changeType - type of change

getTabPanel

public PamTabPanel getTabPanel()
Description copied from class: PamControlledUnit
Gets a reference to a panel to be added to a view

Overrides:
getTabPanel in class PamControlledUnit
Returns:
reference to a PamTabPanel object
See Also:
PamTabPanel, PamSidePanel

updateClassification

public void updateClassification(boolean ok)
called from the Classification Process whenever the statistical model has run

Parameters:
ok -

getSettingsReference

public java.io.Serializable getSettingsReference()
Specified by:
getSettingsReference in interface PamSettings
Returns:
The serialisable object that will be stored

getSettingsVersion

public long getSettingsVersion()
Specified by:
getSettingsVersion in interface PamSettings
Returns:
An integer version number for the settings

restoreSettings

public boolean restoreSettings(PamControlledUnitSettings pamControlledUnitSettings)
Specified by:
restoreSettings in interface PamSettings
Returns:
true if successful The object performs final checks (if needed) and then casts the settings data pamcontrolledunitSettings.settings into the correct type and uses as required

saveClassifierParams

public boolean saveClassifierParams(java.awt.Frame frame,
                                    FragmentClassifierParams params)
Save a set of classifier params. Since this is primarily an export function, it will always show the file save dialog

Parameters:
params - parameters to save
Returns:
true if successful.

loadFragmentClassifierParams

public FragmentClassifierParams loadFragmentClassifierParams(java.awt.Frame frame,
                                                             WhistleClassificationParameters whistleClassificationParameters)

setWhistleFragmenter

public void setWhistleFragmenter(WhistleFragmenter whistleFragmenter)
Parameters:
whistleFragmenter - the whistleFragmenter to set

getWhistleFragmenter

public WhistleFragmenter getWhistleFragmenter()
Returns:
the whistleFragmenter

setWhistleClassificationParameters

public void setWhistleClassificationParameters(WhistleClassificationParameters whistleClassificationParameters)
Parameters:
whistleClassificationParameters - the whistleClassificationParameters to set

getWhistleClassificationParameters

public WhistleClassificationParameters getWhistleClassificationParameters()
Returns:
the whistleClassificationParameters

getFragmentParameteriser

public FragmentParameteriser getFragmentParameteriser()

setFragmentParameteriser

public void setFragmentParameteriser(FragmentParameteriser fragmentParameteriser)

setFragmentClassifier

public void setFragmentClassifier(Classifier fragmentClassifier)
Parameters:
fragmentClassifier - the fragmentClassifier to set

getFragmentClassifier

public Classifier getFragmentClassifier()
Returns:
the fragmentClassifier