Chemical Data Processing Library C++ API - Version 1.4.0
Public Types | Public Member Functions | List of all members
CDPL::Pharm::SpatialFeatureMapping Class Reference

Pharm::FeatureMapping specialization that perceives a reference-to-aligned feature mapping based on type, position and geometry compatibility under a given transformation, caching per-pair position and geometry match scores for later retrieval. More...

#include <SpatialFeatureMapping.hpp>

+ Inheritance diagram for CDPL::Pharm::SpatialFeatureMapping:

Public Types

typedef std::function< bool(const Feature &, const Feature &)> TypeMatchFunction
 Generic wrapper class used to store a user-defined feature type match function. More...
 
typedef std::function< double(const Feature &, const Feature &, const Math::Matrix4D &)> PositionMatchFunction
 Generic wrapper class used to store a user-defined feature position match function. More...
 
typedef std::function< double(const Feature &, const Feature &, const Math::Matrix4D &)> GeometryMatchFunction
 Generic wrapper class used to store a user-defined feature geometry match function. More...
 
- Public Types inherited from CDPL::Pharm::FeatureMapping
typedef std::shared_ptr< FeatureMappingSharedPointer
 A reference-counted smart pointer [SHPTR] for dynamically allocated FeatureMapping instances. More...
 
- Public Types inherited from CDPL::Util::MultiMap< const Feature *, const Feature *, true >
typedef std::shared_ptr< MultiMapSharedPointer
 A reference-counted smart pointer [SHPTR] for dynamically allocated MultiMap instances. More...
 
typedef const Feature * KeyType
 The type of the map's keys. More...
 
typedef const Feature * ValueType
 The type of the mapped values. More...
 
typedef StorageType::value_type Entry
 The type of the key/value pairs stored in the map. More...
 
typedef StorageType::const_iterator ConstEntryIterator
 A constant iterator used to iterate over the entries of the map. More...
 
typedef StorageType::const_reverse_iterator ConstReverseEntryIterator
 A constant iterator used to iterate backwards over the entries of the map. More...
 
typedef StorageType::iterator EntryIterator
 A mutable iterator used to iterate over the entries of the map. More...
 
typedef StorageType::reverse_iterator ReverseEntryIterator
 A mutable iterator used to iterate backwards over the entries of the map. More...
 
typedef std::pair< EntryIterator, EntryIteratorEntryIteratorRange
 A pair of mutable iterators used to specify the start and end of a range of entries. More...
 
typedef std::pair< ConstEntryIterator, ConstEntryIteratorConstEntryIteratorRange
 A pair of constant iterators used to specify the start and end of a range of entries. More...
 

Public Member Functions

 SpatialFeatureMapping (bool query_mode=false)
 Constructs a SpatialFeatureMapping instance. More...
 
void setTypeMatchFunction (const TypeMatchFunction &func)
 Specifies a function for testing the type compatibility of features. More...
 
const TypeMatchFunctiongetTypeMatchFunction () const
 Returns the function that was registered for testing the type compatibility of the features. More...
 
void setPositionMatchFunction (const PositionMatchFunction &func)
 Specifies a function for checking the proximity of mapped feature positions. More...
 
const PositionMatchFunctiongetPositionMatchFunction () const
 Returns the function that was registered for checking the proximity of mapped feature positions. More...
 
void setGeometryMatchFunction (const GeometryMatchFunction &func)
 Specifies a function for checking the match of mapped feature geometries. More...
 
const GeometryMatchFunctiongetGeometryMatchFunction () const
 Returns the function that was registered for checking the match of mapped feature geometries. More...
 
double getPositionMatchScore (const Feature &ref_ftr, const Feature &aligned_ftr) const
 Returns the position-match score cached for the (ref_ftr, aligned_ftr) pair by the last perceive() call. More...
 
double getGeometryMatchScore (const Feature &ref_ftr, const Feature &aligned_ftr) const
 Returns the geometry-match score cached for the (ref_ftr, aligned_ftr) pair by the last perceive() call. More...
 
void perceive (const FeatureContainer &ref_ftrs, const FeatureContainer &aligned_ftrs, const Math::Matrix4D &xform)
 Computes the spatial feature mapping between the reference and aligned feature containers after applying xform to the aligned features, populating this mapping and the per-pair score caches. More...
 
- Public Member Functions inherited from CDPL::Util::MultiMap< const Feature *, const Feature *, true >
 MultiMap ()
 Creates an empty map. More...
 
 MultiMap (const std::less< const Feature * > &func)
 Creates an empty map and uses func as key compare function. More...
 
 MultiMap (const InputIter &first, const InputIter &last)
 Creates and initializes the map with copies of the key value pairs in the range [first, last). More...
 
 MultiMap (const InputIter &first, const InputIter &last, const std::less< const Feature * > &func)
 Creates and initializes the map with copies of the key value pairs in the range [first, last) and uses func as key compare function. More...
 
virtual ~MultiMap ()
 Virtual destructor. More...
 
