Skip to content

shapeworks::QOptimize

Wraps Optimize as a QObject.

#include <QOptimize.h>

Inherits from QObject, shapeworks::Optimize

Public Signals

Name
void progress(int , QString )

Public Functions

Name
QOptimize(QObject * parent =nullptr)
virtual ~QOptimize()
virtual std::vector< std::vector< itk::Point< double > > > GetLocalPoints() override
Return the local points.
virtual std::vector< std::vector< itk::Point< double > > > GetGlobalPoints() override
Return the global points.
std::vector< Particles > GetParticles()
virtual std::vector< std::vector< std::vector< double > > > GetProcrustesTransforms() override
virtual void UpdateExportablePoints() override

Protected Functions

Name
virtual void SetIterationCallback() override
Set the iteration callback. Derived classes should override to set their own callback.
virtual void IterateCallback(itk::Object * caller, const itk::EventObject & ) override

Additional inherited members

Public Types inherited from shapeworks::Optimize

Name
using itk::Image< float, 3 > ImageType
using VectorFunction::VectorType VectorType
using Eigen::MatrixXd MatrixType

Public Functions inherited from shapeworks::Optimize

Name
Optimize()
Constructor.
virtual ~Optimize()
Destructor.
bool Run()
Run the optimization.
bool LoadParameterFile(std::string filename)
Load a parameter file.
bool SetUpOptimize(ProjectHandle project)
Set up this Optimize object using a ShapeWorks project.
void SetProject(std::shared_ptr< Project > project)
Set the Project object.
void SetIterationCallbackFunction(const std::function< void(void)> & f)
Set an iteration callback function to be called after each iteration.
void AbortOptimization()
Abort optimization.
bool GetAborted()
Return if the optimization was aborted.
void SetCutPlanes(std::vector< std::array< itk::Point< double >, 3 > > cut_planes)
Set cutting planes.
void SetVerbosity(int verbosity_level)
Set the verbosity level (0-5)
void SetDomainsPerShape(int domains_per_shape)
Set the number of domains per shape.
int GetDomainsPerShape()
Return the number of domains per shape.
void SetDomainType(shapeworks::DomainType type)
shapeworks::DomainType GetDomainType()
void SetNumberOfParticles(std::vector< int > number_of_particles)
Set the numbers of particles (vector of numbers, one for each domain)
std::vector< int > GetNumberOfParticles()
Return the numbers of particles per domain.
void SetTransformFile(std::string filename)
Set the transform file.
std::string GetTransformFile()
Get the transform file.
void SetPrefixTransformFile(std::string prefix_transform_file)
Set the prefix transform file (TODO: details)
std::string GetPrefixTransformFile()
Get the prefix transform file.
void SetOutputDir(std::string output_dir)
Set the output directory.
void SetOutputTransformFile(std::string output_transform_file)
Set the output transform file.
void SetOutputIndividualTransformFiles(bool value)
Set whether individual transforms should be written.
void SetUseMeshBasedAttributes(bool use_mesh_based_attributes)
Set if mesh based attributes should be used.
bool GetUseMeshBasedAttributes()
Get if mesh based attributes are being used.
void SetUseXYZ(std::vector< bool > use_xyz)
Set if XYZ is used, one value per domain.
void SetUseNormals(std::vector< bool > use_normals)
Set if Normals are being used, one value per domain.
void SetAttributesPerDomain(std::vector< int > attributes_per_domain)
Set the attributes per domain.
std::vector< int > GetAttributesPerDomain()
Get attributes per domain.
void SetDistributionDomainID(int distribution_domain_id)
Set the distribution domain ID (TODO: details)
int GetDistributionDomainID()
Get the distribution domain ID.
void SetOutputCuttingPlaneFile(std::string output_cutting_plane_file)
Set the output cutting plane file.
void SetUseCuttingPlanes(bool use_cutting_planes)
Set if using cutting planes.
void SetCuttingPlane(unsigned int i, const vnl_vector_fixed< double, 3 > & va, const vnl_vector_fixed< double, 3 > & vb, const vnl_vector_fixed< double, 3 > & vc)
Set a given cutting plane for a shape.
void SetProcessingMode(int mode)
Set processing mode (TODO: details)
void SetAdaptivityMode(int adaptivity_mode)
Set adaptivity mode (TODO: details)
void SetMeshFFCMode(int mesh_ffc_mode)
Set Mesh FFC Mode false/0 = mesh clipping mode, true/1 = mesh augmented lagrangian mode.
void SetAdaptivityStrength(double adaptivity_strength)
Set adaptivity strength (TODO: details)
void SetTimePtsPerSubject(int time_pts_per_subject)
Set the number of time points per subject (TODO: details)
int GetTimePtsPerSubject()
Get the number of time points per subject (TODO: details)
void SetOptimizationIterations(int optimization_iterations)
Set the number of optimization iterations.
void SetOptimizationIterationsCompleted(int optimization_iterations_completed)
Set the number of optimization iterations already completed (TODO: details)
void SetIterationsPerSplit(int iterations_per_split)
Set the number of iterations per split.
void SetUseShapeStatisticsInInit(bool use_shape_statistics_in_init)
Set if shape statistics should be used in initialization.
void SetProcrustesInterval(int procrustes_interval)
Set the interval for running procrustes (0 to disable)
void SetProcrustesScaling(bool procrustes_scaling)
Set if procrustes scaling should be used.
void SetProcrustesRotationTranslation(bool procrustes_rotation_translation)
Set if procrustes rotation/translation should be used.
void SetRelativeWeighting(double relative_weighting)
Set the relative weighting (TODO: details)
void SetInitialRelativeWeighting(double initial_relative_weighting)
Set the initial relative weigting (TODO: details)
void SetStartingRegularization(double starting_regularization)
Set the starting regularization (TODO: details)
void SetEndingRegularization(double ending_regularization)
Set the ending regularization (TODO: details)
void SetRecomputeRegularizationInterval(int recompute_regularization_interval)
Set the interval for recomputing regularization (TODO: details)
void SetSaveInitSplits(bool save_init_splits)
Set if initialization splits should be saved or not.
void SetCheckpointingInterval(int checkpointing_interval)
Set the checkpointing interval.
void SetKeepCheckpoints(int keep_checkpoints)
Set if checkpoints should be kept (0=disable, 1=enable)
void SetUseRegression(bool use_regression)
Set if regression should be used (TODO: details)
void SetUseMixedEffects(bool use_mixed_effects)
Set if mixed effects should be used (TODO: details)
void SetUseDisentangledSpatiotemporalSSM(bool use_disentangled_ssm_4d)
Set if optimization should be done using disentangled spatiotemporal SSM method.
bool GetUseDisentangledSpatiotemporalSSM()
Returns true if optimization is to be done using disentangled spatiotemporal SSM method.
void SetNormalAngle(double normal_angle)
For good/bad analysis, set the normal angle to use (TODO: details)
void SetPerformGoodBad(bool perform_good_bad)
Set if good/bad analysis should be done (TODO: details)
void SetLogEnergy(bool log_energy)
Set the log energy (TODO: details)
void AddImage(ImageType::Pointer image, std::string name ="")
Set the shape input images.
void AddMesh(vtkSmartPointer< vtkPolyData > poly_data)
void AddContour(vtkSmartPointer< vtkPolyData > poly_data)
void SetFilenames(const std::vector< std::string > & filenames)
Set the shape filenames (TODO: details)
void SetPointFiles(const std::vector< std::string > & point_files)
Set starting point files (TODO: details)
void SetInitialPoints(std::vector< std::vector< itk::Point< double > > > initial_points)
Set initial particle positions (e.g. for fixed subjects)
int GetNumShapes()
Get number of shapes.
void SetAttributeScales(const std::vector< double > & scales)
Set attribute scales (TODO: details)
void SetFieldAttributes(const std::vector< std::string > & field_attributes)
Set the field attributes.
void SetParticleFlags(std::vector< int > flags)
Set Particle Flags (TODO: details)
void SetFixedDomains(std::vector< int > flags)
Set Domain Flags (TODO: details)
void SetSharedBoundaryEnabled(bool enabled)
Shared boundary settings.
void SetSharedBoundaryWeight(double weight)
const std::vector< int > & GetDomainFlags()
void SetFileOutputEnabled(bool enabled)
Set if file output is enabled.
std::vector< bool > GetUseXYZ()
Return if XYZ is used, per shape.
std::vector< bool > GetUseNormals()
Return if Normals are used, per shape.
void SetNarrowBand(double v)
Set the narrow band used to be +/- the given value as a multiple of the spacing.
double GetNarrowBand()
Return the narrow band to be used.
void SetUseShapeStatisticsAfter(int num_particles)
Set the number of particles when correspondence based multiscale takes over.
int GetUseShapeStatisticsAfter()
Return the number of particles when correspondence based multiscale takes over.
void PrintParamInfo()
Print parameter info to stdout.
std::shared_ptr< Sampler > GetSampler()
Return the Sampler.
MatrixContainer GetParticleSystem()
Return the particle system as a matrix.
void SetPythonFile(std::string filename)
Set the python file to run at startup.
void SetGeodesicsEnabled(bool is_enabled)
Set whether or not geodesics are enabled.
void SetGeodesicsCacheSizeMultiplier(size_t n)
void SetGeodesicsRemeshPercent(double percent)
Set the remeshing percent for the mesh used for computing geodesics (0-100)
OptimizationVisualizer & GetVisualizer()
void SetShowVisualizer(bool show)
bool GetShowVisualizer()
bool GetMeshFFCMode()
vnl_vector_fixed< double, 3 > TransformPoint(int domain, vnl_vector_fixed< double, 3 > input)
transform a point if necessary
void UpdateProgress()
void set_particle_format(std::string format)

