Fraxinus  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
void newInputDataAvailable(QString mhdFileName)
virtual void setOutputVolumeParams(const OutputVolumeParams &par)
Control the output volume.
void inputDataSelected(QString mhdFileName)
Abstract interface for reconstruction algorithm.
virtual std::vector< PropertyPtr > getAlgoOptions()
Return control parameters for the currently selected algorithm, adjustable like getParams() ...
virtual std::set< cx::TimedAlgorithmPtr > getThreadedReconstruction()
Return the currently reconstructing thread object(s).
virtual void selectData(QString filename, QString calFilesPath="")
Set input data for reconstruction.
virtual XmlOptionFile getSettings()
Return the settings xml file where parameters are stored.
static UsReconstructionServicePtr getNullObject()
virtual ReconstructionMethodService * createAlgorithm()
Helper struct for sending and controlling output volume properties.
boost::shared_ptr< class Property > PropertyPtr
void reportWarning(QString msg)
Definition: cxLogger.cpp:70
virtual OutputVolumeParams getOutputVolumeParams() const
Return params controlling the output data. These are data-dependent.
virtual USReconstructInputData getSelectedFileData()
Return the currently selected input data.
virtual ReconstructCore::InputParams createCoreParameters()
virtual void newDataOnDisk(QString mhdFilename)
UsReconstructionServiceProxy(ctkPluginContext *pluginContext)
Helper class for listening to services being added, modified and removed.
void newInputDataPath(QString path)
virtual PropertyPtr getParam(QString uid)
Return one of the standard parameters.
Helper class for xml files used to store ssc/cx data.
virtual QString getSelectedFilename() const
Get the currently selected filename.
Namespace for all CustusX production code.