61 connect(mCore.get(), SIGNAL(
saveDataCompleted(QString)),
this, SLOT(checkIfReadySlot()));
66 connect(this->getServices()->getToolManager().
get(), SIGNAL(activeToolChanged(
const QString&)),
this, SLOT(checkIfReadySlot()));
67 connect(this->getServices()->getVideoService().
get(), SIGNAL(activeVideoSourceChanged()),
this, SLOT(checkIfReadySlot()));
68 connect(this->getServices()->getVideoService().
get(), &
VideoService::connected,
this, &USAcquisition::checkIfReadySlot);
70 connect(mBase.get(), SIGNAL(started()),
this, SLOT(recordStarted()));
71 connect(mBase.get(), SIGNAL(acquisitionStopped()),
this, SLOT(recordStopped()), Qt::QueuedConnection);
72 connect(mBase.get(), SIGNAL(cancelled()),
this, SLOT(recordCancelled()));
74 this->checkIfReadySlot();
84 return mBase->getPluginData()->getServices();
89 return mBase->getPluginData()->getReconstructer();
92 void USAcquisition::checkIfReadySlot()
94 bool tracking = this->getServices()->getToolManager()->getState()>=
Tool::tsTRACKING;
95 bool streaming = this->getServices()->getVideoService()->isConnected();
96 ToolPtr tool = this->getServices()->getToolManager()->getFirstProbe();
98 QString mWhatsMissing;
99 mWhatsMissing.clear();
101 if(tracking && streaming)
103 mWhatsMissing =
"<font color=green>Ready to record!</font><br>";
104 if (!tool || !tool->getVisible())
106 mWhatsMissing +=
"<font color=orange>Probe not visible</font><br>";
112 mWhatsMissing.append(
"<font color=red>Need to start tracking.</font><br>");
114 mWhatsMissing.append(
"<font color=red>Need to start streaming.</font><br>");
117 int saving = mCore->getNumberOfSavingThreads();
120 mWhatsMissing.append(QString(
"<font color=orange>Saving %1 acquisition data.</font><br>").arg(saving));
123 QStringList list = mWhatsMissing.split(
"<br>", QString::SkipEmptyParts);
124 mWhatsMissing = list.join(
"<br>");
128 mWhatsMissing.append(
"<br>");
131 this->setReady(streaming, mWhatsMissing);
134 void USAcquisition::setReady(
bool val, QString text)
140 mBase->cancelRecord();
147 return mCore->getNumberOfSavingThreads();
150 void USAcquisition::recordStarted()
154 ToolPtr tool = this->getServices()->getToolManager()->getFirstProbe();
155 mCore->setWriteColor(this->getWriteColor());
156 mCore->startRecord(mBase->getLatestSession(), tool, this->getRecordingVideoSources(tool));
159 void USAcquisition::recordStopped()
163 this->sendAcquisitionDataToReconstructer();
165 mCore->set_rMpr(this->getServices()->getPatientService()->get_rMpr());
166 bool compress =
settings()->
value(
"Ultrasound/CompressAcquisition",
true).toBool();
167 QString baseFolder = this->getServices()->getPatientService()->getActivePatientFolder();
168 mCore->startSaveData(baseFolder, compress);
170 mCore->clearRecording();
172 this->checkIfReadySlot();
175 void USAcquisition::recordCancelled()
177 mCore->cancelRecord();
180 void USAcquisition::sendAcquisitionDataToReconstructer()
182 mCore->set_rMpr(this->getServices()->getPatientService()->get_rMpr());
184 VideoSourcePtr activeVideoSource = this->getServices()->getVideoService()->getActiveVideoSource();
185 if (activeVideoSource)
187 USReconstructInputData data = mCore->getDataForStream(activeVideoSource->getUid());
188 this->getReconstructer()->selectData(data);
193 std::vector<VideoSourcePtr> USAcquisition::getRecordingVideoSources(
ToolPtr tool)
195 std::vector<VideoSourcePtr> retval;
197 if (tool && tool->getProbe())
200 QStringList sources = probe->getAvailableVideoSources();
201 for (
unsigned i=0; i<sources.size(); ++i)
202 retval.push_back(probe->getRTSource(sources[i]));
206 retval = this->getServices()->getVideoService()->getVideoSources();
212 bool USAcquisition::getWriteColor()
214 PropertyPtr angio = this->getReconstructer()->getParam(
"Angio data");
215 bool writeColor = angio->getValueAsVariant().toBool()
216 || !
settings()->
value(
"Ultrasound/8bitAcquisitionData").toBool();
boost::shared_ptr< class UsReconstructionService > UsReconstructionServicePtr
void saveDataCompleted(QString mhdFilename)
emitted when data has been saved to file
boost::shared_ptr< class VisServices > VisServicesPtr
Record and save ultrasound data.Use the start/stop pair to record video from the input streams during...
QVariant value(const QString &key, const QVariant &defaultValue=QVariant()) const
USAcquisition(AcquisitionPtr base, QObject *parent=0)
boost::shared_ptr< class Acquisition > AcquisitionPtr
boost::shared_ptr< Probe > ProbePtr
boost::shared_ptr< class Property > PropertyPtr
boost::shared_ptr< class VideoSource > VideoSourcePtr
Settings * settings()
Shortcut for accessing the settings instance.
void acquisitionDataReady()
emitted when data is acquired and sent to the reconstruction module
int getNumberOfSavingThreads() const
boost::shared_ptr< class Tool > ToolPtr