Protected Functions inherited from shapeworks::Optimize

Name
void ComputeTotalIterations()
void OptimizerStop()
void ReadTransformFile()
void ReadPrefixTransformFile(const std::string & s)
void InitializeSampler()
double GetMinNeighborhoodRadius()
void AddSinglePoint()
void Initialize()
void AddAdaptivity()
void RunOptimize()
void ComputeEnergyAfterIteration()
void SetCotanSigma()
void WriteTransformFile(int iter =-1) const
void WriteTransformFile(std::string iter_prefix) const
void WriteTransformFiles(int iter =-1) const
void WriteTransformFiles(std::string iter_prefix) const
void WritePointFiles(int iter =-1)
void WritePointFiles(std::string iter_prefix)
void WritePointFilesWithFeatures(int iter =-1)
void WritePointFilesWithFeatures(std::string iter_prefix)
void WriteEnergyFiles()
void WriteSplitFiles(std::string name)
void WriteCuttingPlanePoints(int iter =-1)
void WriteParameters(std::string output_dir ="")
void ReportBadParticles()
int SetParameters()
void WriteModes()
void PrintStartMessage(std::string str, unsigned int vlevel =0) const
void PrintDoneMessage(unsigned int vlevel =0) const
void UpdateProject()
std::string GetCheckpointDir()