StorageType & getData ()
 Returns a non-const reference to the underlying map storage. More...
 
const StorageType & getData () const
 Returns a const reference to the underlying map storage. More...
 
std::size_t getSize () const
 Returns the size (number of entries) of the map. More...
 
bool isEmpty () const
 Tells whether the map is empty (getSize() == 0). More...
 
void clear ()
 Erases all entries. More...
 
void swap (MultiMap &map)
 Swaps the contents with map. More...
 
std::less< const Feature * > getKeyCompareFunction () const
 Returns the key compare function used by the map. More...
 
std::size_t getNumEntries (const const Feature * &key) const
 Returns the number of entries with the specified key. More...
 
EntryIteratorRange getEntries (const const Feature * &key)
 Returns the bounds of a range that includes all entries with a key that compares equal to the specified key. More...
 
ConstEntryIteratorRange getEntries (const const Feature * &key) const
 Returns the bounds of a range that includes all entries with a key that compares equal to the specified key. More...
 
EntryIterator getEntry (const const Feature * &key)
 Returns a mutable iterator pointing to the first entry with the specified key. More...
 
ConstEntryIterator getEntry (const const Feature * &key) const
 Returns a constant iterator pointing to the first entry with the specified key. More...
 
const Feature * & getValue (const const Feature * &key)
 Returns a non-const reference to the first value associated with the specified key. More...
 
const Feature * & getValue (const const Feature * &key, const Feature * &def_value)
 Returns a non-const reference to the first value associated with the specified key, or the value given by the second argument if an entry with the given key does not exist. More...
 
const const Feature * & getValue (const const Feature * &key) const
 Returns a const reference to the first value associated with the specified key. More...
 
const const Feature * & getValue (const const Feature * &key, const const Feature * &def_value) const
 Returns a const reference to the first value associated with the specified key, or the value given by the second argument if an entry with the given key does not exist. More...
 
const Feature * & operator[] (const const Feature * &key)
 Returns a non-const reference to the first value associated with the specified key. More...
 
const const Feature * & operator[] (const const Feature * &key) const
 Returns a const reference to the first value associated with the specified key. More...
 
void removeEntry (const EntryIterator &it)
 Removes the entry pointed to by the iterator it from the map. More...
 
bool removeEntry (const const Feature * &key)
 Removes the first entry with the specified key from the map. More...
 
void removeEntries (const EntryIterator &first, const EntryIterator &last)
 Removes all entries pointed to by the iterators in the range [first, last) from the map. More...
 
std::size_t removeEntries (const const Feature * &key)
 Removes all entries with the specified key from the map. More...
 
EntryIterator insertEntry (const Entry &item)
 Inserts the key/value pair item into the map. More...
 
EntryIterator insertEntry (const const Feature * &key, const const Feature * &value)
 Inserts a new entry with specified key and value into the map. More...
 
EntryIterator insertEntry (const EntryIterator &it, const Entry &item)
 Inserts the key/value pair item into the map and uses the iterator it as a hint for the insertion location. More...
 
EntryIterator insertEntry (const EntryIterator &it, const const Feature * &key, const const Feature * &value)
 Inserts a new entry with the specified key and value into the map and uses the iterator it as a hint for the insertion location. More...
 
EntryIterator setEntry (const Entry &item)
 Replaces all entries with a key equivalent to that of item with a single entry specified by item. More...
 
EntryIterator setEntry (const const Feature * &key, const const Feature * &value)
 Replaces all entries with a key equivalent to key with a single copy of the key/value pair (key, value). More...
 
void insertEntries (const InputIter &first, const InputIter &last)
 Inserts the key/value pairs in the range [first, last) into the map. More...
 
void setEntries (const InputIter &first, const InputIter &last)
 Inserts new entries or updates the value of existing entries using the key/value pairs in the range [first, last). More...
 
EntryIterator getLowerBound (const const Feature * &key)
 Returns a mutable iterator pointing to the first entry whose key is not less than key. More...
 
ConstEntryIterator getLowerBound (const const Feature * &key) const
 Returns a constant iterator pointing to the first entry whose key is not less than key. More...
 
EntryIterator getUpperBound (const const Feature * &key)
 Returns a mutable iterator pointing to the first entry whose key is greater than key. More...
 
ConstEntryIterator getUpperBound (const const Feature * &key) const
 Returns a constant iterator pointing to the first entry whose key is greater than key. More...
 
ConstEntryIterator getEntriesBegin () const
 Returns a constant iterator pointing to the beginning of the map. More...
 
EntryIterator getEntriesBegin ()
 Returns a mutable iterator pointing to the beginning of the map. More...
 
ConstEntryIterator getEntriesEnd () const
 Returns a constant iterator pointing to the end of the map. More...
 
EntryIterator getEntriesEnd ()
 Returns a mutable iterator pointing to the end of the map. More...
 
ConstEntryIterator begin () const
 Returns a constant iterator pointing to the beginning of the map. More...
 
EntryIterator begin ()
 Returns a mutable iterator pointing to the beginning of the map. More...
 
