29 #ifndef CDPL_SHAPE_GAUSSIANSHAPEFUNCTIONALIGNMENT_HPP
30 #define CDPL_SHAPE_GAUSSIANSHAPEFUNCTIONALIGNMENT_HPP
69 typedef std::vector<Result> ResultList;
73 static constexpr
double DEF_OPTIMIZATION_STOP_GRADIENT = 1.0;
76 static constexpr std::size_t DEF_MAX_OPTIMIZATION_ITERATIONS = 20;
104 transform(xform), overlap(overlap), colOverlap(col_overlap) {}
137 transform(), overlap(0.0), colOverlap(0.0) {}
409 unsigned int refShapeSymClass;
411 bool calcColOverlaps;
414 std::size_t maxNumOptIters;
Implementation of the BFGS optimization algorithm.
Definition of class CDPL::Shape::FastGaussianShapeOverlapFunction.
Definition of matrix data types.
Definition of class CDPL::Shape::PrincipalAxesAlignmentStartGenerator.
Definition of the preprocessor macro CDPL_SHAPE_API.
#define CDPL_SHAPE_API
Tells the compiler/linker which classes, functions and variables are part of the library API.
Definition of class CDPL::Math::VectorArray.
Fixed-size vector of dimension N backed by a C-array (no dynamic allocation).
Definition: Vector.hpp:1876
Shape::GaussianShapeOverlapFunction implementation that uses two approximation techniques to trade so...
Definition: FastGaussianShapeOverlapFunction.hpp:58
Abstract base class for generators of starting transformations used to seed Gaussian-shape overlap op...
Definition: GaussianShapeAlignmentStartGenerator.hpp:57
A single alignment result: rigid-body transformation plus shape and color overlap values.
Definition: GaussianShapeFunctionAlignment.hpp:94
double getOverlap() const
Returns the shape overlap value of the alignment.
Definition: GaussianShapeFunctionAlignment.hpp:119
const Math::Matrix4D & getTransform() const
Returns the rigid-body transformation that maps the aligned shape onto the reference shape.
Definition: GaussianShapeFunctionAlignment.hpp:110
Result(const Math::Matrix4D &xform, double overlap, double col_overlap)
Constructs a Result with the given values.
Definition: GaussianShapeFunctionAlignment.hpp:103
double getColorOverlap() const
Returns the color overlap value of the alignment.
Definition: GaussianShapeFunctionAlignment.hpp:128
Driver for the alignment of one Shape::GaussianShapeFunction (the aligned shape) against a fixed refe...
Definition: GaussianShapeFunctionAlignment.hpp:63
std::size_t getNumResults() const
Returns the number of alignment results produced by the last align() call.
void setOptimizationStopGradient(double grad_norm)
Sets the gradient norm at which the overlap optimization is stopped.
ConstResultIterator begin() const
Returns a constant iterator pointing to the first alignment result (range-based for support).
ConstResultIterator end() const
Returns a constant iterator pointing one past the last alignment result (range-based for support).
void setColorFilterFunction(const ColorFilterFunction &func)
Specifies the function used to filter color features by type.
FastGaussianShapeOverlapFunction & getDefaultOverlapFunction()
Returns the built-in default overlap function (Shape::FastGaussianShapeOverlapFunction).
void calcColorOverlaps(bool calc)
Specifies whether color overlaps shall be evaluated in addition to shape overlaps.
GaussianShapeFunctionAlignment & operator=(const GaussianShapeFunctionAlignment &alignment)=delete
const Result & getResult(std::size_t idx) const
Returns the alignment result at index idx.
void performAlignment(bool perf_align)
Specifies whether the actual alignment shall be performed (vs. only evaluating overlaps in the initia...
void optimizeOverlap(bool optimize)
Specifies whether the overlap shall be optimized iteratively after the initial alignment.
GaussianShapeFunctionAlignment(const GaussianShapeFunctionAlignment &alignment)=delete
GaussianShapeFunctionAlignment(const GaussianShapeFunction &ref_func, unsigned int sym_class)
Constructs the GaussianShapeFunctionAlignment instance with the given reference shape function.
double calcColorSelfOverlap(const GaussianShapeFunction &func)
Calculates the color self-overlap of func using the configured overlap function.
const GaussianShapeFunction * getReference() const
Returns the current reference shape function (or nullptr if none is set).
unsigned int setupReference(GaussianShapeFunction &func, Math::Matrix4D &xform) const
Delegates the reference-shape preparation to the configured start generator.
bool greedyOptimization() const
Tells whether the overlap optimization uses a greedy strategy.
const ColorFilterFunction & getColorFilterFunction() const
Returns the currently configured color-filter function.
ResultList::const_iterator ConstResultIterator
A constant iterator over the alignment results.
Definition: GaussianShapeFunctionAlignment.hpp:82
bool align(const GaussianShapeFunction &func, unsigned int sym_class)
Aligns the shape function func against the configured reference shape.
void setColorMatchFunction(const ColorMatchFunction &func)
Specifies the function used to decide whether two color features match.
bool optimizeOverlap() const
Tells whether the overlap is optimized iteratively.
double getOptimizationStopGradient() const
Returns the currently configured overlap-optimization stop gradient.
const ColorMatchFunction & getColorMatchFunction() const
Returns the currently configured color-match function.
const PrincipalAxesAlignmentStartGenerator & getDefaultStartGenerator() const
Returns the built-in default principal-axes alignment-start generator.
double calcSelfOverlap(const GaussianShapeFunction &func)
Calculates the shape-only self-overlap of func using the configured overlap function.
void setReference(const GaussianShapeFunction &func, unsigned int sym_class)
Sets the reference shape function used by subsequent align() calls.
GaussianShapeOverlapFunction::ColorMatchFunction ColorMatchFunction
Type of the function used to decide whether two color features match.
Definition: GaussianShapeFunctionAlignment.hpp:88
const FastGaussianShapeOverlapFunction & getDefaultOverlapFunction() const
Returns the built-in default overlap function (Shape::FastGaussianShapeOverlapFunction).
PrincipalAxesAlignmentStartGenerator & getDefaultStartGenerator()
Returns the built-in default principal-axes alignment-start generator.
GaussianShapeAlignmentStartGenerator & getStartGenerator() const
Returns the currently configured alignment-start generator.
GaussianShapeOverlapFunction & getOverlapFunction() const
Returns the currently configured overlap function.
void greedyOptimization(bool greedy)
Specifies whether the overlap optimization shall use a greedy strategy that stops at the first local ...
void setOverlapFunction(GaussianShapeOverlapFunction &func)
Specifies the Gaussian-shape overlap function used during alignment.
~GaussianShapeFunctionAlignment()
Destructor.
ConstResultIterator getResultsBegin() const
Returns a constant iterator pointing to the first alignment result.
GaussianShapeFunctionAlignment()
Constructs the GaussianShapeFunctionAlignment instance without a reference shape.
bool calcColorOverlaps() const
Tells whether color overlaps are evaluated.
void setMaxNumOptimizationIterations(std::size_t max_iter)
Sets the maximum number of overlap-optimization iterations.
bool performAlignment() const
Tells whether the actual alignment is performed.
void setStartGenerator(GaussianShapeAlignmentStartGenerator &gen)
Specifies the alignment-start generator used to seed the overlap optimization.
ConstResultIterator getResultsEnd() const
Returns a constant iterator pointing one past the last alignment result.
std::size_t getMaxNumOptimizationIterations() const
Returns the currently configured maximum number of overlap-optimization iterations.
GaussianShapeOverlapFunction::ColorFilterFunction ColorFilterFunction
Type of the function used to filter color (pharmacophore) features by type.
Definition: GaussianShapeFunctionAlignment.hpp:85
unsigned int setupAligned(GaussianShapeFunction &func, Math::Matrix4D &xform) const
Delegates the aligned-shape preparation to the configured start generator.
std::shared_ptr< GaussianShapeFunctionAlignment > SharedPointer
A reference-counted smart pointer [SHPTR] for dynamically allocated GaussianShapeFunctionAlignment in...
Definition: GaussianShapeFunctionAlignment.hpp:79
Function representation of a Gaussian shape, used to evaluate the shape's density,...
Definition: GaussianShapeFunction.hpp:61
Abstract base class for functions evaluating the overlap between two Gaussian shape functions.
Definition: GaussianShapeOverlapFunction.hpp:56
std::function< bool(std::size_t)> ColorFilterFunction
Type of the function used to filter color (pharmacophore) features by type.
Definition: GaussianShapeOverlapFunction.hpp:63
std::function< bool(std::size_t, std::size_t)> ColorMatchFunction
Type of the function used to decide whether two color features match.
Definition: GaussianShapeOverlapFunction.hpp:66
Generator that produces alignment starting transformations by aligning the principal axes of the alig...
Definition: PrincipalAxesAlignmentStartGenerator.hpp:58
VectorArray< Vector3D > Vector3DArray
Array storing vectors of type Math::Vector3D.
Definition: VectorArray.hpp:85
CDPL_SHAPE_API void transform(GaussianShape &shape, const Math::Matrix4D &xform)
Applies an affine transformation to the element positions of shape.
The namespace of the Chemical Data Processing Library.