cbr.service
Class ExtractingIterator

java.lang.Object
  extended bycbr.service.ExtractingIterator
All Implemented Interfaces:
Iterator

public class ExtractingIterator
extends Object
implements Iterator

This iterator wraps around an iterator that returns raw images, and extracts features from the images by means of an FeatureExtractor. This iterator returns picture entries.

Version:
"$Id: ExtractingIterator.java 1913 2007-08-08 02:41:53Z jpeters $"
Author:
Volker Roth

Field Summary
private  int count_
          The number of pictures returned so far.
private  boolean embed_
          This flag determines whether or not thumbnails are embedded into the picture entries returned by this iterator.
private  FeatureExtractor extractor_
          The FeatureExtractor that is used in order to extract image features.
private  Iterator i_
          The iterator retrieved from the PicsSource.
private  Image im_
          The next picture.
private  String name_
          The next picture's name.
private  PicsSource pics_
          The source of the pictures.
private  String url_
          The URL string that is put into iterated picture entries.
 
Constructor Summary
ExtractingIterator(PicsSource pics, FeatureExtractor extractor)
          Creates an iterator that wraps around the given iterator and retrieves image features using the given FeatureExtractor.
 
Method Summary
 int getCount()
          Returns the number of picture entries returned so far.
 boolean hasNext()
          Returns true if there are more picture entries.
 Object next()
          Returns the next PictureEntry.
 void remove()
          Not supported.
 void setEmbedding(boolean embed)
          Sets whether thumbnails are embedded into iterated picture entries or not.
 void setURL(String url)
          Sets the URL string that is put into the iterated picture entries.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

extractor_

private FeatureExtractor extractor_
The FeatureExtractor that is used in order to extract image features.


pics_

private PicsSource pics_
The source of the pictures.


i_

private Iterator i_
The iterator retrieved from the PicsSource.


url_

private String url_
The URL string that is put into iterated picture entries.


embed_

private boolean embed_
This flag determines whether or not thumbnails are embedded into the picture entries returned by this iterator. The default is true.


count_

private int count_
The number of pictures returned so far.


im_

private Image im_
The next picture.


name_

private String name_
The next picture's name.

Constructor Detail

ExtractingIterator

public ExtractingIterator(PicsSource pics,
                          FeatureExtractor extractor)
Creates an iterator that wraps around the given iterator and retrieves image features using the given FeatureExtractor. The given iterator must return raw images (byte arrays). If no raw image is returned then a ClassCastException is thrown. By default, thumbnails are embedded into the picture entries returned by this instance.

Parameters:
pics - The PicsSource whose pictures are iterated.
extractor - The feature extractor that is used for retrieving significant image features.
Method Detail

setURL

public void setURL(String url)
Sets the URL string that is put into the iterated picture entries.

Parameters:
url - The URL string.

setEmbedding

public void setEmbedding(boolean embed)
Sets whether thumbnails are embedded into iterated picture entries or not. The default setting is true.

Parameters:
embed - if true then thumbnails are embedded.

getCount

public int getCount()
Returns the number of picture entries returned so far.

Returns:
The number of pictures returned so far.

hasNext

public boolean hasNext()
Returns true if there are more picture entries.

Specified by:
hasNext in interface Iterator
Returns:
true if the re are more entries.
Throws:
IllegalStateException - if the image fetching was interrupted.

next

public Object next()
            throws NoSuchElementException
Returns the next PictureEntry. If something goes wrong during extraction or this method cannot complete due to some other error condition then an IllegalStateException is thrown.

Specified by:
next in interface Iterator
Returns:
The next PictureEntry.
Throws:
IllegalStateException - if this method cannot complete successfully.
NoSuchElementException - if there are no more elements.

remove

public void remove()
Not supported.

Specified by:
remove in interface Iterator
Throws:
UnsupportedOperationException - Always.


Copyright © Fraunhofer Gesellschaft. All Rights Reserved.