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));
164 void USAcquisition::recordStopped()
171 this->sendAcquisitionDataToReconstructer();
173 mCore->set_rMpr(this->getServices()->patient()->get_rMpr());
174 bool compress =
settings()->
value(
"Ultrasound/CompressAcquisition",
true).toBool();
175 QString baseFolder = this->getServices()->patient()->getActivePatientFolder();
176 mCore->startSaveData(baseFolder, compress);
178 mCore->clearRecording();
180 this->checkIfReadySlot();
183 void USAcquisition::recordCancelled()
185 mCore->cancelRecord();
188 void USAcquisition::sendAcquisitionDataToReconstructer()
190 mCore->set_rMpr(this->getServices()->patient()->get_rMpr());
192 VideoSourcePtr activeVideoSource = this->getServices()->video()->getActiveVideoSource();
193 if (activeVideoSource)
196 this->getReconstructer()->selectData(data);
201 std::vector<VideoSourcePtr> USAcquisition::getRecordingVideoSources(
ToolPtr tool)
203 std::vector<VideoSourcePtr> retval;
205 if (tool && tool->getProbe())
208 QStringList sources = probe->getAvailableVideoSources();
209 for (
unsigned i=0; i<sources.size(); ++i)
210 retval.push_back(probe->getRTSource(sources[i]));
214 retval = this->getServices()->video()->getVideoSources();
220 bool USAcquisition::getWriteColor()
222 PropertyPtr angio = this->getReconstructer()->getParam(
"Angio data");
223 bool writeColor = angio->getValueAsVariant().toBool()
224 || !
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