Skip to content

Commit

Permalink
New UI for shape/scalar stuff.
Browse files Browse the repository at this point in the history
  • Loading branch information
akenmorris committed Nov 20, 2023
1 parent 71a99a1 commit f87ebe3
Show file tree
Hide file tree
Showing 2 changed files with 74 additions and 24 deletions.
30 changes: 14 additions & 16 deletions Studio/Analysis/AnalysisTool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,15 @@ AnalysisTool::AnalysisTool(Preferences& prefs) : preferences_(prefs) {
connect(ui_->mcaLevelBetweenButton, &QPushButton::clicked, this, &AnalysisTool::pca_update);
connect(ui_->mcaLevelWithinButton, &QPushButton::clicked, this, &AnalysisTool::pca_update);
connect(ui_->vanillaPCAButton, &QPushButton::clicked, this, &AnalysisTool::pca_update);
connect(ui_->pca_shape_checkbox, &QCheckBox::clicked, this, &AnalysisTool::change_pca_analysis_type);
connect(ui_->pca_scalar_checkbox, &QCheckBox::clicked, this, &AnalysisTool::change_pca_analysis_type);

// shape/scalar
connect(ui_->pca_scalar_only, &QCheckBox::clicked, this, &AnalysisTool::change_pca_analysis_type);
connect(ui_->pca_scalar_shape_only, &QCheckBox::clicked, this, &AnalysisTool::change_pca_analysis_type);
connect(ui_->pca_shape_and_scalar, &QCheckBox::clicked, this, &AnalysisTool::change_pca_analysis_type);
connect(ui_->pca_scalar_combo, qOverload<int>(&QComboBox::currentIndexChanged), this,
&AnalysisTool::change_pca_analysis_type);
connect(ui_->pca_predict_scalar, &QCheckBox::clicked, this, &AnalysisTool::change_pca_analysis_type);
connect(ui_->pca_predict_shape, &QCheckBox::clicked, this, &AnalysisTool::change_pca_analysis_type);

// group animation
connect(ui_->group_animate_checkbox, &QCheckBox::stateChanged, this,
Expand Down Expand Up @@ -495,6 +500,7 @@ bool AnalysisTool::compute_stats() {
if (pca_shape_only_mode()) {
particles = shape->get_global_correspondence_points();
} else if (pca_scalar_only_mode()) {
stats_.set_num_values_per_particle(1);
particles = shape->get_point_features(ui_->pca_scalar_combo->currentText().toStdString());
} else {
stats_.set_num_values_per_particle(4);
Expand Down Expand Up @@ -903,18 +909,17 @@ AnalysisTool::GroupAnalysisType AnalysisTool::get_group_analysis_type() {

//---------------------------------------------------------------------------
bool AnalysisTool::pca_scalar_only_mode() {
return ui_->pca_scalar_checkbox->isChecked() && !ui_->pca_shape_checkbox->isChecked();
return ui_->pca_scalar_only->isChecked();
}

//---------------------------------------------------------------------------
bool AnalysisTool::pca_shape_plus_scalar_mode() {
return ui_->pca_scalar_checkbox->isChecked() && ui_->pca_shape_checkbox->isChecked();
return ui_->pca_shape_and_scalar->isChecked();
}

//---------------------------------------------------------------------------
bool AnalysisTool::pca_shape_only_mode() {
// default
return !pca_scalar_only_mode() && !pca_shape_plus_scalar_mode();
return ui_->pca_scalar_shape_only->isChecked();
}

//---------------------------------------------------------------------------
Expand Down Expand Up @@ -1239,13 +1244,12 @@ ShapeHandle AnalysisTool::create_shape_from_points(Particles points) {
shape->set_reconstruction_transforms(reconstruction_transforms_);

if (feature_map_ != "") {
//auto scalars = ShapeScalarJob::predict_scalars(session_, QString::fromStdString(feature_map_),
// points.get_combined_global_particles());
// auto scalars = ShapeScalarJob::predict_scalars(session_, QString::fromStdString(feature_map_),
// points.get_combined_global_particles());

//shape->set_point_features(feature_map_, scalars);
// shape->set_point_features(feature_map_, scalars);

shape->set_point_features(feature_map_, temp_scalars_);

}
return shape;
}
Expand Down Expand Up @@ -1721,12 +1725,6 @@ void AnalysisTool::group_analysis_combo_changed() {

//---------------------------------------------------------------------------
void AnalysisTool::change_pca_analysis_type() {
if (ui_->pca_scalar_checkbox->isChecked()) {
ui_->pca_scalar_combo->setEnabled(true);
} else {
ui_->pca_scalar_combo->setEnabled(false);
}

stats_ready_ = false;
evals_ready_ = false;
stats_ = ParticleShapeStatistics();
Expand Down
68 changes: 60 additions & 8 deletions Studio/Analysis/AnalysisTool.ui
Original file line number Diff line number Diff line change
Expand Up @@ -1384,25 +1384,77 @@ QWidget#particles_panel {
<property name="bottomMargin">
<number>0</number>
</property>
<item row="0" column="0">
<widget class="QCheckBox" name="pca_shape_checkbox">
<item row="2" column="0">
<widget class="QRadioButton" name="pca_scalar_only">
<property name="toolTip">
<string>Multi-Level Component Analysis - Modes of variation highlighting only morphological changes in shape subspace.</string>
</property>
<property name="text">
<string>Shape</string>
<string>Scalar Only</string>
</property>
<property name="checked">
<property name="checkable">
<bool>true</bool>
</property>
<property name="checked">
<bool>false</bool>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QCheckBox" name="pca_scalar_checkbox">
<widget class="QComboBox" name="pca_scalar_combo"/>
</item>
<item row="1" column="0">
<widget class="QRadioButton" name="pca_scalar_shape_only">
<property name="toolTip">
<string>Multi-Level Component Analysis - Modes of variation highlighting only morphological changes in shape subspace.</string>
</property>
<property name="text">
<string>Scalar</string>
<string>Shape Only</string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QComboBox" name="pca_scalar_combo"/>
<item row="3" column="0">
<widget class="QRadioButton" name="pca_shape_and_scalar">
<property name="toolTip">
<string>Multi-Level Component Analysis - Modes of variation highlighting only morphological changes in shape subspace.</string>
</property>
<property name="text">
<string>Shape and Scalar</string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<property name="checked">
<bool>false</bool>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_7">
<property name="text">
<string>Scalar:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QCheckBox" name="pca_predict_scalar">
<property name="text">
<string>Predict scalar</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QCheckBox" name="pca_predict_shape">
<property name="text">
<string>Predict shape</string>
</property>
</widget>
</item>
</layout>
</widget>
Expand Down

0 comments on commit f87ebe3

Please sign in to comment.