IndexManager
Class WindsurfImgMtreeWrapper

java.lang.Object
  extended by IndexManager.WindsurfImgMtreeWrapper

public class WindsurfImgMtreeWrapper
extends java.lang.Object

Class implementing operations for invoking native functions for managing the image M-tree.


Constructor Summary
WindsurfImgMtreeWrapper()
           
 
Method Summary
static boolean close()
          Closes the image M-tree.
static boolean closeCursor()
          Deletes the previously created image cursor for sorted access.
static boolean create(java.lang.String featureFile)
          Creates a new M-tree index from a file containing image features.
static boolean createCursor(int id, int size, int regions, double[] sizes, double[] centroids, double[] covariance)
          Creates a cursor for performing sorted access on the index using a given image.
static boolean delete(int id, int size, int regions, double[] sizes, double[] centroids, double[] covariance)
          Deletes an image from the M-tree index.
static int getCount()
          Gets the distance counter for the image index.
static double[] getNext()
          Performs a sorted access on the existing image cursor.
static boolean init(java.lang.String indexFile)
          Initializes the image M-tree.
static boolean insert(int id, int size, int regions, double[] sizes, double[] centroids, double[] covariance)
          Inserts a new image in the M-tree index.
static double[] queryKnn(int k, int size, int regions, double[] sizes, double[] centroids, double[] covariance)
          Creates a new k-NN query based on the given image using this index.
static double[] queryRange(double r, int size, int regions, double[] sizes, double[] centroids, double[] covariance)
          Creates a new range query based on the given image using this index.
static boolean resetCount()
          Resets the distance counter for the image index.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WindsurfImgMtreeWrapper

public WindsurfImgMtreeWrapper()
Method Detail

init

public static boolean init(java.lang.String indexFile)
Initializes the image M-tree.

Parameters:
indexFile - Absolute path of the file containing the M-tree index.
Returns:
true if the index was successfully initialized, false otherwise.

create

public static boolean create(java.lang.String featureFile)
Creates a new M-tree index from a file containing image features.

Parameters:
featureFile - Absolute path of the features file.
Returns:
true if the index was successfully created, false otherwise.

close

public static boolean close()
Closes the image M-tree.

Returns:
true if the index was successfully closed, false otherwise.

insert

public static boolean insert(int id,
                             int size,
                             int regions,
                             double[] sizes,
                             double[] centroids,
                             double[] covariance)
Inserts a new image in the M-tree index.

Parameters:
id - Image ID.
size - Number of pixels in the image.
regions - Number of image regions.
sizes - Array of regions sizes.
centroids - Array of regions centroids.
covariance - Array of regions covariance matrices.
Returns:
true if the image was successfully inserted, false otherwise.

delete

public static boolean delete(int id,
                             int size,
                             int regions,
                             double[] sizes,
                             double[] centroids,
                             double[] covariance)
Deletes an image from the M-tree index.

Parameters:
id - Image ID.
size - Number of pixels in the image.
regions - Number of image regions.
sizes - Array of regions sizes.
centroids - Array of regions centroids.
covariance - Array of regions covariance matrices.
Returns:
true if the image was successfully deleted, false otherwise.

queryKnn

public static double[] queryKnn(int k,
                                int size,
                                int regions,
                                double[] sizes,
                                double[] centroids,
                                double[] covariance)
Creates a new k-NN query based on the given image using this index.

Parameters:
k - Number of requested results.
size - Number of pixels in the query image.
regions - Number of query image regions.
sizes - Array of query regions sizes.
centroids - Array of query regions centroids.
covariance - Array of query regions covariance matrices.
Returns:
Array of query results as (ID,distance) couples.

queryRange

public static double[] queryRange(double r,
                                  int size,
                                  int regions,
                                  double[] sizes,
                                  double[] centroids,
                                  double[] covariance)
Creates a new range query based on the given image using this index.

Parameters:
r - Radius of the query.
size - Number of pixels in the query image.
regions - Number of query image regions.
sizes - Array of query regions sizes.
centroids - Array of query regions centroids.
covariance - Array of query regions covariance matrices.
Returns:
Array of query results as (ID,distance) couples.

createCursor

public static boolean createCursor(int id,
                                   int size,
                                   int regions,
                                   double[] sizes,
                                   double[] centroids,
                                   double[] covariance)
Creates a cursor for performing sorted access on the index using a given image.

Parameters:
id - Image ID.
size - Number of pixels in the image.
regions - Number of image regions.
sizes - Array of regions sizes.
centroids - Array of regions centroids.
covariance - Array of regions covariance matrices.
Returns:
true if the cursors were successfully created, false otherwise.

closeCursor

public static boolean closeCursor()
Deletes the previously created image cursor for sorted access.

Returns:
true if the cursors were successfully deleted, false otherwise.

getNext

public static double[] getNext()
Performs a sorted access on the existing image cursor.

Returns:
Array containing a couple of (ID,distance) for the next image.

resetCount

public static boolean resetCount()
Resets the distance counter for the image index.

Returns:
true if the counter was successfully reset, false otherwise.

getCount

public static int getCount()
Gets the distance counter for the image index.

Returns:
Number of computed distances up to now.