Skip to content

Commit 343f585

Browse files
committed
Restyle/reformat ShapeEvaluationJob
1 parent 731aee8 commit 343f585

File tree

2 files changed

+32
-40
lines changed

2 files changed

+32
-40
lines changed
Lines changed: 21 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,38 @@
1-
1+
#include "ShapeEvaluationJob.h"
22

33
#include <Logging.h>
4-
#include "ShapeEvaluationJob.h"
4+
55
namespace shapeworks {
66

77
//-----------------------------------------------------------------------------
88
ShapeEvaluationJob::ShapeEvaluationJob(JobType job_type, ParticleShapeStatistics stats)
9-
: job_type_(job_type), stats_(stats)
10-
{
11-
qRegisterMetaType<shapeworks::ShapeEvaluationJob::JobType>(
12-
"shapeworks::ShapeEvaluationWorker::JobType");
9+
: job_type_(job_type), stats_(stats) {
10+
qRegisterMetaType<shapeworks::ShapeEvaluationJob::JobType>("shapeworks::ShapeEvaluationWorker::JobType");
1311
qRegisterMetaType<Eigen::VectorXd>("Eigen::VectorXd");
1412
}
1513

1614
//-----------------------------------------------------------------------------
17-
void ShapeEvaluationJob::run()
18-
{
15+
void ShapeEvaluationJob::run() {
1916
auto callback = std::bind(&ShapeEvaluationJob::receive_progress, this, std::placeholders::_1);
20-
switch (this->job_type_) {
21-
case JobType::CompactnessType:
22-
Q_EMIT result_ready(this->job_type_, this->stats_.get_compactness(callback));
23-
break;
24-
case JobType::GeneralizationType:
25-
Q_EMIT result_ready(this->job_type_, this->stats_.get_generalization(callback));
26-
break;
27-
case JobType::SpecificityType:
28-
Q_EMIT result_ready(this->job_type_, this->stats_.get_specificity(callback));
29-
break;
17+
switch (job_type_) {
18+
case JobType::CompactnessType:
19+
Q_EMIT result_ready(job_type_, stats_.get_compactness(callback));
20+
break;
21+
case JobType::GeneralizationType:
22+
Q_EMIT result_ready(job_type_, stats_.get_generalization(callback));
23+
break;
24+
case JobType::SpecificityType:
25+
Q_EMIT result_ready(job_type_, stats_.get_specificity(callback));
26+
break;
3027
}
3128
}
3229

3330
//-----------------------------------------------------------------------------
34-
QString ShapeEvaluationJob::name()
35-
{
36-
return "Shape Evaluation";
37-
}
31+
QString ShapeEvaluationJob::name() { return "Shape Evaluation"; }
3832

3933
//-----------------------------------------------------------------------------
40-
void ShapeEvaluationJob::receive_progress(float progress)
41-
{
42-
Q_EMIT report_progress(this->job_type_, progress);
43-
}
44-
}
34+
void ShapeEvaluationJob::receive_progress(float progress) { Q_EMIT report_progress(job_type_, progress); }
35+
36+
//-----------------------------------------------------------------------------
37+
38+
} // namespace shapeworks
Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,38 @@
11
#pragma once
22

3-
#include <ParticleShapeStatistics.h>
4-
53
#include <Data/Worker.h>
64
#include <Job/Job.h>
5+
#include <ParticleShapeStatistics.h>
76

87
namespace shapeworks {
98

10-
class ShapeEvaluationJob : public Job
11-
{
9+
/**
10+
* @brief The ShapeEvaluationJob class is a worker class that computes shape evaluation metrics of compactness,
11+
* specificity, and generalization. It runs asynchronously using the Job and Worker interfaces.
12+
*/
13+
class ShapeEvaluationJob : public Job {
1214
Q_OBJECT
13-
public:
14-
15-
enum class JobType {
16-
CompactnessType, SpecificityType, GeneralizationType
17-
};
15+
public:
16+
enum class JobType { CompactnessType, SpecificityType, GeneralizationType };
1817

1918
ShapeEvaluationJob(JobType job_type, ParticleShapeStatistics stats);
2019

2120
void run() override;
2221

2322
QString name() override;
2423

25-
Q_SIGNALS:
24+
Q_SIGNALS:
2625

2726
void report_progress(shapeworks::ShapeEvaluationJob::JobType job_type, float progress);
2827
void result_ready(shapeworks::ShapeEvaluationJob::JobType job_type, Eigen::VectorXd data);
2928

30-
private:
31-
29+
private:
3230
void receive_progress(float progress);
3331

3432
JobType job_type_;
3533
ParticleShapeStatistics stats_;
3634
};
37-
}
35+
} // namespace shapeworks
3836

3937
Q_DECLARE_METATYPE(Eigen::VectorXd);
4038
Q_DECLARE_METATYPE(shapeworks::ShapeEvaluationJob::JobType);

0 commit comments

Comments
 (0)