29 #ifndef CDPL_SHAPE_GAUSSIANSHAPEALIGNMENT_HPP
30 #define CDPL_SHAPE_GAUSSIANSHAPEALIGNMENT_HPP
35 #include <unordered_map>
39 #include <boost/functional/hash.hpp>
40 #include <boost/iterator/transform_iterator.hpp>
61 typedef std::vector<AlignmentResult> ResultList;
62 typedef std::vector<GaussianShapeFunction*> ShapeFunctionList;
67 static constexpr
double DEF_OPTIMIZATION_STOP_GRADIENT = 1.0;
68 static constexpr std::size_t DEF_MAX_OPTIMIZATION_ITERATIONS = 20;
69 static constexpr std::size_t DEF_MAX_PRODUCT_ORDER = 1;
71 static constexpr
double DEF_DISTANCE_CUTOFF = 0.0;
77 typedef boost::transform_iterator<GetShapeFunction, ShapeFunctionList::const_iterator>
ConstShapeIterator;
210 std::size_t setIndex;
212 unsigned int symClass;
215 double colSelfOverlap;
216 GaussianShapePtr shape;
219 typedef std::pair<std::size_t, std::size_t> ResultID;
223 void processResults(std::size_t ref_idx, std::size_t al_idx);
225 bool getResultIndex(
const ResultID& res_id, std::size_t& res_idx);
230 typedef std::vector<ShapeMetaData> ShapeMetaDataArray;
231 typedef std::unordered_map<ResultID, std::size_t, boost::hash<ResultID> > ResultIndexMap;
233 ShapeFunctionCache shapeFuncCache;
234 bool calcSlfOverlaps;
235 bool calcColSlfOverlaps;
236 unsigned int resultSelMode;
237 ResultCompareFunction resultCmpFunc;
238 ScoringFunction scoringFunc;
240 ShapeFunctionList refShapeFuncs;
241 ShapeMetaDataArray refShapeMetaData;
243 ShapeMetaData algdShapeMetaData;
244 ResultIndexMap resIndexMap;
246 std::size_t currSetIndex;
247 std::size_t currShapeIndex;
Definition of constants in namespace CDPL::Shape::AlignmentResultSelectionMode.
Definition of the class CDPL::Shape::AlignmentResult.
Definition of the class CDPL::Shape::GaussianShapeFunctionAlignment.
Definition of the class CDPL::Shape::GaussianShapeFunction.
Definition of the class CDPL::Shape::GaussianShapeSet.
Definition of matrix data types.
Definition of the class CDPL::Util::ObjectStack.
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: AlignmentResult.hpp:45
Definition: FastGaussianShapeOverlapFunction.hpp:47
Definition: GaussianShapeAlignmentStartGenerator.hpp:49
Definition: GaussianShapeAlignment.hpp:59
PrincipalAxesAlignmentStartGenerator & getDefaultStartGenerator()
ResultList::const_iterator ConstResultIterator
Definition: GaussianShapeAlignment.hpp:75
ConstShapeIterator getReferenceShapesEnd() const
bool calcColorOverlaps() const
GaussianShapeFunctionAlignment::ColorFilterFunction ColorFilterFunction
Definition: GaussianShapeAlignment.hpp:79
std::size_t getMaxOrder() const
GaussianShapeFunctionAlignment::ColorMatchFunction ColorMatchFunction
Definition: GaussianShapeAlignment.hpp:80
GaussianShapeAlignment(const GaussianShapeSet &ref_shapes)
const PrincipalAxesAlignmentStartGenerator & getDefaultStartGenerator() const
void addReferenceShape(const GaussianShape &shape, bool new_set=true)
std::shared_ptr< GaussianShapeAlignment > SharedPointer
Definition: GaussianShapeAlignment.hpp:73
void clearReferenceShapes()
void setDistanceCutoff(double cutoff)
boost::transform_iterator< GetShapeFunction, ShapeFunctionList::const_iterator > ConstShapeIterator
Definition: GaussianShapeAlignment.hpp:77
void setScoringFunction(const ScoringFunction &func)
std::function< bool(const AlignmentResult &, const AlignmentResult &)> ResultCompareFunction
Definition: GaussianShapeAlignment.hpp:82
void calcColorSelfOverlaps(bool calc)
bool performAlignment() const
const FastGaussianShapeOverlapFunction & getDefaultOverlapFunction() const
FastGaussianShapeOverlapFunction & getDefaultOverlapFunction()
ResultIterator getResultsBegin()
AlignmentResult & getResult(std::size_t idx)
const GaussianShape & getReferenceShape(std::size_t idx) const
GaussianShapeAlignment & operator=(const GaussianShapeAlignment &alignment)=delete
~GaussianShapeAlignment()
std::size_t getNumReferenceShapes() const
const ColorFilterFunction & getColorFilterFunction() const
double getOptimizationStopGradient() const
const ResultCompareFunction & getResultCompareFunction() const
bool greedyOptimization() const
ConstShapeIterator getReferenceShapesBegin() const
GaussianShapeAlignment(const GaussianShapeAlignment &alignment)=delete
const ColorMatchFunction & getColorMatchFunction() const
double getDistanceCutoff() const
void setStartGenerator(GaussianShapeAlignmentStartGenerator &gen)
ResultIterator getResultsEnd()
bool calcSelfOverlaps() const
void optimizeOverlap(bool optimize)
GaussianShapeOverlapFunction & getOverlapFunction() const
GaussianShapeAlignmentStartGenerator & getStartGenerator() const
std::size_t getMaxNumOptimizationIterations() const
void setResultSelectionMode(unsigned int mode)
ConstResultIterator getResultsBegin() const
bool align(const GaussianShapeSet &shapes)
void setOverlapFunction(GaussianShapeOverlapFunction &func)
void setColorMatchFunction(const ColorMatchFunction &func)
const ScoringFunction & getScoringFunction() const
ConstResultIterator getResultsEnd() const
std::function< double(const AlignmentResult &)> ScoringFunction
Definition: GaussianShapeAlignment.hpp:81
void performAlignment(bool perf_align)
std::size_t getNumResults() const
void greedyOptimization(bool greedy)
bool calcColorSelfOverlaps() const
bool optimizeOverlap() const
void setOptimizationStopGradient(double grad_norm)
void calcColorOverlaps(bool calc)
void addReferenceShapes(const GaussianShapeSet &shapes, bool new_set=true)
void calcSelfOverlaps(bool calc)
ResultList::iterator ResultIterator
Definition: GaussianShapeAlignment.hpp:76
const AlignmentResult & getResult(std::size_t idx) const
void setMaxOrder(std::size_t max_order)
void setMaxNumOptimizationIterations(std::size_t max_iter)
void setResultCompareFunction(const ResultCompareFunction &func)
void setColorFilterFunction(const ColorFilterFunction &func)
GaussianShapeAlignment(const GaussianShape &ref_shape)
unsigned int getResultSelectionMode() const
bool align(const GaussianShape &shape)
Definition: GaussianShapeFunctionAlignment.hpp:52
GaussianShapeOverlapFunction::ColorMatchFunction ColorMatchFunction
Definition: GaussianShapeFunctionAlignment.hpp:69
GaussianShapeOverlapFunction::ColorFilterFunction ColorFilterFunction
Definition: GaussianShapeFunctionAlignment.hpp:68
Definition: GaussianShapeFunction.hpp:53
Definition: GaussianShapeOverlapFunction.hpp:49
Definition: GaussianShapeSet.hpp:46
A data type for the descripton of arbitrary shapes composed of spheres approximated by gaussian funct...
Definition: GaussianShape.hpp:51
std::shared_ptr< GaussianShape > SharedPointer
Definition: GaussianShape.hpp:112
Definition: PrincipalAxesAlignmentStartGenerator.hpp:49
constexpr unsigned int BEST_PER_REFERENCE_SET
Definition: AlignmentResultSelectionMode.hpp:45
CDPL_SHAPE_API void transform(GaussianShape &shape, const Math::Matrix4D &xform)
The namespace of the Chemical Data Processing Library.