shapeworks::Constraints
#include <Constraints.h>
Public Types
Name | |
---|---|
using itk::Point< double, 3 > | Point3 |
Public Functions
Name | |
---|---|
Constraints() Constraints are inactive when initialized. |
|
~Constraints() | |
void | addPlane(const vnl_vector< double > & a, const vnl_vector< double > & b, const vnl_vector< double > & c) Adds a cutting-plane boundary constraint. Constraints are used to isolate areas of interest on shape surfaces. |
void | addFreeFormConstraint(std::shared_ptr< shapeworks::Mesh > mesh) Adds the free-form boundary constraint, or FFC. Constraints are used to isolate areas of interest on shape surfaces. |
bool | transformConstraints(const vnl_matrix_fixed< double, 4, 4 > & transform) Applies transformations to free-form constraints (FFCs) |
bool | transformPlanes(const vnl_matrix_fixed< double, 4, 4 > & transform) Applies transformations to cutting-plane constraints. |
std::vector< PlaneConstraint > & | getPlaneConstraints() Returns the vector that constains all plane constraints, of type PlaneConstraint. See class PlaneConstraint for more info. |
FreeFormConstraint & | getFreeformConstraint() Returns the free form constraint, of type FreeFormConstraint. See class FreeFormConstraint for more info. |
bool | isAnyViolated(const Point3 & pos) Returns true if any constraint is violated by point pos. |
void | printAll() Prints all constraints in a neat format. Make sure to disable multithreading if printing within to optimization to avoid jumbled output. |
std::string | violationReport(const Point3 & pos, size_t index) Prints out a comprehensive violation report with each constraint that is violated and the magnitude of such violation by point pos. Index can be 0 if one does not have the index. |
std::vector< std::vector< double > > | violationReportData(const Point3 & pos) Returns the distance to every cosntraint with [0] plane, [1] sphere, and [2] FFC. |
vnl_vector_fixed< double, 3 > | constraintsLagrangianGradient(const Point3 & pos, const Point3 & prepos, double C, size_t index) Returns the constraint gradient. prepos is the current particle, pos is the particle with an optimization update applied, C can be 1, and index is the index of the particle. |
void | InitializeLagrangianParameters(std::vector< double > mus) Initializes lagrangian parameter mus. |
void | UpdateMus(const Point3 & pos, double C, size_t index) Updates mus, the momentum variable of the augmented lagrangian. |
bool | GetActive() Gets the variable active, which determines whether constraints are being used. |
void | SetActive(bool ac) Sets the variable active, which determines whether constraints are being used. |
void | read(std::string filename) Reads in a constraint json file named filename. |
void | write(std::string filename) Writes out a constraint json file named filename. |
bool | hasConstraints() |
void | clipMesh(Mesh & mesh) Clips the mesh that has been passed into it by the constraints stored in this object. |
Detailed Description
class shapeworks::Constraints;
This class contains the set of boundary constraints that are appleid to the shapes in the dataset. They are used to isolate areas of interest on shape surfaces/volumes. These boundary constraints currently take the form of cutting planes, cutting spheres (deprecated), or free-form constraints (FFCs). Do not confuse these with the ApplyConstraints function found in the "domain" code, they refer to the action of snapping to the surface and do not serve to isolate areas of interest.
Please check out Libs/Optimize/Constraints/Constraints for a constraints roadmap
Public Types Documentation
using Point3
using shapeworks::Constraints::Point3 = itk::Point<double, 3>;
Public Functions Documentation
function Constraints
inline Constraints()
Constraints are inactive when initialized.
function ~Constraints
inline ~Constraints()
function addPlane
void addPlane(
const vnl_vector< double > & a,
const vnl_vector< double > & b,
const vnl_vector< double > & c
)
Adds a cutting-plane boundary constraint. Constraints are used to isolate areas of interest on shape surfaces.
function addFreeFormConstraint
void addFreeFormConstraint(
std::shared_ptr< shapeworks::Mesh > mesh
)
Adds the free-form boundary constraint, or FFC. Constraints are used to isolate areas of interest on shape surfaces.
function transformConstraints
bool transformConstraints(
const vnl_matrix_fixed< double, 4, 4 > & transform
)
Applies transformations to free-form constraints (FFCs)
function transformPlanes
bool transformPlanes(
const vnl_matrix_fixed< double, 4, 4 > & transform
)
Applies transformations to cutting-plane constraints.
function getPlaneConstraints
inline std::vector< PlaneConstraint > & getPlaneConstraints()
Returns the vector that constains all plane constraints, of type PlaneConstraint. See class PlaneConstraint for more info.
function getFreeformConstraint
FreeFormConstraint & getFreeformConstraint()
Returns the free form constraint, of type FreeFormConstraint. See class FreeFormConstraint for more info.
function isAnyViolated
bool isAnyViolated(
const Point3 & pos
)
Returns true if any constraint is violated by point pos.
function printAll
void printAll()
Prints all constraints in a neat format. Make sure to disable multithreading if printing within to optimization to avoid jumbled output.
function violationReport
std::string violationReport(
const Point3 & pos,
size_t index
)
Prints out a comprehensive violation report with each constraint that is violated and the magnitude of such violation by point pos. Index can be 0 if one does not have the index.
function violationReportData
std::vector< std::vector< double > > violationReportData(
const Point3 & pos
)
Returns the distance to every cosntraint with [0] plane, [1] sphere, and [2] FFC.
function constraintsLagrangianGradient
vnl_vector_fixed< double, 3 > constraintsLagrangianGradient(
const Point3 & pos,
const Point3 & prepos,
double C,
size_t index
)
Returns the constraint gradient. prepos is the current particle, pos is the particle with an optimization update applied, C can be 1, and index is the index of the particle.
function InitializeLagrangianParameters
void InitializeLagrangianParameters(
std::vector< double > mus
)
Initializes lagrangian parameter mus.
function UpdateMus
void UpdateMus(
const Point3 & pos,
double C,
size_t index
)
Updates mus, the momentum variable of the augmented lagrangian.
function GetActive
inline bool GetActive()
Gets the variable active, which determines whether constraints are being used.
function SetActive
inline void SetActive(
bool ac
)
Sets the variable active, which determines whether constraints are being used.
function read
void read(
std::string filename
)
Reads in a constraint json file named filename.
function write
void write(
std::string filename
)
Writes out a constraint json file named filename.
function hasConstraints
bool hasConstraints()
function clipMesh
void clipMesh(
Mesh & mesh
)
Clips the mesh that has been passed into it by the constraints stored in this object.
Updated on 2024-03-17 at 12:58:44 -0600