Class CircleFitter

All Implemented Interfaces:
PropertyChangeListener, EventListener, Drawable, Interactive, Measurable, Trackable

public class CircleFitter extends TTrack
A CircleFitter track fits and measures circles and their centers.
Author:
Douglas Brown
  • Field Details

    • maxDataPointCount

      protected static final int maxDataPointCount
      See Also:
    • dataVariables

      protected static final String[] dataVariables
    • fieldVariables

      protected static final String[] fieldVariables
    • formatVariables

      protected static final String[] formatVariables
    • formatMap

      protected static final Map<String,String[]> formatMap
    • formatDescriptionMap

      protected static final Map<String,String> formatDescriptionMap
    • allVariables

      protected static final ArrayList<String> allVariables
    • fixedPosition

      protected boolean fixedPosition
    • clickToMarkLabel

      protected JLabel clickToMarkLabel
    • xDataPointLabel

      protected JLabel xDataPointLabel
    • yDataPointLabel

      protected JLabel yDataPointLabel
    • xDataField

      protected NumberField xDataField
    • yDataField

      protected NumberField yDataField
    • xDataPointSeparator

      protected Component xDataPointSeparator
    • yDataPointSeparator

      protected Component yDataPointSeparator
    • clearPointsItem

      protected JMenuItem clearPointsItem
    • setRadiusItem

      protected JMenuItem setRadiusItem
    • setRadiusAllItem

      protected JMenuItem setRadiusAllItem
    • originToCenterItem

      protected JMenuItem originToCenterItem
    • originToCenterAllItem

      protected JMenuItem originToCenterAllItem
    • originToCenterMenu

      protected JMenu originToCenterMenu
    • setRadiusMenu

      protected JMenu setRadiusMenu
    • attachmentItem

      protected JMenuItem attachmentItem
    • pointCountButton

      protected JButton pointCountButton
    • attachToSteps

      protected boolean attachToSteps
    • isRelativeFrameNumbers

      protected boolean isRelativeFrameNumbers
    • absoluteStart

      protected int absoluteStart
    • relativeStart

      protected int relativeStart
    • attachmentFrameCount

      protected int attachmentFrameCount
    • attachmentForSteps

      protected TTrack[] attachmentForSteps
    • stepAttachmentName

      protected String stepAttachmentName
    • PROPERTY_CIRCLEFITTER_DATAPOINT

      public static final String PROPERTY_CIRCLEFITTER_DATAPOINT
      See Also:
  • Constructor Details

    • CircleFitter

      public CircleFitter()
      Constructs a CircleFitter.
  • Method Details

    • getFormatVariables

      public String[] getFormatVariables()
      Specified by:
      getFormatVariables in class TTrack
    • getFormatMap

      public Map<String,String[]> getFormatMap()
      Specified by:
      getFormatMap in class TTrack
    • getFormatDescMap

      public Map<String,String> getFormatDescMap()
      Specified by:
      getFormatDescMap in class TTrack
    • getBaseType

      public String getBaseType()
      Specified by:
      getBaseType in class TTrack
    • getVarDimsImpl

      public String getVarDimsImpl(String variable)
      Specified by:
      getVarDimsImpl in class TTrack
    • setFixed

      public void setFixed(boolean fixed)
      Sets the fixed property. When fixed, it has the same data points at all times.
      Parameters:
      fixed - true to fix
    • isFixed

      public boolean isFixed()
      Gets the fixed property.
      Returns:
      true if fixed
    • isValidCircle

      public boolean isValidCircle(int frame)
      Determines if a valid circle exists at a specified frame number.
      Returns:
      true if valid
    • propertyChange

      public void propertyChange(PropertyChangeEvent e)
      Description copied from class: TTrack
      Responds to property change events fired in TrackerPanel or VideoPanel.
      Specified by:
      propertyChange in interface PropertyChangeListener
      Overrides:
      propertyChange in class TTrack
      Parameters:
      e - the property change event
    • setTrailVisible

      public void setTrailVisible(boolean visible)
      Description copied from class: TTrack
      Shows and hides the trail. If the trail is shown, all steps are visible. If not, only the current step is visible.
      Overrides:
      setTrailVisible in class TTrack
      Parameters:
      visible - true to show trail
    • createStep

      public Step createStep(int n, double x, double y)
      Implements createStep but only mimics step creation since steps are created automatically by the autofill StepArray.
      Specified by:
      createStep in class TTrack
      Parameters:
      n - the frame number
      x - the x coordinate in image space
      y - the y coordinate in image space
      Returns:
      the step
    • deleteStep

      public Step deleteStep(int n)
      Overrides TTrack deleteStep method to delete selected data points.
      Overrides:
      deleteStep in class TTrack
      Parameters:
      n - the frame number
      Returns:
      null since the step itself is never deleted
    • getStep

      public Step getStep(int n)
      Description copied from class: TTrack
      Gets a step specified by frame number. May return null.
      Overrides:
      getStep in class TTrack
      Parameters:
      n - the frame number
      Returns:
      the step
    • getStep

      public Step getStep(TPoint point, TrackerPanel trackerPanel)
      Description copied from class: TTrack
      Gets a step containing a TPoint. May return null.
      Overrides:
      getStep in class TTrack
      Parameters:
      point - a TPoint
      trackerPanel - ignored
      Returns:
      the step containing the TPoint
    • getStepLength

      public int getStepLength()
      Description copied from class: TTrack
      Gets the length of the steps created by this track.
      Specified by:
      getStepLength in class TTrack
      Returns:
      the footprint length
    • getFootprintLength

      public int getFootprintLength()
      Description copied from class: TTrack
      Gets the length of the footprints required by this track.
      Specified by:
      getFootprintLength in class TTrack
      Returns:
      the footprint length
    • setFontLevel

      public void setFontLevel(int level)
      Description copied from class: TTrack
      Sets the font level.
      Overrides:
      setFontLevel in class TTrack
      Parameters:
      level - the desired font level
    • dispose

      public void dispose()
      Description copied from class: TTrack
      Disposes of resources when this track is deleted or cleared.
      Overrides:
      dispose in class TTrack
    • isNoPoints

      public boolean isNoPoints(int frameNumber)
      Determines if this is attached to one or more tracks.
      Returns:
      true if attached
    • setAttachmentStartFrame

      public void setAttachmentStartFrame(int n)
      Sets the start frame for single track attachments.
      Parameters:
      n - the desired start frame
    • getAttachmentStartFrame

      public int getAttachmentStartFrame(int frameNumber)
      Gets the start frame for single track attachments.
      Parameters:
      frameNumber - the frame number
      Returns:
      the start frame
    • setAttachmentFrameCount

      public void setAttachmentFrameCount(int n)
      Sets the attachment frame count for single track attachments.
      Parameters:
      n - the desired frame count
    • getAttachmentFrameCount

      public int getAttachmentFrameCount()
      Gets the attachment frame count.
      Returns:
      the frame count
    • getAttachmentEndFrame

      public int getAttachmentEndFrame(int frameNumber)
      Gets the end frame for single track attachments.
      Parameters:
      frameNumber - the current frame number
      Returns:
      the end frame
    • getAttachmentLength

      protected int getAttachmentLength()
      Overrides:
      getAttachmentLength in class TTrack
    • getAttachments

      public TTrack[] getAttachments()
      Description copied from class: TTrack
      Returns the array of attachments for this track. Returns null only if the specified number of attachments == 0.
      Overrides:
      getAttachments in class TTrack
      Returns:
      the attachments array
    • getAttachmentDescription

      public String getAttachmentDescription(int n)
      Returns the description of a particular attachment point.
      Overrides:
      getAttachmentDescription in class TTrack
      Parameters:
      n - the attachment point index
      Returns:
      the description
    • refreshAttachments

      protected void refreshAttachments()
      Refreshes the attachments for this track. This manages attached data points (dataPoints[1]) and ignores marked data points (dataPoints[0])
      Overrides:
      refreshAttachments in class TTrack
    • refreshAttachmentsAync

      protected void refreshAttachmentsAync()
    • getMenu

      public JMenu getMenu(TrackerPanel trackerPanel, JMenu menu0)
      Description copied from class: TTrack
      Prepares menu items and adds them to a menu. Subclasses should override this method and add track-specific menu items.
      Overrides:
      getMenu in class TTrack
      Parameters:
      trackerPanel - the tracker panel
      menu0 - the menu. If null, a dynamic menu is returned that adds items only when selected
      Returns:
      a menu
    • getToolbarTrackComponents

      public ArrayList<Component> getToolbarTrackComponents(TrackerPanel trackerPanel)
      Description copied from class: TTrack
      Returns an empty list of track-related toolbar components. Subclasses should override this method and add track-specific components.
      Overrides:
      getToolbarTrackComponents in class TTrack
      Parameters:
      trackerPanel - the tracker panel
      Returns:
      a collection of components
    • getToolbarPointComponents

      public ArrayList<Component> getToolbarPointComponents(TrackerPanel trackerPanel, TPoint point)
      Description copied from class: TTrack
      Returns an empty list of point-related toolbar components. Subclasses should override this method and add point-specific components.
      Overrides:
      getToolbarPointComponents in class TTrack
      Parameters:
      trackerPanel - the tracker panel
      point - the TPoint
      Returns:
      a list of components
    • findInteractive

      public Interactive findInteractive(DrawingPanel panel, int xpix, int ypix)
      Description copied from class: TTrack
      Finds the interactive drawable object located at the specified pixel position.
      Specified by:
      findInteractive in interface Interactive
      Overrides:
      findInteractive in class TTrack
      Parameters:
      panel - the drawing panel
      xpix - the x pixel position on the panel
      ypix - the y pixel position on the panel
      Returns:
      the first step TPoint that is hit
    • toString

      public String toString()
      Description copied from class: TTrack
      Overrides Object toString method.
      Overrides:
      toString in class TTrack
      Returns:
      a description of this object
    • getNumberFields

      public Map<String,NumberField[]> getNumberFields()
      Description copied from class: TTrack
      Gets a map of number fields by name.
      Overrides:
      getNumberFields in class TTrack
      Returns:
      a map of name to NumberField.
    • setTrackerPanel

      public void setTrackerPanel(TrackerPanel panel)
      Description copied from class: TTrack
      Install the controlling TrackerPanel for this track (by default, the first TrackerPanel that adds this track to its drawables) and add this track to the panel's specific (outgoing) listener lists so that the track can respond to external changes. This method is overridden to add specific TrackerPanel events for subclasses.
      Overrides:
      setTrackerPanel in class TTrack
      Parameters:
      panel - the TrackerPanel
    • setAnglesInRadians

      protected void setAnglesInRadians(boolean radians)
      Description copied from class: TTrack
      Sets the display format for angles.
      Overrides:
      setAnglesInRadians in class TTrack
      Parameters:
      radians - true for radians, false for degrees
    • getTargetDescription

      protected String getTargetDescription(int pointIndex)
      Description copied from class: TTrack
      Returns a description of a target point with a given index.
      Overrides:
      getTargetDescription in class TTrack
      Parameters:
      pointIndex - the index
      Returns:
      the description
    • refreshData

      protected void refreshData(DatasetManager data, TrackerPanel trackerPanel)
      Description copied from class: TTrack
      Refreshes the data in the specified DatasetManager. Subclasses should use this method to refresh track-specific data sets.
      Overrides:
      refreshData in class TTrack
      Parameters:
      data - the DatasetManager
    • refreshStep

      protected void refreshStep(CircleFitterStep step)
      Refreshes a step by setting it equal to a keyframe step.
      Parameters:
      step - the step to refresh
    • refreshFields

      protected void refreshFields(int frameNumber)
      Refreshes the toolbar fields.
    • getKeyStep

      protected CircleFitterStep getKeyStep(CircleFitterStep step)
      Returns the key step for a given step.
      Parameters:
      step - the step
      Returns:
      the key step
    • loadAttachmentsFromNames

      protected boolean loadAttachmentsFromNames(boolean refresh)
      Loads the attachments for this track.
      Overrides:
      loadAttachmentsFromNames in class TTrack
      Parameters:
      refresh - true to refresh attachments after loading
      Returns:
      true if attachments were loaded
    • setCoordsOriginToCenter

      protected void setCoordsOriginToCenter(boolean all)
      Sets the coordinate system origin to the circle center.
      Parameters:
      all - true to set origin in all frames, else only in the current frame
    • setCoordsScaleFromRadius

      protected void setCoordsScaleFromRadius(boolean all)
      Brings up a dialog to sets the coordinate system scale by setting the circle radius.
      Parameters:
      all - true to set the scale in all frames, else only in the current frame.
    • getLoader

      public static XML.ObjectLoader getLoader()
      Returns an ObjectLoader to save and load data for this class.
      Returns:
      the object loader