Protected Attributes inherited from shapeworks::Optimize

Name
std::shared_ptr< Sampler > m_sampler
ProcrustesRegistration::Pointer m_procrustes
std::shared_ptr< ParticleGoodBadAssessment > m_good_bad
unsigned int m_verbosity_level
std::vector< std::vector< itk::Point< double > > > m_local_points
std::vector< std::vector< itk::Point< double > > > m_global_points
int m_checkpoint_counter
int m_procrustes_counter
bool m_use_cutting_planes
bool m_optimizing
bool m_use_regression
bool m_use_mixed_effects
bool m_use_disentangled_ssm
unsigned int m_domains_per_shape
shapeworks::DomainType m_domain_type
std::vector< int > m_number_of_particles
std::string m_transform_file
std::string m_prefix_transform_file
std::string m_output_dir
std::string m_output_transform_file
bool m_output_transform_files
bool m_mesh_based_attributes
std::vector< bool > m_use_xyz
std::vector< bool > m_use_normals
std::vector< int > m_attributes_per_domain
int m_distribution_domain_id
std::string m_output_cutting_plane_file
int m_processing_mode
int m_adaptivity_mode
double m_adaptivity_strength
bool m_mesh_ffc_mode
unsigned int m_timepts_per_subject
int m_optimization_iterations
int m_optimization_iterations_completed
int m_iterations_per_split
bool m_use_shape_statistics_in_init
unsigned int m_procrustes_interval
bool m_procrustes_scaling
bool m_procrustes_rotation_translation
double m_relative_weighting
double m_initial_relative_weighting
double m_starting_regularization
double m_ending_regularization
int m_recompute_regularization_interval
bool m_save_init_splits
unsigned int m_checkpointing_interval
int m_keep_checkpoints
double m_cotan_sigma_factor
std::vector< int > m_particle_flags
std::vector< int > m_domain_flags
double m_narrow_band
bool m_narrow_band_set
bool m_fixed_domains_present
int m_use_shape_statistics_after
std::string m_python_filename
bool m_geodesics_enabled
size_t m_geodesic_cache_size_multiplier
double m_geodesic_remesh_percent
double m_spacing
std::vector< std::string > m_filenames
int m_num_shapes
std::vector< double > m_energy_a
std::vector< double > m_energy_b
std::vector< double > m_total_energy
bool m_log_energy
std::string m_str_energy
std::vector< std::vector< int > > m_bad_ids
double m_normal_angle
bool m_perform_good_bad
std::vector< int > m_cutting_planes_per_input
std::vector< int > m_spheres_per_input
bool m_file_output_enabled
bool m_aborted
std::vector< std::array< itk::Point< double >, 3 > > m_cut_planes
int m_total_iterations
int m_iteration_count
int m_split_number
int current_particle_iterations_
int total_particle_iterations_
std::function< void(void)> iteration_callback_
bool show_visualizer_
shapeworks::OptimizationVisualizer visualizer_
std::string particle_format_
std::shared_ptr< Project > project_
std::chrono::system_clock::time_point m_start_time
std::chrono::system_clock::time_point m_last_update_time
std::chrono::system_clock::time_point m_last_remaining_update_time
std::string m_remaining_time_message