ConstEntryIterator end () const
 Returns a constant iterator pointing to the end of the map. More...
 
EntryIterator end ()
 Returns a mutable iterator pointing to the end of the map. More...
 
ConstReverseEntryIterator getEntriesReverseBegin () const
 Returns a constant iterator pointing to the beginning of the reversed map. More...
 
ReverseEntryIterator getEntriesReverseBegin ()
 Returns a mutable iterator pointing to the beginning of the reversed map. More...
 
ConstReverseEntryIterator getEntriesReverseEnd () const
 Returns a constant iterator pointing to the end of the reversed map. More...
 
ReverseEntryIterator getEntriesReverseEnd ()
 Returns a mutable iterator pointing to the end of the reversed map. More...
 

Additional Inherited Members

Detailed Description

Pharm::FeatureMapping specialization that perceives a reference-to-aligned feature mapping based on type, position and geometry compatibility under a given transformation, caching per-pair position and geometry match scores for later retrieval.

Member Typedef Documentation

◆ TypeMatchFunction

Generic wrapper class used to store a user-defined feature type match function.

◆ PositionMatchFunction

typedef std::function<double(const Feature&, const Feature&, const Math::Matrix4D&)> CDPL::Pharm::SpatialFeatureMapping::PositionMatchFunction

Generic wrapper class used to store a user-defined feature position match function.

◆ GeometryMatchFunction

typedef std::function<double(const Feature&, const Feature&, const Math::Matrix4D&)> CDPL::Pharm::SpatialFeatureMapping::GeometryMatchFunction

Generic wrapper class used to store a user-defined feature geometry match function.

Constructor & Destructor Documentation

◆ SpatialFeatureMapping()

CDPL::Pharm::SpatialFeatureMapping::SpatialFeatureMapping ( bool  query_mode = false)

Constructs a SpatialFeatureMapping instance.

Parameters
query_modeIf true, the reference feature container is interpreted as a query feature container and some of the set default functions will operate in a special query mode.

Member Function Documentation

◆ setTypeMatchFunction()

void CDPL::Pharm::SpatialFeatureMapping::setTypeMatchFunction ( const TypeMatchFunction func)

Specifies a function for testing the type compatibility of features.

Parameters
funcThe type compatibility test function.

◆ getTypeMatchFunction()

const TypeMatchFunction& CDPL::Pharm::SpatialFeatureMapping::getTypeMatchFunction ( ) const

Returns the function that was registered for testing the type compatibility of the features.

Returns
The registered type compatibility test function.

◆ setPositionMatchFunction()

void CDPL::Pharm::SpatialFeatureMapping::setPositionMatchFunction ( const PositionMatchFunction func)

Specifies a function for checking the proximity of mapped feature positions.

Parameters
funcThe position proximity test function.

◆ getPositionMatchFunction()

const PositionMatchFunction& CDPL::Pharm::SpatialFeatureMapping::getPositionMatchFunction ( ) const

Returns the function that was registered for checking the proximity of mapped feature positions.

Returns
The registered position proximity test function.

◆ setGeometryMatchFunction()

void CDPL::Pharm::SpatialFeatureMapping::setGeometryMatchFunction ( const GeometryMatchFunction func)

Specifies a function for checking the match of mapped feature geometries.

Parameters
funcThe feature geometry match test function.

◆ getGeometryMatchFunction()

const GeometryMatchFunction& CDPL::Pharm::SpatialFeatureMapping::getGeometryMatchFunction ( ) const

Returns the function that was registered for checking the match of mapped feature geometries.

Returns
The registered geometry match test function.

◆ getPositionMatchScore()

double CDPL::Pharm::SpatialFeatureMapping::getPositionMatchScore ( const Feature ref_ftr,
const Feature aligned_ftr 
) const

Returns the position-match score cached for the (ref_ftr, aligned_ftr) pair by the last perceive() call.

Parameters
ref_ftrThe reference feature.
aligned_ftrThe aligned feature.
Returns
The cached position-match score (or zero if no entry exists for the pair).

◆ getGeometryMatchScore()

double CDPL::Pharm::SpatialFeatureMapping::getGeometryMatchScore ( const Feature ref_ftr,
const Feature aligned_ftr 
) const

Returns the geometry-match score cached for the (ref_ftr, aligned_ftr) pair by the last perceive() call.

Parameters
ref_ftrThe reference feature.
aligned_ftrThe aligned feature.
Returns
The cached geometry-match score (or zero if no entry exists for the pair).

◆ perceive()

void CDPL::Pharm::SpatialFeatureMapping::perceive ( const FeatureContainer ref_ftrs,
const FeatureContainer aligned_ftrs,
const Math::Matrix4D xform 
)

Computes the spatial feature mapping between the reference and aligned feature containers after applying xform to the aligned features, populating this mapping and the per-pair score caches.

Parameters
ref_ftrsThe reference feature container.
aligned_ftrsThe aligned feature container.
xformThe transformation applied to the aligned features before the mapping is perceived.

The documentation for this class was generated from the following file: