forked from Danielhiversen/AngleCorr
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cxAngleCorrectionExecuter.cpp
78 lines (64 loc) · 2.53 KB
/
cxAngleCorrectionExecuter.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#include "cxAngleCorrectionExecuter.h"
#include "cxLogger.h"
#include "cxForwardDeclarations.h"
namespace cx
{
/**
*
* \ingroup org_custusx_AngleCorrection
*
* \date 2015-06-14
* \author Daniel Hoyer Iversen
*/
AngleCorrectionExecuter::AngleCorrectionExecuter() :
ThreadedTimedAlgorithm<bool>("Angle correction", 5),
AngleCorrection()
{
mUseDefaultMessages = false;
}
AngleCorrectionExecuter::~AngleCorrectionExecuter()
{
}
void AngleCorrectionExecuter::setInput(QString clFilename, QString dataFilename, double Vnyq, double cutoff, int nConvolutions, double uncertainty_limit, double minArrowDist)
{
try {
AngleCorrection::setInput(clFilename.toStdString().c_str(), dataFilename.toStdString().c_str(), Vnyq, cutoff, nConvolutions, uncertainty_limit, minArrowDist);
} catch (std::exception& e){
reportError("std::exception in angle correction algorithm during setting parameters: "+qstring_cast(e.what()));
} catch (...){
reportError("Angle correction algorithm threw a unknown exception during setting parameters.");
}
}
bool AngleCorrectionExecuter::calculate(bool reportOutSuccess)
{
if(reportOutSuccess) report(QString("Algorithm Angle correction started."));
bool res= false;
try {
res=AngleCorrection::calculate();
} catch (std::exception& e){
reportError("std::exception in angle correction algorithm: "+qstring_cast(e.what()));
} catch (...){
reportError("Angle correction algorithm threw a unknown exception.");
}
if(res){
QString text =QString("Algorithm Angle correction complete [%1s].").arg(this->getSecondsPassedAsString());
if(getBloodVessels() <1) text.append(QString("\n Found %1 blood vessels. Maybe <<Velocity certainty cut off>> should be higher?").arg(getBloodVessels()));
if(getIntersections() <1) text.append(QString("\n Found %1 interesections. Maybe <<Max angle cut off>> should be lower?").arg(getIntersections()));
if(getNumOfStepsRan() <1) text.append("\n Same input as previous. No new data generated.");
if(reportOutSuccess) reportSuccess(text);
}else{
QString text =QString("Algorithm Angle correction failed [%1s].").arg(this->getSecondsPassedAsString());
reportError(text);
}
return res;
}
void AngleCorrectionExecuter::postProcessingSlot()
{
}
vtkSmartPointer<vtkPolyData> AngleCorrectionExecuter::getOutput()
{
if(!this->isFinished()) return NULL;
if(!this->getResult()) return NULL;
return AngleCorrection::getOutput();
}
} /* namespace cx */