Skip to content

Commit 7ebbf91

Browse files
authored
Merge branch 'master' into dependabot/pip/notebook-6.4.12
2 parents fc058d4 + c39bbba commit 7ebbf91

8 files changed

Lines changed: 427 additions & 116 deletions

File tree

Applications/shapeworks/Commands.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,13 +230,17 @@ void AnalyzeCommand::buildParser() {
230230

231231
parser.add_option("--name").action("store").type("string").set_default("").help("Path to project file.");
232232
parser.add_option("--output").action("store").type("string").set_default("").help("Path to output file.");
233+
parser.add_option("--range").action("store").type("float").set_default(3.0f).help("Standard deviation range for PCA [default: 3.0].");
234+
parser.add_option("--steps").action("store").type("int").set_default(21).help("Number of steps to use for PCA [default: 21].");
233235

234236
Command::buildParser();
235237
}
236238

237239
bool AnalyzeCommand::execute(const optparse::Values& options, SharedCommandData& sharedData) {
238240
const std::string& projectFile(static_cast<std::string>(options.get("name")));
239241
const std::string& outputFile(static_cast<std::string>(options.get("output")));
242+
const float range = static_cast<float>(options.get("range"));
243+
const int steps = static_cast<int>(options.get("steps"));
240244

241245
if (projectFile.length() == 0) {
242246
std::cerr << "Must specify project name with --name <project.xlsx|.swproj>\n";
@@ -268,7 +272,7 @@ bool AnalyzeCommand::execute(const optparse::Values& options, SharedCommandData&
268272
boost::filesystem::path dir(oldBasePath);
269273
boost::filesystem::path file(outputFile);
270274
boost::filesystem::path full_output = dir / file;
271-
analyze.run_offline_analysis(full_output.string());
275+
analyze.run_offline_analysis(full_output.string(), range, steps);
272276

273277
boost::filesystem::current_path(oldBasePath);
274278

Libs/Analyze/Analyze.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ Analyze::Analyze(ProjectHandle project) : project_(project), mesh_manager_(new M
130130
}
131131

132132
//---------------------------------------------------------------------------
133-
void Analyze::run_offline_analysis(std::string outfile) {
133+
void Analyze::run_offline_analysis(std::string outfile, float range, float steps) {
134134
SW_LOG("ShapeWorks Offline Analysis");
135135
if (!project_->get_particles_present()) {
136136
throw std::runtime_error("Project has not been optimized, please run optimize first");
@@ -140,8 +140,6 @@ void Analyze::run_offline_analysis(std::string outfile) {
140140

141141
json j;
142142

143-
double range = 2.0; // TODO: make this configurable
144-
double steps = 11; // TODO: make this configurable
145143
int half_steps = (steps / 2.0);
146144
double increment = range / half_steps;
147145

Libs/Analyze/Analyze.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class Analyze {
1818
Analyze(ProjectHandle project);
1919

2020
/// Run offline analysis, saving results to outfile
21-
void run_offline_analysis(std::string outfile);
21+
void run_offline_analysis(std::string outfile, float range, float steps);
2222

2323
/// Return the list of shapes
2424
ShapeList get_shapes();

0 commit comments

Comments
 (0)