44 bool silent = delta_pre_rMd.
mTemp;
51 if (delta_pre_rMd.
mFixed ==
"")
53 fixed = forest.
getNode(movingData->getParentSpace());
61 "Update Registration using\n" 64 "\tDelta matrix (rMd'=Delta*rMd)\n" 70 this->updateTransform(oldTime, allMovingData, delta_pre_rMd);
80 QString fixedAncestorUid = fixedAncestor.toElement().tagName();
82 QString newFixedSpace = fixedAncestorUid;
85 if (mSource.count(fixedAncestorUid) && mSource[fixedAncestorUid]->getParentSpace()==
"")
87 newFixedSpace = this->generateNewSpaceUid();
89 this->changeParentSpace(oldTime, mSource[fixedAncestorUid], newParentSpace);
92 QString movingBaseUid = movingBase.toElement().tagName();
94 if (mSource.count(movingBaseUid))
96 movingBaseUid = mSource[movingBaseUid]->getParentSpace();
101 this->changeParentSpace(oldTime, allMovingData, movingBaseUid, newParentSpace);
105 QString RegistrationApplicator::generateNewSpaceUid()
const 108 std::map<QString, DataPtr>::const_iterator iter;
109 for (iter = mSource.begin(); iter != mSource.end(); ++iter)
111 QStringList parentList =
qstring_cast(iter->second->getParentSpace()).split(
"_");
112 if (parentList.size() < 2)
114 max = std::max(max, parentList[1].toInt());
120 void RegistrationApplicator::updateTransform(QDateTime oldTime, std::vector<DataPtr> data,
RegistrationTransform delta_pre_rMd)
122 bool silent = delta_pre_rMd.
mTemp;
124 for (
unsigned i=0; i<data.size(); ++i)
127 newTransform.
mValue = delta_pre_rMd.
mValue * data[i]->get_rMd();
128 data[i]->get_rMd_History()->addOrUpdateRegistration(oldTime, newTransform);
131 report(
"Updated registration of data " + data[i]->getName());
135 void RegistrationApplicator::changeParentSpace(QDateTime oldTime, std::vector<DataPtr> data, QString oldParentSpace,
ParentSpace newParentSpace)
137 for (
unsigned i=0; i<data.size(); ++i)
139 if (data[i]->getParentSpace() != oldParentSpace)
141 this->changeParentSpace(oldTime, data[i], newParentSpace);
145 void RegistrationApplicator::changeParentSpace(QDateTime oldTime,
DataPtr data,
ParentSpace newParentSpace)
147 report(QString(
"Reset parent frame of %1 from [%2] to [%3].")
148 .arg(data->getName())
149 .arg(data->getParentSpace())
150 .arg(newParentSpace.
mUid));
152 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.