61 connect(mCore.get(), SIGNAL(
saveDataCompleted(QString)),
this, SLOT(checkIfReadySlot()));
66 connect(this->getServices()->tracking().
get(), SIGNAL(activeToolChanged(
const QString&)),
this, SLOT(checkIfReadySlot()));
67 connect(this->getServices()->video().
get(), SIGNAL(activeVideoSourceChanged()),
this, SLOT(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();
106 void USAcquisition::checkIfReadySlot()
108 bool tracking = this->getServices()->tracking()->getState()>=
Tool::tsTRACKING;
109 bool streaming = this->getServices()->video()->isConnected();
110 ToolPtr tool = this->getServices()->tracking()->getFirstProbe();
111 ToolPtr reference_frame = this->getServices()->tracking()->getReferenceTool();
112 if(tracking && reference_frame)
114 QObject::connect(reference_frame.get(), &
Tool::toolVisible,
this, &USAcquisition::checkIfReadySlot, Qt::UniqueConnection);
117 QString mWhatsMissing;
118 mWhatsMissing.clear();
120 if(tracking && streaming)
122 mWhatsMissing =
"<font color=green>Ready to record!</font><br>";
123 if (!tool || !tool->getVisible())
125 mWhatsMissing +=
"<font color=orange>Probe not visible.</font><br>";
127 if(!reference_frame || !reference_frame->getVisible())
129 mWhatsMissing +=
"<font color=orange>Reference frame not visible.</font><br>";
135 mWhatsMissing.append(
"<font color=red>Need to start tracking.</font><br>");
137 mWhatsMissing.append(
"<font color=red>Need to start streaming.</font><br>");
140 int saving = mCore->getNumberOfSavingThreads();
143 mWhatsMissing.append(QString(
"<font color=orange>Saving %1 acquisition data.</font><br>").arg(saving));
146 QStringList list = mWhatsMissing.split(
"<br>", QString::SkipEmptyParts);
147 mWhatsMissing = list.join(
"<br>");
151 mWhatsMissing.append(
"<br>");
154 this->setReady(streaming, mWhatsMissing);
157 void USAcquisition::setReady(
bool val, QString text)
167 return mCore->getNumberOfSavingThreads();
170 void USAcquisition::recordStarted()
177 ToolPtr tool = this->getServices()->tracking()->getFirstProbe();
178 mCore->setWriteColor(this->getWriteColor());
179 mCore->startRecord(mBase->getLatestSession(),
181 this->getServices()->tracking()->getReferenceTool(),
182 this->getRecordingVideoSources(tool));
185 void USAcquisition::recordStopped()
192 this->sendAcquisitionDataToReconstructer();
194 mCore->set_rMpr(this->getServices()->patient()->get_rMpr());
195 bool compress =
settings()->
value(
"Ultrasound/CompressAcquisition",
true).toBool();
196 QString baseFolder = this->getServices()->patient()->getActivePatientFolder();
197 mCore->startSaveData(baseFolder, compress);
199 mCore->clearRecording();
201 this->checkIfReadySlot();
204 void USAcquisition::recordCancelled()
206 mCore->cancelRecord();
209 void USAcquisition::sendAcquisitionDataToReconstructer()
211 mCore->set_rMpr(this->getServices()->patient()->get_rMpr());
213 VideoSourcePtr activeVideoSource = this->getServices()->video()->getActiveVideoSource();
214 if (activeVideoSource)
216 USReconstructInputData data = mCore->getDataForStream(activeVideoSource->getUid());
217 this->getReconstructer()->selectData(data);
222 std::vector<VideoSourcePtr> USAcquisition::getRecordingVideoSources(
ToolPtr tool)
224 std::vector<VideoSourcePtr> retval;
226 if (tool && tool->getProbe())
229 QStringList sources = probe->getAvailableVideoSources();
230 for (
unsigned i=0; i<sources.size(); ++i)
231 retval.push_back(probe->getRTSource(sources[i]));
235 retval = this->getServices()->video()->getVideoSources();
241 bool USAcquisition::getWriteColor()
243 PropertyPtr angio = this->getReconstructer()->getParam(
"Angio data");
244 bool writeColor = angio->getValueAsVariant().toBool()
245 || !
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
bool isReady(AcquisitionService::TYPES context) const
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
QString getInfoText(AcquisitionService::TYPES context) const
boost::shared_ptr< class Tool > ToolPtr