50 mCores = this->createCores(algo, par, createBModeWhenAngio);
52 std::vector<bool> angio;
53 for (
unsigned i=0; i<mCores.size(); ++i)
54 angio.push_back(mCores[i]->getInputParams().mAngio);
56 std::vector<cx::ProcessedUSInputDataPtr> processedInput = preprocessor->createProcessedInput(angio);
58 for (
unsigned i=0; i<mCores.size(); ++i)
60 mCores[i]->initialize(processedInput[i], preprocessor->getOutputVolumeParams());
62 for (
unsigned i=0; i<mCores.size(); ++i)
64 mCores[i]->reconstruct();
72 reportError(
"Reconstruct Executer can only be run once. Ignoring start.");
79 mCores = this->createCores(algo, par, createBModeWhenAngio);
84 this->launch(algorithm);
89 std::vector<cx::ImagePtr> retval;
90 if (mPipeline && !mPipeline->isFinished())
93 for (
unsigned i=0; i<mCores.size(); ++i)
94 retval.push_back(mCores[i]->getOutput());
108 cx::CompositeTimedAlgorithmPtr ReconstructionExecuter::assembleReconstructionPipeline(std::vector<ReconstructCorePtr> cores, ReconstructCore::InputParams par, USReconstructInputData fileData)
116 if(this->canCoresRunInParallel(cores) && cores.size()>1)
119 pipeline->append(parallel);
121 reportDebug(
"Running reconstruction cores in parallel.");
124 for (
unsigned i=0; i<cores.size(); ++i)
130 bool ReconstructionExecuter::canCoresRunInParallel(std::vector<ReconstructCorePtr> cores)
132 bool parallelizable =
true;
134 std::vector<ReconstructCorePtr>::iterator it;
135 for(it = cores.begin(); it != cores.end(); ++it)
136 parallelizable = parallelizable && (it->get()->getInputParams().mAlgorithmUid ==
"PNN");
138 return parallelizable;
141 ReconstructPreprocessorPtr ReconstructionExecuter::createPreprocessor(ReconstructCore::InputParams par, USReconstructInputData fileData)
144 retval->initialize(par, fileData);
149 std::vector<ReconstructCorePtr> ReconstructionExecuter::createCores(ReconstructionMethodService* algo, ReconstructCore::InputParams par,
bool createBModeWhenAngio)
151 std::vector<ReconstructCorePtr> retval;
153 if (createBModeWhenAngio && par.mAngio)
157 retval.push_back(core);
158 core = this->createCore(par, algo);
160 retval.push_back(core);
167 retval.push_back(core);
173 ReconstructCorePtr ReconstructionExecuter::createCore(ReconstructCore::InputParams par, ReconstructionMethodService* algo)
176 retval->initialize(par, algo);
180 ReconstructCorePtr ReconstructionExecuter::createBModeCore(ReconstructCore::InputParams par, ReconstructionMethodService* algo)
184 par.mTransferFunctionPreset =
"US B-Mode";
185 retval->initialize(par, algo);
boost::shared_ptr< class CompositeTimedAlgorithm > CompositeTimedAlgorithmPtr
void reportError(QString msg)
Abstract interface for reconstruction algorithm.
static ThreadedTimedReconstructCorePtr create(PatientModelServicePtr patientModelService, VisualizationServicePtr visualizationService, ReconstructCorePtr reconstructer)
void startReconstruction(ReconstructionMethodService *algo, ReconstructCore::InputParams par, USReconstructInputData fileData, bool createBModeWhenAngio)
void reconstructAboutToStart()
emitted before reconstruction threads are fired
boost::shared_ptr< class TimedBaseAlgorithm > TimedAlgorithmPtr
static ThreadedTimedReconstructPreprocessorPtr create(PatientModelServicePtr patientModelService, ReconstructPreprocessorPtr input, std::vector< ReconstructCorePtr > cores)
std::vector< cx::ImagePtr > getResult()
void reportWarning(QString msg)
boost::shared_ptr< class ReconstructPreprocessor > ReconstructPreprocessorPtr
void startNonThreadedReconstruction(ReconstructionMethodService *algo, ReconstructCore::InputParams par, USReconstructInputData fileData, bool createBModeWhenAngio)
boost::shared_ptr< CompositeParallelTimedAlgorithm > CompositeParallelTimedAlgorithmPtr
void reconstructFinished()
cx::TimedAlgorithmPtr getThread()
Return the currently reconstructing thread object.
boost::shared_ptr< CompositeSerialTimedAlgorithm > CompositeSerialTimedAlgorithmPtr
boost::shared_ptr< class ReconstructCore > ReconstructCorePtr
void reportDebug(QString msg)
void reconstructStarted()