CustusX  2022.05.26-dev+develop.ffefb6
An IGT application
cxThreadedTimedAlgorithm.cpp
Go to the documentation of this file.
1 /*=========================================================================
2 This file is part of CustusX, an Image Guided Therapy Application.
3 
4 Copyright (c) SINTEF Department of Medical Technology.
5 All rights reserved.
6 
7 CustusX is released under a BSD 3-Clause license.
8 
9 See Lisence.txt (https://github.com/SINTEFMedtek/CustusX/blob/master/License.txt) for details.
10 =========================================================================*/
11 
13 
14 #include "cxTimedAlgorithm.h"
15 
16 #include "itkImageFileReader.h"
17 #include "cxTypeConversions.h"
18 #include "vtkMetaImageWriter.h"
19 #include "cxSettings.h"
20 #include "cxUtilHelpers.h"
21 
22 namespace cx
23 {
24 
25 
26 
27 template class ThreadedTimedAlgorithm<vtkImageDataPtr>; //centerline
28 template class ThreadedTimedAlgorithm<ImagePtr>; //resample
29 //template class ThreadedTimedAlgorithm<vtkImageDataPtr>; //BinaryThresholdImageFilter
30 template class ThreadedTimedAlgorithm<vtkPolyDataPtr>; //contour
31 template class ThreadedTimedAlgorithm<void>;
32 template class ThreadedTimedAlgorithm<bool>;
33 
34 template<>
36 {
37  return;
38 }
39 
40 
41 //---------------------------------------------------------------------------------------------------------------------
42 Example::Example() :
43  ThreadedTimedAlgorithm<QString>("TestProduct", 1)
44 {
45  std::cout << "Test::Test()" << std::endl;
46  this->generate();
47 }
48 
50 {}
51 
52 void Example::postProcessingSlot()
53 {
54  QString result = this->getResult();
55  std::cout << "void Test::postProcessingSlot(), result: "<< result.toStdString() << std::endl;
56  emit finished();
57 }
58 
59 QString Example::calculate()
60 {
61  std::cout << " QString Test::calculate()" << std::endl;
62 
63 #ifdef WIN32
64  Sleep(500);
65 #else
66  sleep(5);
67 #endif
68 
69  return QString("Test successful!!!");
70 }
71 }//namespace cx
void finished()
should be emitted when at the end of postProcessingSlot
Base class for algorithms that wants to thread and time their execution. T is the return type of the ...
Namespace for all CustusX production code.