35 #include <QtConcurrentRun>
36 #include "boost/bind.hpp"
62 std::list<QFutureWatcher<QString>*>::iterator iter;
63 for (iter=mSaveThreads.begin(); iter!=mSaveThreads.end(); ++iter)
65 (*iter)->waitForFinished();
83 mRecordingTool = tool;
89 for (
unsigned i=0; i<video.size(); ++i)
95 QString(
"%1_%2").arg(session->getDescription()).arg(video[i]->getUid()),
98 videoRecorder->startRecord();
99 mVideoRecorder.push_back(videoRecorder);
107 for (
unsigned i=0; i<mVideoRecorder.size(); ++i)
111 for (
unsigned i=0; i<mVideoRecorder.size(); ++i)
114 mVideoRecorder[i]->completeSave();
122 report(
"Ultrasound acquisition cancelled.");
127 for (
unsigned i=0; i<mVideoRecorder.size(); ++i)
129 if (mVideoRecorder[i]->getSource()->getUid() == streamUid)
139 if (videoRecorderIndex>=mVideoRecorder.size())
143 videoRecorder->completeSave();
147 std::vector<double> imageTimestamps = videoRecorder->getTimestamps();
148 QString streamSessionName = mSession->getDescription()+
"_"+videoRecorder->getSource()->getUid();
158 return reconstructData;
168 for (
unsigned i=0; i<mVideoRecorder.size(); ++i)
172 QString streamSessionName = mSession->getDescription()+
"_"+mVideoRecorder[i]->getSource()->getUid();
175 this->saveStreamSession(data, saveFolder, streamSessionName, compressImages);
183 mVideoRecorder.clear();
185 mRecordingTool.reset();
191 return mSaveThreads.size();
194 void USSavingRecorder::saveStreamSession(
USReconstructInputData reconstructData, QString saveFolder, QString streamSessionName,
bool compress)
198 fileMaker->setReconstructData(reconstructData);
201 QFuture<QString> fileMakerFuture =
202 QtConcurrent::run(boost::bind(
208 QFutureWatcher<QString>* fileMakerFutureWatcher =
new QFutureWatcher<QString>();
209 fileMakerFutureWatcher->setFuture(fileMakerFuture);
210 connect(fileMakerFutureWatcher, SIGNAL(finished()),
this, SLOT(fileMakerWriteFinished()));
211 mSaveThreads.push_back(fileMakerFutureWatcher);
215 void USSavingRecorder::fileMakerWriteFinished()
217 std::list<QFutureWatcher<QString>*>::iterator iter;
218 for (iter=mSaveThreads.begin(); iter!=mSaveThreads.end(); ++iter)
220 if (!(*iter)->isFinished())
222 QString result = (*iter)->future().result();
224 iter = mSaveThreads.erase(iter);
void startSaveData(QString baseFolder, bool compressImages)
Transform3D Transform3D
Transform3D is a representation of an affine 3D transform.
Handles writing files in the format the us reconstruction algorithm wants them.
QString writeToNewFolder(QString path, bool compression)
boost::shared_ptr< class SavingVideoRecorder > SavingVideoRecorderPtr
void startRecord(RecordSessionPtr session, ToolPtr tool, std::vector< VideoSourcePtr > video)
static TimedTransformMap getToolHistory_prMt(ToolPtr tool, RecordSessionPtr session)
QString timestampSecondsFormat()
void set_rMpr(Transform3D rMpr)
boost::shared_ptr< class RecordSession > RecordSessionPtr
static QString getCachePath()
return path to a folder that is used during execution, will be cleared at start and stop...
void setWriteColor(bool on)
size_t getNumberOfSavingThreads() const
static QString createFolder(QString patientFolder, QString sessionDescription)
void reportSuccess(QString msg)
virtual ~USSavingRecorder()
void saveDataCompleted(QString mhdFilename)
emitted when data has been saved to file
Recorder for a VideoSource.
boost::shared_ptr< class UsReconstructionFileMaker > UsReconstructionFileMakerPtr
USReconstructInputData getDataForStream(QString streamUid)
boost::shared_ptr< class CachedImageDataContainer > CachedImageDataContainerPtr
static QString createUniqueFolder(QString patientFolder, QString sessionDescription)
std::map< double, Transform3D > TimedTransformMap
boost::shared_ptr< class Tool > ToolPtr