NorMIT-nav  2023.01.05-dev+develop.0da12
An IGT application
cxUsReconstructionServiceProxy.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 <boost/bind.hpp>
15 //#include <QString.h>
16 
17 //#include "cxUSReconstructInputData.h"
18 #include "cxLogger.h"
19 
20 //#include <set>
21 //#include "cxForwardDeclarations.h"
22 //#include "cxXmlOptionItem.h"
23 //#include "cxReconstructCore.h"
25 //#include "cxReconstructedOutputVolumeParams.h"
26 //#include "cxReconstructionMethodService.h"
27 //#include "cxServiceTrackerListener.h"
28 
29 #include "cxNullDeleter.h"
30 
31 namespace cx {
32 
34  mPluginContext(pluginContext),
35  mUsReconstructionService(UsReconstructionService::getNullObject())
36 {
37  this->initServiceListener();
38 }
39 
40 
41 void UsReconstructionServiceProxy::initServiceListener()
42 {
43  mServiceListener.reset(new ServiceTrackerListener<UsReconstructionService>(
44  mPluginContext,
45  boost::bind(&UsReconstructionServiceProxy::onServiceAdded, this, _1),
46  boost::function<void (UsReconstructionService*)>(),
47  boost::bind(&UsReconstructionServiceProxy::onServiceRemoved, this, _1)
48  ));
49  mServiceListener->open();
50 }
51 void UsReconstructionServiceProxy::onServiceAdded(UsReconstructionService* service)
52 {
53  mUsReconstructionService.reset(service, null_deleter());
62 
63  if(mUsReconstructionService->isNull())
64  reportWarning("UsReconstructionServiceProxy::onServiceAdded mVideoService->isNull()");
65 
66  emit paramsChanged();
67  emit algorithmChanged();
68 }
69 
70 void UsReconstructionServiceProxy::onServiceRemoved(UsReconstructionService *service)
71 {
80  mUsReconstructionService = UsReconstructionService::getNullObject();
81 
82  emit paramsChanged();
83  emit algorithmChanged();
84 }
85 
87 {
88  return mUsReconstructionService->isNull();
89 }
90 
91 
92 
93 void UsReconstructionServiceProxy::selectData(QString filename, QString calFilesPath)
94 {
95  mUsReconstructionService->selectData(filename, calFilesPath);
96 }
97 
99 {
100  mUsReconstructionService->selectData(data);
101 }
102 
104 {
105  return mUsReconstructionService->getSelectedFilename();
106 }
107 
109 {
110  return mUsReconstructionService->getSelectedFileData();
111 }
112 
114 {
115  return mUsReconstructionService->getParam(uid);
116 }
117 
118 //ReconstructParamsPtr UsReconstructionServiceProxy::getParams()
119 //{
120 // return mUsReconstructionService->getParams();
121 //}
122 
124 {
125  return mUsReconstructionService->getAlgoOptions();
126 }
127 
129 {
130  return mUsReconstructionService->getSettings();
131 }
132 
134 {
135  return mUsReconstructionService->getOutputVolumeParams();
136 }
137 
139 {
140  mUsReconstructionService->setOutputVolumeParams(par);
141 }
142 
143 //void UsReconstructionServiceProxy::setOutputRelativePath(QString path)
144 //{
145 // mUsReconstructionService->setOutputRelativePath(path);
146 //}
147 
148 //void UsReconstructionServiceProxy::setOutputBasePath(QString path)
149 //{
150 // mUsReconstructionService->setOutputBasePath(path);
151 //}
152 
154 {
155  mUsReconstructionService->startReconstruction();
156 }
157 
159 {
160  return mUsReconstructionService->getThreadedReconstruction();
161 }
162 
164 {
165  return mUsReconstructionService->createAlgorithm();
166 }
167 
169 {
170  return mUsReconstructionService->createCoreParameters();
171 }
172 
174 {
175  return mUsReconstructionService->newDataOnDisk(mhdFilename);
176 }
177 
178 } //cx
cx::UsReconstructionServiceProxy::UsReconstructionServiceProxy
UsReconstructionServiceProxy(ctkPluginContext *pluginContext)
Definition: cxUsReconstructionServiceProxy.cpp:33
cx::XmlOptionFile
Helper class for xml files used to store ssc/cx data.
Definition: cxXmlOptionItem.h:78
cx::UsReconstructionService::reconstructAboutToStart
void reconstructAboutToStart()
cxLogger.h
cx::UsReconstructionService::inputDataSelected
void inputDataSelected(QString mhdFileName)
cx::UsReconstructionServiceProxy::getSelectedFileData
virtual USReconstructInputData getSelectedFileData()
Return the currently selected input data.
Definition: cxUsReconstructionServiceProxy.cpp:108
cx
Namespace for all CustusX production code.
Definition: cx_dev_group_definitions.h:13
cx::ServiceTrackerListener
Helper class for listening to services being added, modified and removed.
Definition: cxServiceTrackerListener.h:53
cx::UsReconstructionServiceProxy::startReconstruction
virtual void startReconstruction()
Definition: cxUsReconstructionServiceProxy.cpp:153
cx::UsReconstructionService::newInputDataPath
void newInputDataPath(QString path)
cx::UsReconstructionService
Definition: cxUsReconstructionService.h:50
cxUsReconstructionServiceProxy.h
cx::UsReconstructionServiceProxy::newDataOnDisk
virtual void newDataOnDisk(QString mhdFilename)
Definition: cxUsReconstructionServiceProxy.cpp:173
cx::ReconstructionMethodService
Abstract interface for reconstruction algorithm.
Definition: cxReconstructionMethodService.h:54
cxUSReconstructInputData.h
cx::PropertyPtr
boost::shared_ptr< class Property > PropertyPtr
Definition: cxLocalServerStreamerServer.h:25
cx::ReconstructCore::InputParams
Definition: cxReconstructCore.h:41
cx::UsReconstructionServiceProxy::getSelectedFilename
virtual QString getSelectedFilename() const
Get the currently selected filename.
Definition: cxUsReconstructionServiceProxy.cpp:103
cx::UsReconstructionService::newInputDataAvailable
void newInputDataAvailable(QString mhdFileName)
cxNullDeleter.h
cx::UsReconstructionServiceProxy::isNull
virtual bool isNull()
Definition: cxUsReconstructionServiceProxy.cpp:86
cx::UsReconstructionServiceProxy::getSettings
virtual XmlOptionFile getSettings()
Return the settings xml file where parameters are stored.
Definition: cxUsReconstructionServiceProxy.cpp:128
cx::UsReconstructionService::paramsChanged
void paramsChanged()
cx::UsReconstructionServiceProxy::createAlgorithm
virtual ReconstructionMethodService * createAlgorithm()
Definition: cxUsReconstructionServiceProxy.cpp:163
cx::UsReconstructionService::algorithmChanged
void algorithmChanged()
cx::UsReconstructionServiceProxy::createCoreParameters
virtual ReconstructCore::InputParams createCoreParameters()
Definition: cxUsReconstructionServiceProxy.cpp:168
cx::UsReconstructionService::reconstructFinished
void reconstructFinished()
cx::UsReconstructionServiceProxy::getOutputVolumeParams
virtual OutputVolumeParams getOutputVolumeParams() const
Return params controlling the output data. These are data-dependent.
Definition: cxUsReconstructionServiceProxy.cpp:133
cx::UsReconstructionServiceProxy::getParam
virtual PropertyPtr getParam(QString uid)
Return one of the standard parameters.
Definition: cxUsReconstructionServiceProxy.cpp:113
cx::UsReconstructionService::reconstructStarted
void reconstructStarted()
cx::UsReconstructionServiceProxy::getAlgoOptions
virtual std::vector< PropertyPtr > getAlgoOptions()
Return control parameters for the currently selected algorithm, adjustable like getParams()
Definition: cxUsReconstructionServiceProxy.cpp:123
cx::UsReconstructionServiceProxy::setOutputVolumeParams
virtual void setOutputVolumeParams(const OutputVolumeParams &par)
Control the output volume.
Definition: cxUsReconstructionServiceProxy.cpp:138
cx::UsReconstructionServiceProxy::getThreadedReconstruction
virtual std::set< cx::TimedAlgorithmPtr > getThreadedReconstruction()
Return the currently reconstructing thread object(s).
Definition: cxUsReconstructionServiceProxy.cpp:158
cx::OutputVolumeParams
Helper struct for sending and controlling output volume properties.
Definition: cxReconstructedOutputVolumeParams.h:39
cx::USReconstructInputData
Definition: cxUSReconstructInputData.h:48
cx::reportWarning
void reportWarning(QString msg)
Definition: cxLogger.cpp:70
cx::UsReconstructionService::getNullObject
static UsReconstructionServicePtr getNullObject()
Definition: cxUsReconstructionService.cpp:19
cx::UsReconstructionServiceProxy::selectData
virtual void selectData(QString filename, QString calFilesPath="")
Set input data for reconstruction.
Definition: cxUsReconstructionServiceProxy.cpp:93