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)
126 RegistrationTransform newTransform = delta_pre_rMd;
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);