#include <global-vg-pyramid-maker.h>
Inheritance diagram for GlobalVGPyramidMaker:
Public Member Functions | |
GlobalVGPyramidMaker (const HierarchicalClusterer &clusterer, const DistanceComputer &distance_computer) | |
~GlobalVGPyramidMaker () | |
void | Preprocess (const PointSetList &point_sets) |
Initialize the global bin sizes. | |
virtual MultiResolutionHistogram * | MakePyramid (const PointSet &point_set) |
Turn a single PointSet into a MultiResolutionHistogram. | |
void | ReadFromStream (istream &input_stream) |
Initialize the global bin sizes. | |
void | ReadFromFile (const char *filename) |
Initialize the global bin sizes. | |
void | WriteToStream (ostream &output_stream) const |
Write the global bin sizes to a stream. | |
void | WriteToFile (const char *filename) const |
Write the global bin sizes to a file. | |
vector< MultiResolutionHistogram * > | MakePyramids (const PointSetList &psl) |
Turn a list of PointSets into a bunch of MultiResolutionHistograms. | |
Protected Member Functions | |
virtual bool | GetMembershipPath (const Point &f, LargeIndex *out_path, vector< double > *out_distances) |
Get the membership data relative to the global pyramid data. | |
Protected Attributes | |
const HierarchicalClusterer & | clusterer_ |
const Tree< PointTreeNode > & | centers_ |
The centers extracted from clusterer_. | |
const DistanceComputer & | distance_computer_ |
GlobalVGPyramidMaker | ( | const HierarchicalClusterer & | clusterer, | |
const DistanceComputer & | distance_computer | |||
) |
~GlobalVGPyramidMaker | ( | ) |
void Preprocess | ( | const PointSetList & | point_sets | ) |
Initialize the global bin sizes.
This takes O(n^2) time, where n is the total number of points in <point_sets>. This is because at the top level bin, it computes the furthest pair between any of the two points to set the bin size.
Rather than doing this every single time, you may also call ReadFromStream() which will read already-preprocessed data.
MultiResolutionHistogram * MakePyramid | ( | const PointSet & | point_set | ) | [virtual] |
Turn a single PointSet into a MultiResolutionHistogram.
This function allocates memory on its own. It is up to the caller to free it.
Implements VGPyramidMaker.
void ReadFromStream | ( | istream & | input_stream | ) |
Initialize the global bin sizes.
Can be called in lieu of Preprocess(). Aborts if the stream is bad.
void ReadFromFile | ( | const char * | filename | ) |
void WriteToStream | ( | ostream & | output_stream | ) | const |
Write the global bin sizes to a stream.
This output file format is not compatible with that of libpmk-1.x.
Stream format:
Requires Preprocess() or ReadFromStream() to be called first. Aborts if the stream is bad.
void WriteToFile | ( | const char * | filename | ) | const |
bool GetMembershipPath | ( | const Point & | f, | |
LargeIndex * | out_path, | |||
vector< double > * | out_distances | |||
) | [protected, virtual] |
Get the membership data relative to the global pyramid data.
This function is overridden so that only paths that were present in the point sets that this was constructed with can appear. Otherwise, this function does the same thing as its parent VGPyramidMaker::GetMembershipPath().
Reimplemented from VGPyramidMaker.
vector< MultiResolutionHistogram * > MakePyramids | ( | const PointSetList & | psl | ) | [inherited] |
Turn a list of PointSets into a bunch of MultiResolutionHistograms.
It is up to the caller to free the memory.
const HierarchicalClusterer& clusterer_ [protected, inherited] |
const Tree<PointTreeNode>& centers_ [protected, inherited] |
The centers extracted from clusterer_.
const DistanceComputer& distance_computer_ [protected, inherited] |