#include <ShapeStatistics.hpp>
Public Member Functions | |
ShapeStatistics (const shape_t &mean_shape) | |
ShapeStatistics (const std::vector< shape_t > &shapes) | |
ShapeStatistics (const std::vector< boost::shared_ptr< shape_t > > &shapes) | |
void | set_mode_manually (std::size_t mode, float_t deviation) |
void | compute_statistics () |
void | shape_vector (const ublas::vector< float_t > &coefficients, ublas::vector< float_t > &vector) const |
void | shape_vector (const ublas::vector< float_t > &coefficients, ublas::vector< float_t > &vector, float_t &squared_distance) const |
void | shape_sample (const ublas::vector< float_t > &coefficients, shape_t &out_shape) const |
void | shape_sample (const ublas::vector< float_t > &coefficients, shape_t &out_shape, float_t &squared_distance) const |
void | gradient (const ublas::vector< float_t > &coefficients, ublas::vector< float_t > &gradient) const |
void | random_shape_sample (float_t sample_radius, shape_t &out_shape, float_t &squared_distance) const |
const shape_t & | mean_shape () const |
shape_t & | mode_shape (std::size_t mode, float_t offset, shape_t &out_shape) const |
size_t | dimension () const |
This class computes the mean shape and the covariance in the tangent space at the mean shape of a set of shapes. In addition, it is possible to manually set parameters of the distribution (such as position and rotation) to remove dependence of the statistics on them. After the computation of the statistics the user can sample shapes from a normal distribution on the tangent space of the mean shape. The covariance matrix of this distribution is the same as the one of the sample data (with exception of the manually set modes).
The shapes must be elements of a common shape manifold, i.e. shape_t must be derived from ShapeInterface and the Riemannian exponential and logarithm of the shapes must be compatible to each other. More precisely, all shapes passed to a ShapeStatistics object must accept all the others as arguments in their exponential and logarithm member functions.
Note that the user must call compute_statistics() before querying a ShapeStatistic object, i.e. before calling mean_shape() or any of the sample members.
imaging::ShapeStatistics< shape_t >::ShapeStatistics | ( | const shape_t & | mean_shape | ) | [inline] |
Construct a ShapeStatistics object by manually setting its mean. Note that you to call set_mode_manually() of all (dimension of the mean shape) modes if you choose to construct the statistics from the mean shape rather than shape samples. The member compute_statistics() must be called before querying the statistics.
imaging::ShapeStatistics< shape_t >::ShapeStatistics | ( | const std::vector< shape_t > & | shapes | ) | [inline] |
Construct a ShapeStatistics from a set of shapes. The shapes must be elements of a common shape manifold, i.e. shape_t must be derived from ShapeInterface and the Riemannian exponential and logarithm of the shapes must be compatible to each other. More precisely, all shapes passed to a ShapeStatistics object must accept all the others as arguments in their exponential and logarithm member functions. In particular, this implies that the dimension of each of the shapes must be the same. The member compute_statistics() must be called before querying the statistics.
imaging::ShapeStatistics< shape_t >::ShapeStatistics | ( | const std::vector< boost::shared_ptr< shape_t > > & | shapes | ) | [inline] |
Construct a ShapeStatistics from a set of shapes. The shapes must be elements of a common shape manifold, i.e. shape_t must be derived from ShapeInterface and the Riemannian exponential and logarithm of the shapes must be compatible to each other. More precisely, all shapes passed to a ShapeStatistics object must accept all the others as arguments in their exponential and logarithm member functions. In particular, this implies that the dimension of each of the shapes must be the same. The member compute_statistics() must be called before querying the statistics.
void imaging::ShapeStatistics< shape_t >::set_mode_manually | ( | std::size_t | mode, | |
float_t | deviation | |||
) | [inline] |
Forces the mode-th diagonal entry of the covariance matrix to be set to deviation and sets all other entries in the corresponding row and column of the covariance matrix to zero. The member compute_statistics() must be called before querying the statistics.
void imaging::ShapeStatistics< shape_t >::compute_statistics | ( | ) | [inline] |
Computes the statistics and takes into account the manually set modes. After calling this function you can query the statistics.
void imaging::ShapeStatistics< shape_t >::shape_vector | ( | const ublas::vector< float_t > & | coefficients, | |
ublas::vector< float_t > & | vector | |||
) | const [inline] |
Maps the coefficients in the PCA space of the sample data to the corresponding tangent vector in the tangent space at the mean shape.
References imaging::ShapeStatistics< shape_t >::dimension().
Referenced by imaging::ShapeStatistics< shape_t >::shape_sample().
void imaging::ShapeStatistics< shape_t >::shape_vector | ( | const ublas::vector< float_t > & | coefficients, | |
ublas::vector< float_t > & | vector, | |||
float_t & | squared_distance | |||
) | const [inline] |
Maps the coefficients in the PCA space of the sample data to the corresponding tangent vector in the tangent space at the mean shape and stores the squared Mahalanobis distance of the vector to the mean in squared_distance.
References imaging::ShapeStatistics< shape_t >::dimension(), and imaging::square().
void imaging::ShapeStatistics< shape_t >::shape_sample | ( | const ublas::vector< float_t > & | coefficients, | |
shape_t & | out_shape | |||
) | const [inline] |
Maps the coefficients in the PCA space of the sample data to the corresponding shape.
Referenced by imaging::ShapeStatistics< shape_t >::mode_shape(), and imaging::ShapeStatistics< shape_t >::random_shape_sample().
void imaging::ShapeStatistics< shape_t >::shape_sample | ( | const ublas::vector< float_t > & | coefficients, | |
shape_t & | out_shape, | |||
float_t & | squared_distance | |||
) | const [inline] |
Maps the coefficients in the PCA space of the sample data to the corresponding shape and stores the squared Mahalanobis distance of the shape sample to the mean shape in squared_distance. The manually set modes are not reflected in the distance!
References imaging::ShapeStatistics< shape_t >::shape_vector().
void imaging::ShapeStatistics< shape_t >::gradient | ( | const ublas::vector< float_t > & | coefficients, | |
ublas::vector< float_t > & | gradient | |||
) | const [inline] |
Maps the coefficients in the PCA space of the sample data to gradient of the squared Mahalanobis distance to the mean shape. The manually set modes are not reflected in the distance!
void imaging::ShapeStatistics< shape_t >::random_shape_sample | ( | float_t | sample_radius, | |
shape_t & | out_shape, | |||
float_t & | squared_distance | |||
) | const [inline] |
Maps random coefficients in the PCA space of the sample data to the corresponding shape and stores the squared Mahalanobis distance of the shape sample to the mean shape in squared_distance. The coefficients are sampled from a normal distribution with mean zero and covariance matrix sample_radius * identity. The manually set modes are not reflected in squared_distance.
References imaging::normal_distribution(), imaging::ShapeStatistics< shape_t >::shape_sample(), and imaging::symmetric_uniform_distribution().
const shape_t& imaging::ShapeStatistics< shape_t >::mean_shape | ( | ) | const [inline] |
Returns the mean shape. The user must call compute_statistics() before the mean shape can be queried.
shape_t& imaging::ShapeStatistics< shape_t >::mode_shape | ( | std::size_t | mode, | |
float_t | offset, | |||
shape_t & | out_shape | |||
) | const [inline] |
Sets out_shape to the shape on the mode-th principal component of the sample data at distance offset from the mean. Negative values for offset result in the opposite shape.
References imaging::ShapeStatistics< shape_t >::shape_sample().
size_t imaging::ShapeStatistics< shape_t >::dimension | ( | ) | const [inline] |
Returns the dimension of the mean shape.
Referenced by imaging::ShapeStatistics< shape_t >::shape_vector().