65 bool silent = delta_pre_rMd.
mTemp;
72 if (delta_pre_rMd.
mFixed ==
"")
74 fixed = forest.
getNode(movingData->getParentSpace());
82 "Update Registration using\n" 85 "\tDelta matrix (rMd'=Delta*rMd)\n" 91 this->updateTransform(oldTime, allMovingData, delta_pre_rMd);
101 QString fixedAncestorUid = fixedAncestor.toElement().tagName();
103 QString newFixedSpace = fixedAncestorUid;
106 if (mSource.count(fixedAncestorUid) && mSource[fixedAncestorUid]->getParentSpace()==
"")
108 newFixedSpace = this->generateNewSpaceUid();
110 this->changeParentSpace(oldTime, mSource[fixedAncestorUid], newParentSpace);
113 QString movingBaseUid = movingBase.toElement().tagName();
115 if (mSource.count(movingBaseUid))
117 movingBaseUid = mSource[movingBaseUid]->getParentSpace();
122 this->changeParentSpace(oldTime, allMovingData, movingBaseUid, newParentSpace);
126 QString RegistrationApplicator::generateNewSpaceUid()
const 129 std::map<QString, DataPtr>::const_iterator iter;
130 for (iter = mSource.begin(); iter != mSource.end(); ++iter)
132 QStringList parentList =
qstring_cast(iter->second->getParentSpace()).split(
"_");
133 if (parentList.size() < 2)
135 max = std::max(max, parentList[1].toInt());
141 void RegistrationApplicator::updateTransform(QDateTime oldTime, std::vector<DataPtr> data,
RegistrationTransform delta_pre_rMd)
143 bool silent = delta_pre_rMd.
mTemp;
145 for (
unsigned i=0; i<data.size(); ++i)
148 newTransform.
mValue = delta_pre_rMd.
mValue * data[i]->get_rMd();
149 data[i]->get_rMd_History()->addOrUpdateRegistration(oldTime, newTransform);
152 report(
"Updated registration of data " + data[i]->getName());
156 void RegistrationApplicator::changeParentSpace(QDateTime oldTime, std::vector<DataPtr> data, QString oldParentSpace,
ParentSpace newParentSpace)
158 for (
unsigned i=0; i<data.size(); ++i)
160 if (data[i]->getParentSpace() != oldParentSpace)
162 this->changeParentSpace(oldTime, data[i], newParentSpace);
166 void RegistrationApplicator::changeParentSpace(QDateTime oldTime,
DataPtr data,
ParentSpace newParentSpace)
168 report(QString(
"Reset parent frame of %1 from [%2] to [%3].")
169 .arg(data->getName())
170 .arg(data->getParentSpace())
171 .arg(newParentSpace.
mUid));
173 data->get_rMd_History()->updateParentSpace(oldTime, newParentSpace);
QString qstring_cast(const T &val)
QDomNode getOldestAncestor(QDomNode node)
Definition of a parent space event.
virtual void updateRegistration(QDateTime oldTime, RegistrationTransform deltaTransform)
A graph combining Space dependencies between all Data.Relations between coordinate spaces among Data ...
QString mUid
parent frame uid
std::vector< DataPtr > getDataFromDescendantsAndSelf(QDomNode node)
boost::shared_ptr< class Data > DataPtr
RegistrationApplicator(const std::map< QString, DataPtr > &source)
QDomNode getNode(QString frame)
~RegistrationApplicator()
QDomNode getOldestAncestorNotCommonToRef(QDomNode child, QDomNode ref)
Namespace for all CustusX production code.