Skip to content

Commit

Permalink
added scale factor back in. rename method on widget. Segmentation def…
Browse files Browse the repository at this point in the history
…ault
  • Loading branch information
Brig Bagley committed Jul 5, 2016
1 parent 67c22bb commit 4f863b7
Show file tree
Hide file tree
Showing 5 changed files with 77 additions and 24 deletions.
7 changes: 6 additions & 1 deletion src/cli/mesher/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ int main(int argc, char* argv[])
double alpha_short = kDefaultAlphaShort;
double lipschitz = kDefaultLipschitz;
double multiplier = kDefaultMultiplier;
double scaling = kDefaultScale;
int padding = kDefaultPadding;
bool have_sizing_field = false;
bool have_background_mesh = false;
Expand Down Expand Up @@ -133,6 +134,7 @@ int main(int argc, char* argv[])
("alpha_long,l", po::value<double>(), "alpha long value for regular mesh_mode")
("sizing_field,z", po::value<std::string>(), "sizing field path")
("grading,g", po::value<double>(), "sizing field grading")
("scale,c", po::value<double>(), "sizing field scale factor")
("multiplier,x", po::value<double>(), "sizing field multiplier")
("padding,p", po::value<int>(), "volume padding")
("write_background_mesh,w", "write background mesh")
Expand Down Expand Up @@ -220,6 +222,9 @@ int main(int argc, char* argv[])
if (variables_map.count("grading")) {
lipschitz = variables_map["grading"].as<double>();
}
if (variables_map.count("scaling")) {
scaling = variables_map["scaling"].as<double>();
}
if (variables_map.count("multiplier")) {
multiplier = variables_map["multiplier"].as<double>();
}
Expand Down Expand Up @@ -393,7 +398,7 @@ int main(int argc, char* argv[])
sizingField.push_back(cleaver::SizingFieldCreator::createSizingFieldFromVolume(
volume,
(float)(1.0 / lipschitz),
1.f,
(float)scaling,
(float)multiplier,
(int)padding,
(mesh_mode == cleaver::Regular ? false : true),
Expand Down
4 changes: 2 additions & 2 deletions src/gui/Application/MainWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ class MyFileDialog : public QFileDialog
};

bool MyFileDialog::isSegmentation() {
return this->segmentation_check_->isChecked();
return !this->segmentation_check_->isChecked();
}

MyFileDialog::MyFileDialog( QWidget *parent, const QString& a,
Expand All @@ -340,7 +340,7 @@ MyFileDialog::MyFileDialog( QWidget *parent, const QString& a,
QHBoxLayout *hbl = new QHBoxLayout();

// add some widgets
segmentation_check_ = new QCheckBox("This is a segmentation file", this);
segmentation_check_ = new QCheckBox("These are individual indicator functions", this);
segmentation_check_->setChecked(false);
hbl->addWidget(segmentation_check_);

Expand Down
11 changes: 7 additions & 4 deletions src/gui/Application/ToolWidgets/SizingFieldWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,15 @@ void SizingFieldWidget::loadSizingField() {
}

void SizingFieldWidget::computeSizingField() {
float scaling = ui->scaleFactor->value();
float factor = ui->factorSpinBox->value();
float speed = 1.0 / ui->lipschitzSpinBox->value();
int padding = ui->paddingSpinBox->value();
bool adaptiveSurface = QString::compare(
ui->surfaceComboBox->currentText(),
QString("constant"), Qt::CaseInsensitive) == 0 ? true : false;
SizingFieldThread *workerThread = new SizingFieldThread(this->mesher_, this,
factor, speed, padding, adaptiveSurface);
scaling, factor, speed, padding, adaptiveSurface);
connect(workerThread, SIGNAL(sizingFieldDone()), this, SLOT(handleSizingFieldDone()));
connect(workerThread, SIGNAL(message(std::string)), this, SLOT(handleMessage(std::string)));
connect(workerThread, SIGNAL(errorMessage(std::string)), this, SLOT(handleErrorMessage(std::string)));
Expand All @@ -82,8 +83,9 @@ void SizingFieldWidget::handleProgress(int v) { emit progress(v); }

SizingFieldThread::SizingFieldThread(
cleaver::CleaverMesher& mesher, QObject * parent,
float factor, float speed, int padding, bool adapt) :
QThread(parent), mesher_(mesher),
float scaling, float factor, float speed,
int padding, bool adapt) :
QThread(parent), mesher_(mesher), scaling_(scaling),
factor_(factor), speed_(speed), padding_(padding),
adapt_(adapt) { }

Expand All @@ -95,7 +97,8 @@ void SizingFieldThread::run() {
try {
cleaver::AbstractScalarField *sizingField =
cleaver::SizingFieldCreator::createSizingFieldFromVolume(
this->mesher_.getVolume(), this->speed_, 1., this->factor_,
this->mesher_.getVolume(), this->speed_,
this->scaling_, this->factor_,
this->padding_, this->adapt_, true);
this->mesher_.getVolume()->setSizingField(sizingField);
emit progress(50);
Expand Down
4 changes: 2 additions & 2 deletions src/gui/Application/ToolWidgets/SizingFieldWidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class SizingFieldThread : public QThread {
Q_OBJECT
public:
SizingFieldThread(cleaver::CleaverMesher& mesher,
QObject * parent,
QObject * parent, float scaling,
float factor, float speed, int padding, bool adapt);
~SizingFieldThread();
void run();
Expand All @@ -25,7 +25,7 @@ class SizingFieldThread : public QThread {
void errorMessage(std::string);
private:
cleaver::CleaverMesher& mesher_;
float factor_, speed_;
float factor_, speed_, scaling_;
int padding_;
bool adapt_;
};
Expand Down
75 changes: 60 additions & 15 deletions src/gui/Application/ToolWidgets/SizingFieldWidget.ui
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,58 @@
</layout>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_8">
<property name="spacing">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>Scaling Factor:</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QDoubleSpinBox" name="scaleFactor">
<property name="minimumSize">
<size>
<width>86</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>86</width>
<height>16777215</height>
</size>
</property>
<property name="minimum">
<double>0.010000000000000</double>
</property>
<property name="value">
<double>1.000000000000000</double>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QWidget" name="factorWidget" native="true">
<layout class="QHBoxLayout" name="horizontalLayout_6">
Expand Down Expand Up @@ -373,28 +425,15 @@
</property>
<property name="maximumSize">
<size>
<width>80</width>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>Sizing Type:</string>
<string>Element Sizing Method:</string>
</property>
</widget>
</item>
<item>
<spacer name="surfaceSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>10</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QComboBox" name="surfaceComboBox">
<property name="minimumSize">
Expand All @@ -403,6 +442,12 @@
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>86</width>
<height>16777215</height>
</size>
</property>
<property name="currentIndex">
<number>1</number>
</property>
Expand Down

0 comments on commit 4f863b7

Please sign in to comment.