14 #include <QtConcurrentRun>
15 #include "boost/bind.hpp"
42 std::list<QFutureWatcher<QString>*>::iterator iter;
43 for (iter=mSaveThreads.begin(); iter!=mSaveThreads.end(); ++iter)
45 (*iter)->waitForFinished();
63 mRecordingTool = tool;
64 mReference = reference;
70 for (
unsigned i=0; i<video.size(); ++i)
76 QString(
"%1_%2").arg(session->getDescription()).arg(video[i]->getUid()),
81 videoRecorder->startRecord();
82 mVideoRecorder.push_back(videoRecorder);
90 for (
unsigned i=0; i<mVideoRecorder.size(); ++i)
94 for (
unsigned i=0; i<mVideoRecorder.size(); ++i)
97 mVideoRecorder[i]->completeSave();
104 report(
"Ultrasound acquisition cancelled.");
109 for (
unsigned i=0; i<mVideoRecorder.size(); ++i)
111 if (mVideoRecorder[i]->getSource()->getUid() == streamUid)
121 if (videoRecorderIndex>=mVideoRecorder.size())
125 videoRecorder->completeSave();
129 std::cout <<
"----------- "
130 "trackerMetadata : " << trackerMetadata.size() << std::endl;
133 std::vector<TimeInfo> imageTimestamps = videoRecorder->getTimestamps();
134 QString streamSessionName = mSession->getDescription()+
"_"+videoRecorder->getSource()->getUid();
142 referenceTrackerMetadata,
144 videoRecorder->getSource()->getUid(),
147 return reconstructData;
155 for (
unsigned i=0; i<mVideoRecorder.size(); ++i)
159 QString streamSessionName = mSession->getDescription()+
"_"+mVideoRecorder[i]->getSource()->getUid();
162 this->saveStreamSession(data, saveFolder, streamSessionName, compressImages);
168 mVideoRecorder.clear();
170 mRecordingTool.reset();
176 return mSaveThreads.size();
179 void USSavingRecorder::saveStreamSession(
USReconstructInputData reconstructData, QString saveFolder, QString streamSessionName,
bool compress)
183 fileMaker->setReconstructData(reconstructData);
186 QFuture<QString> fileMakerFuture =
187 QtConcurrent::run(boost::bind(
193 QFutureWatcher<QString>* fileMakerFutureWatcher =
new QFutureWatcher<QString>();
194 connect(fileMakerFutureWatcher, SIGNAL(finished()),
this, SLOT(fileMakerWriteFinished()));
195 fileMakerFutureWatcher->setFuture(fileMakerFuture);
196 mSaveThreads.push_back(fileMakerFutureWatcher);
200 void USSavingRecorder::fileMakerWriteFinished()
202 std::list<QFutureWatcher<QString>*>::iterator iter;
203 for (iter=mSaveThreads.begin(); iter!=mSaveThreads.end();)
205 if (!(*iter)->isFinished())
210 QString result = (*iter)->future().result();
213 iter = mSaveThreads.erase(iter);