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);
boost::shared_ptr< class FileManagerService > FileManagerServicePtr
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)
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 startRecord(RecordSessionPtr session, ToolPtr tool, ToolPtr reference, std::vector< VideoSourcePtr > video, FileManagerServicePtr filemanager)
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