Fraxinus  18.10
An IGT application
cxAngleCorrectionExecuter.cpp
Go to the documentation of this file.
2 #include "cxLogger.h"
3 
5 
6 namespace cx
7 {
8 
18  ThreadedTimedAlgorithm<bool>("Angle correction", 5),
20 {
21  mUseDefaultMessages = false;
22 }
23 
25 {
26 }
27 
28 void AngleCorrectionExecuter::setInput(QString clFilename, QString dataFilename, double Vnyq, double cutoff, int nConvolutions, double uncertainty_limit, double minArrowDist)
29 {
30  try {
31  AngleCorrection::setInput(clFilename.toStdString().c_str(), dataFilename.toStdString().c_str(), Vnyq, cutoff, nConvolutions, uncertainty_limit, minArrowDist);
32  } catch (std::exception& e){
33  reportError("std::exception in angle correction algorithm during setting parameters: "+qstring_cast(e.what()));
34  } catch (...){
35  reportError("Angle correction algorithm threw a unknown exception during setting parameters.");
36  }
37 }
38 
39 
40 bool AngleCorrectionExecuter::calculate(bool reportOutSuccess)
41 {
42  if(reportOutSuccess) report(QString("Algorithm Angle correction started."));
43  bool res= false;
44  try {
46  } catch (std::exception& e){
47  reportError("std::exception in angle correction algorithm: "+qstring_cast(e.what()));
48  } catch (...){
49  reportError("Angle correction algorithm threw a unknown exception.");
50  }
51  if(res){
52  QString text =QString("Algorithm Angle correction complete [%1s].").arg(this->getSecondsPassedAsString());
53  if(getBloodVessels() <1) text.append(QString("\n Found %1 blood vessels. Maybe <<Velocity certainty cut off>> should be higher?").arg(getBloodVessels()));
54  if(getIntersections() <1) text.append(QString("\n Found %1 interesections. Maybe <<Max angle cut off>> should be lower?").arg(getIntersections()));
55  if(getNumOfStepsRan() <1) text.append("\n Same input as previous. No new data generated.");
56  if(reportOutSuccess) reportSuccess(text);
57  }else{
58  QString text =QString("Algorithm Angle correction failed [%1s].").arg(this->getSecondsPassedAsString());
59  reportError(text);
60  }
61  return res;
62 }
63 
64 
65 void AngleCorrectionExecuter::postProcessingSlot()
66 {
67 
68 }
69 
70 vtkSmartPointer<vtkPolyData> AngleCorrectionExecuter::getOutput()
71 {
72  if(!this->isFinished()) return NULL;
73  if(!this->getResult()) return NULL;
75 }
76 
77 
78 } /* namespace cx */
QString qstring_cast(const T &val)
void reportError(QString msg)
Definition: cxLogger.cpp:71
Base class for algorithms that wants to thread and time their execution. T is the return type of the ...
void setInput(vtkSmartPointer< vtkPolyData > vpd_centerline, const char *image_prefix, double Vnyq, double cutoff, int nConvolutions, double uncertainty_limit=0.0, double minArrowDist=1.0)
virtual bool calculate()
This is the threaded function, should only contain threadsafe function calls.
void setInput(QString clFilename, QString dataFilename, double Vnyq, double cutoff, int nConvolutions, double uncertainty_limit, double minArrowDist)
vtkSmartPointer< vtkPolyData > getOutput()
void reportSuccess(QString msg)
Definition: cxLogger.cpp:72
void report(QString msg)
Definition: cxLogger.cpp:69
QString getSecondsPassedAsString() const
vtkSmartPointer< vtkPolyData > getOutput()
Namespace for all CustusX production code.