whistlesAndMoans
Class RejoiningFragmenter
java.lang.Object
whistlesAndMoans.DiscardingFragmenter
whistlesAndMoans.FragmentingFragmenter
whistlesAndMoans.RejoiningFragmenter
- All Implemented Interfaces:
- RegionFragmenter
public class RejoiningFragmenter
- extends FragmentingFragmenter
Join fragmented shapes back together again.
Probably not very efficient code since it goes through the
list in fragments and if it joins two fragments together,
it then removes one from the list, so the list gets progressively smaller.
- Author:
- Doug Gillespie
|
Field Summary |
(package private) static int |
gradLength
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
gradLength
static final int gradLength
- See Also:
- Constant Field Values
RejoiningFragmenter
public RejoiningFragmenter(WhistleMoanControl whistleMoanControl)
fragmentRegion
public int fragmentRegion(ConnectedRegion connectedRegion)
- Description copied from interface:
RegionFragmenter
- Fragment a connected region
- Specified by:
fragmentRegion in interface RegionFragmenter- Overrides:
fragmentRegion in class FragmentingFragmenter
- Parameters:
connectedRegion - region to fragment
- Returns:
- number of fragments.
checkDoubles
private void checkDoubles()
checkDuplicates
private void checkDuplicates()
crossCrosses
private void crossCrosses()
- Find regions which are clearly crosses, then find all the bits to the left and
the bits to the right, then join them together.
jumpCross
private boolean jumpCross(int crossIndex)
merge
private ConnectedRegion merge(int mergeIndex)
shortPenalty
private double shortPenalty(int fragLength)
- calculate a penalty to penalise very short fragments by when
deciding which are the best match during a merge of a split.
- Parameters:
fragLength - fragment length
- Returns:
- penalty (to add to gradient difference)
branch
private boolean branch(int branchIndex)
mergeWhistles
private void mergeWhistles(ConnectedRegion r1,
ConnectedRegion r2)
matchPeak
private boolean matchPeak(SliceData sliceData1,
SliceData sliceData2,
int connectType)
removeShortFragments
private int removeShortFragments()
- this will have called the super class fragmenter in a way which will have
selected even the shortest fragments. Now need to get rid of those !
- Returns:
- number of remaining fragments.
getFragment
public ConnectedRegion getFragment(int fragment)
- Description copied from interface:
RegionFragmenter
- Get a specific fragment
- Specified by:
getFragment in interface RegionFragmenter- Overrides:
getFragment in class FragmentingFragmenter
- Parameters:
fragment - fragment number (0 to getNumFragments);
- Returns:
- the ith fragment