40 connect(mCore.get(), SIGNAL(
saveDataCompleted(QString)),
this, SLOT(checkIfReadySlot()));
45 connect(this->getServices()->tracking().
get(), SIGNAL(activeToolChanged(
const QString&)),
this, SLOT(checkIfReadySlot()));
46 connect(this->getServices()->video().
get(), SIGNAL(activeVideoSourceChanged()),
this, SLOT(checkIfReadySlot()));
49 connect(mBase.get(), SIGNAL(started()),
this, SLOT(recordStarted()));
50 connect(mBase.get(), SIGNAL(acquisitionStopped()),
this, SLOT(recordStopped()), Qt::QueuedConnection);
51 connect(mBase.get(), SIGNAL(cancelled()),
this, SLOT(recordCancelled()));
53 this->checkIfReadySlot();
63 return mBase->getPluginData()->getServices();
68 return mBase->getPluginData()->getReconstructer();
85 void USAcquisition::checkIfReadySlot()
87 bool tracking = this->getServices()->tracking()->getState()>=
Tool::tsTRACKING;
88 bool streaming = this->getServices()->video()->isConnected();
89 ToolPtr tool = this->getServices()->tracking()->getFirstProbe();
90 ToolPtr reference_frame = this->getServices()->tracking()->getReferenceTool();
91 if(tracking && reference_frame)
93 QObject::connect(reference_frame.get(), &
Tool::toolVisible,
this, &USAcquisition::checkIfReadySlot, Qt::UniqueConnection);
96 QString mWhatsMissing;
97 mWhatsMissing.clear();
99 if(tracking && streaming)
101 mWhatsMissing =
"<font color=green>Ready to record!</font><br>";
102 if (!tool || !tool->getVisible())
104 mWhatsMissing +=
"<font color=orange>Probe not visible.</font><br>";
106 if(!reference_frame || !reference_frame->getVisible())
108 mWhatsMissing +=
"<font color=orange>Reference frame not visible.</font><br>";
114 mWhatsMissing.append(
"<font color=red>Need to start tracking.</font><br>");
116 mWhatsMissing.append(
"<font color=red>Need to start streaming.</font><br>");
119 int saving = mCore->getNumberOfSavingThreads();
122 mWhatsMissing.append(QString(
"<font color=orange>Saving %1 acquisition data.</font><br>").arg(saving));
125 QStringList list = mWhatsMissing.split(
"<br>", QString::SkipEmptyParts);
126 mWhatsMissing = list.join(
"<br>");
130 mWhatsMissing.append(
"<br>");
133 this->setReady(streaming, mWhatsMissing);
136 void USAcquisition::setReady(
bool val, QString text)
146 return mCore->getNumberOfSavingThreads();
149 void USAcquisition::recordStarted()
156 ToolPtr tool = this->getServices()->tracking()->getFirstProbe();
157 mCore->setWriteColor(this->getWriteColor());
158 mCore->startRecord(mBase->getLatestSession(),
160 this->getServices()->tracking()->getReferenceTool(),
161 this->getRecordingVideoSources(tool),
162 this->getServices()->file());
165 void USAcquisition::recordStopped()
172 this->sendAcquisitionDataToReconstructer();
174 mCore->set_rMpr(this->getServices()->patient()->get_rMpr());
175 bool compress =
settings()->
value(
"Ultrasound/CompressAcquisition",
true).toBool();
176 QString baseFolder = this->getServices()->patient()->getActivePatientFolder();
177 mCore->startSaveData(baseFolder, compress);
179 mCore->clearRecording();
181 this->checkIfReadySlot();
184 void USAcquisition::recordCancelled()
186 mCore->cancelRecord();
189 void USAcquisition::sendAcquisitionDataToReconstructer()
191 mCore->set_rMpr(this->getServices()->patient()->get_rMpr());
193 VideoSourcePtr activeVideoSource = this->getServices()->video()->getActiveVideoSource();
194 if (activeVideoSource)
197 this->getReconstructer()->selectData(data);
202 std::vector<VideoSourcePtr> USAcquisition::getRecordingVideoSources(
ToolPtr tool)
204 std::vector<VideoSourcePtr> retval;
206 if (tool && tool->getProbe())
209 QStringList sources = probe->getAvailableVideoSources();
210 for (
unsigned i=0; i<sources.size(); ++i)
211 retval.push_back(probe->getRTSource(sources[i]));
215 retval = this->getServices()->video()->getVideoSources();
221 bool USAcquisition::getWriteColor()
223 PropertyPtr angio = this->getReconstructer()->getParam(
"Angio data");
224 bool writeColor = angio->getValueAsVariant().toBool()
225 || !
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
Namespace for all CustusX production code.
boost::shared_ptr< class Tool > ToolPtr