18 #include <QStringList> 35 mReconstructer(reconstructer)
46 mRecordSessions.clear();
52 mRecordSessions.push_back(session);
58 for(
int i = 0; i < mRecordSessions.size(); ++i)
60 if(mRecordSessions[i]->getUid() == session->getUid())
61 mRecordSessions.erase(mRecordSessions.begin() + i);
68 return mRecordSessions;
74 std::vector<RecordSessionPtr>::iterator it = mRecordSessions.begin();
75 for(; it != mRecordSessions.end(); ++it)
77 if((*it)->getUid() == uid)
85 QDomDocument doc = parentNode.ownerDocument();
86 QDomElement base = doc.createElement(
"stateManager");
87 parentNode.appendChild(base);
89 QDomElement sessionsNode = doc.createElement(
"recordSessions");
90 std::vector<RecordSessionPtr>::iterator it = mRecordSessions.begin();
91 for(; it != mRecordSessions.end(); ++it)
93 QDomElement sessionNode = doc.createElement(
"recordSession");
94 (*it)->addXml(sessionNode);
95 sessionsNode.appendChild(sessionNode);
97 base.appendChild(sessionsNode);
102 QDomNode recordsessionsNode = dataNode.namedItem(
"recordSessions");
103 QDomElement recodesessionNode = recordsessionsNode.firstChildElement(
"recordSession");
104 for (; !recodesessionNode.isNull(); recodesessionNode = recodesessionNode.nextSiblingElement(
"recordSession"))
108 session->parseXml(recodesessionNode);
121 std::vector<RecordSessionPtr>::iterator iter;
122 for (iter = recordsessions.begin(); iter != recordsessions.end(); ++iter)
124 QString index = (*iter)->getUid().split(
"_").front();
125 max = std::max(max, index.toInt());
136 QObject(parent), mPluginData(pluginData), mCurrentState(
AcquisitionService::sNOT_RUNNING),
142 this->checkIfReadySlot();
164 void Acquisition::checkIfReadySlot()
166 bool tracking = this->getServices()->tracking()->getState()>=
Tool::tsTRACKING;
167 ToolPtr tool = this->getServices()->tracking()->getActiveTool();
168 ToolPtr reference_frame = this->getServices()->tracking()->getReferenceTool();
169 if(tracking && reference_frame)
171 connect(reference_frame.get(), &
Tool::toolVisible,
this, &Acquisition::checkIfReadySlot, Qt::UniqueConnection);
173 QString mWhatsMissing;
174 mWhatsMissing.clear();
178 mWhatsMissing =
"<font color=green>Ready to record!</font><br>";
179 if (!tool || !tool->getVisible())
181 mWhatsMissing +=
"<font color=orange>Tool not visible</font><br>";
183 if(!reference_frame || !reference_frame->getVisible())
185 mWhatsMissing +=
"<font color=orange>Reference frame not visible.</font><br>";
190 mWhatsMissing.append(
"<font color=red>Need to start tracking.</font><br>");
194 this->setReady(tracking, mWhatsMissing);
197 void Acquisition::setReady(
bool val, QString text)
209 report(
"Already recording a session, stop before trying to start a new record session.");
213 mCurrentContext = context;
216 mLatestSession = session;
218 mLatestSession.reset(
new cx::RecordSession(mPluginData->getNewSessionId(), category));
220 mLatestSession->startNewInterval();
234 mLatestSession->stopLastInterval();
235 if (!mPluginData->getRecordSession(mLatestSession->getUid()))
236 mPluginData->addRecordSession(mLatestSession);
249 mLatestSession->cancelLastInterval();
250 mLatestSession.reset();
269 mCurrentState = newState;
Acqusition services abstract interface.
boost::shared_ptr< class UsReconstructionService > UsReconstructionServicePtr
void startPostProcessing()
boost::shared_ptr< class VisServices > VisServicesPtr
std::vector< RecordSessionPtr > getRecordSessions()
void removeRecordSession(RecordSessionPtr session)
void addXml(QDomNode &dataNode)
boost::shared_ptr< class AcquisitionData > AcquisitionDataPtr
void activeToolChanged(const QString &uId)
boost::shared_ptr< class RecordSession > RecordSessionPtr
AcquisitionService::STATE getState() const
virtual ~AcquisitionData()
void recordedSessionsChanged()
void addRecordSession(RecordSessionPtr session)
void startRecord(AcquisitionService::TYPES context, QString category, RecordSessionPtr session)
QString getInfoText(AcquisitionService::TYPES) const
AcquisitionDataPtr getPluginData()
void parseXml(QDomNode &dataNode)
void stopPostProcessing()
RecordSessionPtr getRecordSession(QString uid)
Acquisition(AcquisitionDataPtr pluginData, QObject *parent=0)
bool isReady(AcquisitionService::TYPES) const
void acquisitionStopped()
Namespace for all CustusX production code.
boost::shared_ptr< class Tool > ToolPtr