Class ConnectedRegion

java.lang.Object
whistlesAndMoans.ConnectedRegion
All Implemented Interfaces:
Cloneable

public class ConnectedRegion extends Object implements Cloneable
  • Constructor Details Link icon

    • ConnectedRegion Link icon

      public ConnectedRegion(int channel, int firstSlice, int regionNumber, int height)
      Constructor used during initial region detection process.
      Parameters:
      channel - channel number
      firstSlice - first slice number
      regionNumber - region number
      height - fft length
    • ConnectedRegion Link icon

      public ConnectedRegion(ConnectedRegion oldRegion, SliceData oldSlice, int peakNumber, int nJoinedStart)
      Constructor to create a new connected region during fragmentation. Constructor starts by making a single peak in a single slice.
      Parameters:
      oldRegion - old mother region which is being fragmented
      peakNumber - peak number in the slice
      nJoinedStart - number of contours that joined this one before the were fragmented.
      sliceData - start slice in the old region
  • Method Details Link icon

    • extendRegion Link icon

      public void extendRegion(SliceData oldSlice, int peakNumber)
      Extend a region during fragmentation taking a single peak from a new slice.
      Parameters:
      oldSlice - reference to slice in old unit
      peakNumber - number of peak to copy
    • addOfflineSlice Link icon

      public void addOfflineSlice(SliceData newSlice)
      Add in a slice during offline mode.
      Parameters:
      i - slice number (or slice index as it's read back !
      peakInfo -
    • checkRepeatslices Link icon

      public boolean checkRepeatslices()
      Check for slices repeating twice.
      Returns:
    • resetRegion Link icon

      public void resetRegion(int channel, int firstSlice, int regionNumber, int height)
      Prepare a region for re-use (saves some time reallocating the object if they were only used very briefly).
      Parameters:
      channel -
      firstSlice -
      regionNumber -
      height -
    • addPixel Link icon

      public void addPixel(int iCol, int iRow, FFTDataUnit fftDataUnit)
    • mergeRegion Link icon

      public void mergeRegion(ConnectedRegion region)
      Merge another region into this region and then tell the array of regions that all references to that other region now refer to this one.
      Parameters:
      region - other region
      regionArray - array of region references to update.
    • mergeFragmentedRegion Link icon

      public void mergeFragmentedRegion(ConnectedRegion r2)
      for merging two regions during the fragmentation process. Can be assumed that all slices in r2 come AFTER those in this.
      Parameters:
      r2 -
    • recycle Link icon

      public void recycle()
    • condenseInfo Link icon

      public void condenseInfo()
      Go through the data and remove create triplets of into about each part of each slice in the region. Called durign initial detection, not after refragmentation of complex shapes.
    • cleanFragmentedFragment Link icon

      public void cleanFragmentedFragment()
      similar to condenseInfo, but for refragmetned fragments.
    • isGrowing Link icon

      public boolean isGrowing()
    • setGrowing Link icon

      public void setGrowing(boolean growing)
    • getChannel Link icon

      public int getChannel()
    • getRegionNumber Link icon

      public int getRegionNumber()
    • getFirstSlice Link icon

      public int getFirstSlice()
    • getSliceHeight Link icon

      public int getSliceHeight()
    • getSliceData Link icon

      public List<SliceData> getSliceData()
    • getNumSlices Link icon

      public int getNumSlices()
    • getTotalPixels Link icon

      public int getTotalPixels()
    • getStartMillis Link icon

      public long getStartMillis()
    • getDuration Link icon

      public long getDuration()
    • getStartSample Link icon

      public long getStartSample()
    • sayRegion Link icon

      public void sayRegion()
    • calculateRMSAmplitude Link icon

      public double calculateRMSAmplitude()
    • getFreqRange Link icon

      public int[] getFreqRange()
    • getMaxPeaks Link icon

      public int getMaxPeaks()
    • getPeakFreqsBins Link icon

      public int[] getPeakFreqsBins()
    • getTimesBins Link icon

      public int[] getTimesBins()
    • getFirstSliceData Link icon

      public SliceData getFirstSliceData()
    • getLastSliceData Link icon

      public SliceData getLastSliceData()
    • setNJoinedStart Link icon

      public void setNJoinedStart(int nJoinedStart)
      Parameters:
      nJoinedStart - the nJoinedStart to set
    • getNJoinedStart Link icon

      public int getNJoinedStart()
      Returns:
      the nJoinedStart
    • setNJoinedEnd Link icon

      public void setNJoinedEnd(int nJoinedEnd)
      Parameters:
      nJoinedEnd - the nJoinedEnd to set
    • getNJoinedEnd Link icon

      public int getNJoinedEnd()
      Returns:
      the nJoinedEnd
    • getStartGradient Link icon

      public double getStartGradient(int nBins)
      Gradient at the start of the shape for the first peak in pixels per pixel.
      Used for rapid region matching in RejoiningFragmenter
      Parameters:
      nBins - number of bins to measure over.
      Returns:
      gradient.
    • getEndGradient Link icon

      public double getEndGradient(int nBins)
      Gradient at the end of the shape for the first peak in pixels per pixel.
      Used for rapid region matching in RejoiningFragmenter
      Parameters:
      nBins - number of bins to measure over.
      Returns:
      gradient.
    • isCross Link icon

      public boolean isCross(int maxCrossLength)
      Returns:
      true if two or more whistles cross in this region
    • isMerge Link icon

      public boolean isMerge(int maxCrossLength)
      Returns:
      true if two or more whistles merged into this Region
    • isSplit Link icon

      public boolean isSplit(int maxCrossLength)
      Returns:
      true if this region splits into two or more parts
    • isRightMess Link icon

      public boolean isRightMess()
      Returns:
      true if > 2 sounds joined this region at the start and > 2 left at the end, but they were not the same number of sounds.