14 #include <QtConcurrentRun> 15 #include "boost/bind.hpp" 41 std::list<QFutureWatcher<QString>*>::iterator iter;
42 for (iter=mSaveThreads.begin(); iter!=mSaveThreads.end(); ++iter)
44 (*iter)->waitForFinished();
62 mRecordingTool = tool;
63 mReference = reference;
69 for (
unsigned i=0; i<video.size(); ++i)
75 QString(
"%1_%2").arg(session->getDescription()).arg(video[i]->getUid()),
78 videoRecorder->startRecord();
79 mVideoRecorder.push_back(videoRecorder);
87 for (
unsigned i=0; i<mVideoRecorder.size(); ++i)
91 for (
unsigned i=0; i<mVideoRecorder.size(); ++i)
94 mVideoRecorder[i]->completeSave();
101 report(
"Ultrasound acquisition cancelled.");
106 for (
unsigned i=0; i<mVideoRecorder.size(); ++i)
108 if (mVideoRecorder[i]->getSource()->getUid() == streamUid)
118 if (videoRecorderIndex>=mVideoRecorder.size())
122 videoRecorder->completeSave();
126 std::cout <<
"----------- " 127 "trackerMetadata : " << trackerMetadata.size() << std::endl;
130 std::vector<TimeInfo> imageTimestamps = videoRecorder->getTimestamps();
131 QString streamSessionName = mSession->getDescription()+
"_"+videoRecorder->getSource()->getUid();
139 referenceTrackerMetadata,
141 videoRecorder->getSource()->getUid(),
144 return reconstructData;
152 for (
unsigned i=0; i<mVideoRecorder.size(); ++i)
156 QString streamSessionName = mSession->getDescription()+
"_"+mVideoRecorder[i]->getSource()->getUid();
159 this->saveStreamSession(data, saveFolder, streamSessionName, compressImages);
165 mVideoRecorder.clear();
167 mRecordingTool.reset();
173 return mSaveThreads.size();
176 void USSavingRecorder::saveStreamSession(
USReconstructInputData reconstructData, QString saveFolder, QString streamSessionName,
bool compress)
180 fileMaker->setReconstructData(reconstructData);
183 QFuture<QString> fileMakerFuture =
184 QtConcurrent::run(boost::bind(
190 QFutureWatcher<QString>* fileMakerFutureWatcher =
new QFutureWatcher<QString>();
191 connect(fileMakerFutureWatcher, SIGNAL(finished()),
this, SLOT(fileMakerWriteFinished()));
192 fileMakerFutureWatcher->setFuture(fileMakerFuture);
193 mSaveThreads.push_back(fileMakerFutureWatcher);
197 void USSavingRecorder::fileMakerWriteFinished()
199 std::list<QFutureWatcher<QString>*>::iterator iter;
200 for (iter=mSaveThreads.begin(); iter!=mSaveThreads.end();)
202 if (!(*iter)->isFinished())
207 QString result = (*iter)->future().result();
210 iter = mSaveThreads.erase(iter);
void startSaveData(QString baseFolder, bool compressImages)
static std::map< double, ToolPositionMetadata > getToolHistory_metadata(ToolPtr tool, RecordSessionPtr session, bool verbose)
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)
void startRecord(RecordSessionPtr session, ToolPtr tool, ToolPtr reference, std::vector< VideoSourcePtr > video)
boost::shared_ptr< class SavingVideoRecorder > SavingVideoRecorderPtr
QString timestampSecondsFormat()
static TimedTransformMap getToolHistory_prMt(ToolPtr tool, RecordSessionPtr session, bool verbose)
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
Namespace for all CustusX production code.
boost::shared_ptr< class Tool > ToolPtr