net.grelf.grip
Class BlobMeasList

java.lang.Object
  extended by java.util.AbstractCollection<E>
      extended by java.util.AbstractList<E>
          extended by java.util.AbstractSequentialList<E>
              extended by java.util.LinkedList<BlobMeas>
                  extended by net.grelf.grip.BlobMeasList
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.lang.Iterable<BlobMeas>, java.util.Collection<BlobMeas>, java.util.Deque<BlobMeas>, java.util.List<BlobMeas>, java.util.Queue<BlobMeas>

public class BlobMeasList
extends java.util.LinkedList<BlobMeas>
implements java.io.Serializable

Holds a list of BlobMeas objects sorted in descending order of brightness. The method insert () has been added to ensure that objects are inserted into the list in that required order, so it does not have to be sorted as a separate step.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class java.util.AbstractList
modCount
 
Constructor Summary
BlobMeasList(ImFrame imframe)
          The imframe is needed so that when blob data are deserialised from file the image from which they were obtained can also be opened.
 
Method Summary
 BlobMeasList crop(java.awt.Point pt1, java.awt.Point pt2)
          Modify the list for its image being cropped to a rectangle formed by the 2 points as diagonal.
 void drawBoundaries(ImFrame imframe)
          Draw boundaries of all blobs in the list into the GlassPane of the given ImFrame and redisplay the image.
 ImFrame getImFrame()
           
 BlobMeas getNearestBlob(Blob blob)
          Find the nearest neighbour to the given blob.
 BlobMeas getNearestBlob(int xx, int yy)
          Find the blob with centre nearest to given point (xx, yy).
 boolean insert(BlobMeas meas)
          Insert the BlobMeas object at the right place so the list is always in descending order of brightness.
static BlobMeasList loadFromXML(java.lang.String filePath)
           
 void saveAsXML(java.lang.String filePath)
           
 void showBrightestBlobs(ImFrame imframe)
          Draw brightest blobs into the GlassPane of the given ImFrame and redisplay the image.
 java.lang.StringBuffer toXML()
           
 
Methods inherited from class java.util.LinkedList
add, add, addAll, addAll, addFirst, addLast, clear, clone, contains, descendingIterator, element, get, getFirst, getLast, indexOf, lastIndexOf, listIterator, offer, offerFirst, offerLast, peek, peekFirst, peekLast, poll, pollFirst, pollLast, pop, push, remove, remove, remove, removeFirst, removeFirstOccurrence, removeLast, removeLastOccurrence, set, size, toArray, toArray
 
Methods inherited from class java.util.AbstractSequentialList
iterator
 
Methods inherited from class java.util.AbstractList
equals, hashCode, listIterator, removeRange, subList
 
Methods inherited from class java.util.AbstractCollection
containsAll, isEmpty, removeAll, retainAll, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.List
containsAll, equals, hashCode, isEmpty, iterator, listIterator, removeAll, retainAll, subList
 
Methods inherited from interface java.util.Deque
iterator
 

Constructor Detail

BlobMeasList

public BlobMeasList(ImFrame imframe)
The imframe is needed so that when blob data are deserialised from file the image from which they were obtained can also be opened.

Method Detail

getImFrame

public ImFrame getImFrame()

crop

public BlobMeasList crop(java.awt.Point pt1,
                         java.awt.Point pt2)
Modify the list for its image being cropped to a rectangle formed by the 2 points as diagonal. Blobs lying on or outside the cropping rectangle are removed from the list. Measurements of blobs and the blobs themselves are offset to the new origin (which is not necessarily either pt1 or pt2 of course).


drawBoundaries

public void drawBoundaries(ImFrame imframe)
Draw boundaries of all blobs in the list into the GlassPane of the given ImFrame and redisplay the image.


getNearestBlob

public BlobMeas getNearestBlob(int xx,
                               int yy)
Find the blob with centre nearest to given point (xx, yy).


getNearestBlob

public BlobMeas getNearestBlob(Blob blob)
Find the nearest neighbour to the given blob.


insert

public boolean insert(BlobMeas meas)
Insert the BlobMeas object at the right place so the list is always in descending order of brightness. NB: I first tried @Override public boolean add (BlobMeas meas) but that caused stack overflow at run time - evidently the compiler did not interpret the generics correctly.


showBrightestBlobs

public void showBrightestBlobs(ImFrame imframe)
Draw brightest blobs into the GlassPane of the given ImFrame and redisplay the image. The number of brightest blobs to show is determined by Config. Blobs are labelled with numbers, from 1 for the brightest.


saveAsXML

public void saveAsXML(java.lang.String filePath)

toXML

public java.lang.StringBuffer toXML()

loadFromXML

public static BlobMeasList loadFromXML(java.lang.String filePath)