15 #include <boost/bind.hpp> 16 #include <ctkPluginContext.h> 34 #define M_PI 3.14159265358979323846 42 mPatientModelService(patientModelService),
43 mViewService(viewService)
49 connect(mParams.get(), SIGNAL(changedInputSettings()),
this, SLOT(setSettings()));
54 boost::bind(&UsReconstructionImplService::onServiceAdded,
this, _1),
55 boost::bind(&UsReconstructionImplService::onServiceModified,
this, _1),
56 boost::bind(&UsReconstructionImplService::onServiceRemoved,
this, _1)
59 mServiceListener->open();
71 void UsReconstructionImplService::patientChangedSlot()
73 this->
selectData(mPatientModelService->getActivePatientFolder() +
"/US_Acq/");
79 QString name = mParams->getParameter(
"Algorithm")->getValueAsVariant().toString();
82 return mServiceListener->getServiceFromName(name);
85 void UsReconstructionImplService::setSettings()
88 this->updateFromOriginalFileData();
95 if(!mOutputVolumeParams.
isValid())
97 reportError(
"Cannot reconstruct from invalid ultrasound data");
109 connect(executer.get(), SIGNAL(
reconstructFinished()),
this, SLOT(reconstructFinishedSlot()));
110 mExecuters.push_back(executer);
112 executer->startReconstruction(algo, par, fileData, mParams->getCreateBModeWhenAngio()->getValue());
117 std::set<cx::TimedAlgorithmPtr> retval;
118 for (
unsigned i=0; i<mExecuters.size(); ++i)
119 retval.insert(mExecuters[i]->getThread());
123 void UsReconstructionImplService::reconstructFinishedSlot()
125 mOriginalFileData.
mUsRaw->purgeAll();
127 for (
unsigned i=0; i<mExecuters.size(); ++i)
129 if (mExecuters[i]->getThread()->isFinished())
135 disconnect(executer.get(), SIGNAL(
reconstructFinished()),
this, SLOT(reconstructFinishedSlot()));
137 mExecuters.erase(mExecuters.begin()+i);
143 void UsReconstructionImplService::clearAll()
151 return mOutputVolumeParams;
156 mOutputVolumeParams = par;
162 if (mAlgoOptions.empty())
187 return mOriginalFileData;
192 return mParams->getParameter(uid);
197 if (filename.isEmpty())
212 mOriginalFileData = fileData;
213 this->updateFromOriginalFileData();
217 void UsReconstructionImplService::updateFromOriginalFileData()
219 if (!mOriginalFileData.
isValid())
225 if (preprocessor->getOutputVolumeParams().isValid())
226 mOutputVolumeParams = preprocessor->getOutputVolumeParams();
229 reportError(
"Input ultrasound data not valid for reconstruction");
239 par.
mAlgorithmUid = mParams->getAlgorithmAdapter()->getValue();
242 par.
mAngio = mParams->getAngioAdapter()->getValue();
249 par.
mMaskReduce = mParams->getMaskReduce()->getValue().toDouble();
250 par.
mOrientation = mParams->getOrientationAdapter()->getValue();
256 QStringList range = mParams->getAlgorithmAdapter()->getValueRange();
258 mParams->getAlgorithmAdapter()->setValueRange(range);
261 PropertyPtr algoName = mParams->getParameter(
"Algorithm");
262 if (algoName->getValueAsVariant().value<QString>().isEmpty())
263 algoName->setValueFromVariant(service->
getName());
268 reportWarning(
"ReconstructionMethodService modified... Do not know what to do. Contact developer.");
273 QStringList range = mParams->getAlgorithmAdapter()->getValueRange();
274 range.removeAll(service->
getName());
275 mParams->getAlgorithmAdapter()->setValueRange(range);
277 QString algoname = mParams->getParameter(
"Algorithm")->getValueAsVariant().toString();
278 if (algoname==service->
getName())
void newInputDataAvailable(QString mhdFileName)
Reader class for the US Acquisition files.
void inputDataSelected(QString mhdFileName)
boost::shared_ptr< class ReconstructionExecuter > ReconstructionExecuterPtr
void reportError(QString msg)
virtual ~UsReconstructionImplService()
virtual PropertyPtr getParam(QString uid)
Return one of the standard parameters.
Abstract interface for reconstruction algorithm.
virtual QString getSelectedFilename() const
Get the currently selected filename.
virtual std::set< cx::TimedAlgorithmPtr > getThreadedReconstruction()
Return the currently reconstructing thread object(s).
void reconstructFinished()
virtual void selectData(QString filename, QString calFilesPath="")
Set input data for reconstruction.
virtual void newDataOnDisk(QString mhdFilename)
UsReconstructionImplService(ctkPluginContext *pluginContext, PatientModelServicePtr patientModelService, ViewServicePtr viewService, XmlOptionFile settings)
Helper struct for sending and controlling output volume properties.
QDomElement getElement()
return the current element
virtual std::vector< PropertyPtr > getSettings(QDomElement root)=0
virtual std::vector< PropertyPtr > getAlgoOptions()
Return control parameters for the currently selected algorithm, adjustable like getParams() ...
boost::shared_ptr< class UsReconstructionFileReader > UsReconstructionFileReaderPtr
boost::shared_ptr< class Property > PropertyPtr
void reportWarning(QString msg)
Collection of reconstruction parameters.
boost::shared_ptr< class ReconstructPreprocessor > ReconstructPreprocessorPtr
virtual QString getName() const =0
boost::shared_ptr< class PatientModelService > PatientModelServicePtr
void reconstructStarted()
Settings * settings()
Shortcut for accessing the settings instance.
Algorithm part of reconstruction - no dependencies on parameter classes.
virtual void setOutputVolumeParams(const OutputVolumeParams &par)
Control the output volume.
void reconstructAboutToStart()
Helper class for listening to services being added, modified and removed.
virtual OutputVolumeParams getOutputVolumeParams() const
Return params controlling the output data. These are data-dependent.
virtual XmlOptionFile getSettings()
Return the settings xml file where parameters are stored.
virtual USReconstructInputData getSelectedFileData()
Return the currently selected input data.
void newInputDataPath(QString path)
virtual ReconstructionMethodService * createAlgorithm()
virtual void startReconstruction()
virtual ReconstructCore::InputParams createCoreParameters()
Helper class for xml files used to store ssc/cx data.
Namespace for all CustusX production code.