Class TargetMotionLocaliser<T extends GroupDetection>

Type Parameters:
T -
All Implemented Interfaces:
LocalisationAlgorithm, LocalisationAlgorithmInfo

public class TargetMotionLocaliser<T extends GroupDetection> extends AbstractLocaliser<T> implements LocalisationAlgorithm, LocalisationAlgorithmInfo
Reinstated Target motion add-in as used by the click detector. Hope one day still to replace this with Jamie's new one, but keep this one until Jamie's is working.
Author:
Doug Gillespie
  • Field Details

    • currentEventIndex

      public int currentEventIndex
      Database index of current event. Not the same as the eventListIndex

      Use index instead of reference since the data are often reloaded, so references become out of date.

  • Constructor Details

  • Method Details

    • getLocaliserName

      public String getLocaliserName()
      Specified by:
      getLocaliserName in class AbstractLocaliser<T extends GroupDetection>
      Returns:
      a name for the localiser for use in dialogs, menus, etc.
    • getAlgorithmInfo

      public LocalisationAlgorithmInfo getAlgorithmInfo()
      Description copied from interface: LocalisationAlgorithm
      Get information about the localisation algorithm.
      Specified by:
      getAlgorithmInfo in interface LocalisationAlgorithm
      Returns:
      algorithm information.
    • localiseDataUnit

      public boolean localiseDataUnit(T dataUnit)
      Description copied from class: AbstractLocaliser
      Localise a data unit.

      Localisation results will be added to the data unit itself in the AbstractLocalisation field.

      Specified by:
      localiseDataUnit in class AbstractLocaliser<T extends GroupDetection>
      Parameters:
      dataUnit - data unit to localise
      Returns:
      true if localisation was successful.
    • getEventMenuItem

      public JMenuItem getEventMenuItem(T pamDetection)
      Get a menu item to insert into a pop-up menu for a single event (i.e. right click on click train and get this menu). Use the default datablock data name in the menu title.
      Parameters:
      pamDetection - detection to include in menu action.
      Returns:
      menu item or null if action on the detection is not possible
    • getEventMenuItem

      public JMenuItem getEventMenuItem(T pamDetection, String dataName)
      Get a menu item to insert into a pop-up menu for a single event using a specific name for the data (database index will be appended to this name)
      Parameters:
      pamDetection - data unit to include in the menu action
      dataName - data name to include in the meny text
      Returns:
      menu item or null if action on the detection is not possible
    • showTMDialog

      public boolean showTMDialog(T dataUnit)
    • addDetectorMenuItems

      public int addDetectorMenuItems(Frame parentFrame, JMenu menu)
    • checkDataLoadTime

      public boolean checkDataLoadTime(T event)
    • clearResults

      public void clearResults()
    • getResults

      public ArrayList<GroupLocResult> getResults()
    • addResults

      public void addResults(GroupLocResult[] newResults)
    • getBestResultIndex

      public int getBestResultIndex()
      Returns:
      the bestResultIndex
    • setBestResultIndex

      public void setBestResultIndex(int bestResultIndex)
      Parameters:
      bestResultIndex - the bestResultIndex to set
    • getDataBlock

      public PamDataBlock<T> getDataBlock()
      Overrides:
      getDataBlock in class AbstractLocaliser<T extends GroupDetection>
      Returns:
      the dataBlock
    • getModels

      public ArrayList<TargetMotionModel<T>> getModels()
    • findModelByName

      public TargetMotionModel findModelByName(String modelName, boolean shortLength)
      Find a model by it's name. If shortLength is true, then it will accept a match in which the modelName is only partly included in the full model name. This is required since the names in the database may have been truncated and are therefore incomplete.
      Parameters:
      modelName - model name to search for.
      shortLength - allow short model names (if truncated in the database)
      Returns:
      reference to a TM model, or null.
    • dataChanged

      public void dataChanged(T pamDetection)
      Called when data in the main source data block are changed
      Parameters:
      pamDetection -
    • localiseEventList

      public void localiseEventList(int[] eventList, TargetMotionModel<T>[] modelList, boolean isSupervised)
    • interractiveCommand

      public void interractiveCommand(TargetMotionLocaliser.Interractive interractive)
    • getCurrentEvent

      public T getCurrentEvent()
    • getCurrentEventIndex

      public int getCurrentEventIndex()
    • setCurrentEventIndex

      public void setCurrentEventIndex(int currentEventIndex, Object sender)
    • runModels

      public GroupLocResult[] runModels(T anEvent, DetectionGroupOptions detectionGroupOptions, TargetMotionModel<T>[] modelList)
    • findEvent

      public T findEvent(int databaseIndex)
      Find an event from it's database index.
      Parameters:
      databaseIndex -
    • selectBestResult

      public int selectBestResult(GroupLocResult[] results)
      Work out which is the best result based on Chi2 and AIC.
      Parameters:
      results - array of results to compare.
      Returns:
      index of best result, or -1 if there are no results or none with AIC or Chi2 values.
    • getTMLocalisation

      public TargetMotionLocalisation getTMLocalisation(T event)
      Get the localisation from an event. This will only return if the localisation is of the correct type. Can be used to avoid exceptions if some other sort of localisation has been added to an event
      Parameters:
      event -
      Returns:
      localisation or null if there isn't one or it's the wrong type.
    • getLocalisationContents

      public int getLocalisationContents()
      Description copied from interface: LocalisationAlgorithmInfo
      Get the likely content flags for this localiser.
      Specified by:
      getLocalisationContents in interface LocalisationAlgorithmInfo
      Returns:
      localisation flags.
      See Also:
    • getAlgorithmName

      public String getAlgorithmName()
      Description copied from interface: LocalisationAlgorithmInfo
      Get the algorithm name
      Specified by:
      getAlgorithmName in interface LocalisationAlgorithmInfo
      Returns:
      algorithm name
    • getTethysCreator

      public LocalizationCreator getTethysCreator()
      Description copied from interface: LocalisationAlgorithm
      Get something that can make LocalisationType objects of a form a bit bespoke to the type of localiser. This may be better than having the standard functions in LocalizationBuilder guess what's best.
      Specified by:
      getTethysCreator in interface LocalisationAlgorithm
      Returns:
      can be null in which case standard functions will do the best they can.
    • getParameters

      public Serializable getParameters()
      Description copied from interface: LocalisationAlgorithmInfo
      Get the algorithm parameters. Something else can turn these into xml for Tethys.
      Specified by:
      getParameters in interface LocalisationAlgorithmInfo
      Returns:
      algorithm parameters object. Might be null;