Public Signals Documentation

signal progress

void progress(
    int ,
    QString 
)

Public Functions Documentation

function QOptimize

QOptimize(
    QObject * parent =nullptr
)

function ~QOptimize

virtual ~QOptimize()

function GetLocalPoints

virtual std::vector< std::vector< itk::Point< double > > > GetLocalPoints() override

Return the local points.

Reimplements: shapeworks::Optimize::GetLocalPoints

function GetGlobalPoints

virtual std::vector< std::vector< itk::Point< double > > > GetGlobalPoints() override

Return the global points.

Reimplements: shapeworks::Optimize::GetGlobalPoints

function GetParticles

std::vector< Particles > GetParticles()

function GetProcrustesTransforms

virtual std::vector< std::vector< std::vector< double > > > GetProcrustesTransforms() override

Reimplements: shapeworks::Optimize::GetProcrustesTransforms

function UpdateExportablePoints

virtual void UpdateExportablePoints() override

Reimplements: shapeworks::Optimize::UpdateExportablePoints

Protected Functions Documentation

function SetIterationCallback

virtual void SetIterationCallback() override

Set the iteration callback. Derived classes should override to set their own callback.

Reimplements: shapeworks::Optimize::SetIterationCallback

function IterateCallback

virtual void IterateCallback(
    itk::Object * caller,
    const itk::EventObject & 
) override

Reimplements: shapeworks::Optimize::IterateCallback


Updated on 2024-07-12 at 20:10:35 +0000