48 #ifndef _MIRA_TRANSFORMER_H_ 49 #define _MIRA_TRANSFORMER_H_ 56 #include <boost/thread/mutex.hpp> 88 static const int MAX_TREE_DEPTH = 1000;
110 bool empty()
const {
return inverse.empty() && forward.empty(); }
134 bool addLink(AbstractNodePtr child, AbstractNodePtr parent);
141 void removeLink(AbstractNodePtr child, AbstractNodePtr parent);
148 std::list<AbstractNodePtr> getNodes();
154 std::list<std::pair<AbstractNodePtr, AbstractNodePtr>> getLinks();
160 const std::list<AbstractNodePtr> getRootNodes();
168 void getTransformChain(AbstractNodePtr target, AbstractNodePtr source,
176 bool isTransformAvailable(AbstractNodePtr target, AbstractNodePtr source);
189 void addNode(AbstractNodePtr node);
195 AbstractNodePtr getNode(
const std::string& nodeID);
207 AbstractNodePtr collectNodesUpwardsToRoot(AbstractNodePtr node,
208 std::list<AbstractNodePtr>& oNodes);
249 template <
typename TNode>
288 Chain chain1, chain2;
302 template<
typename Transform,
typename Filter>
304 const Time& targetTime,
const Time& sourceTime,
308 return getTransform<Transform>(desc.
chain1, targetTime, filter);
310 return getTransform<Transform>(desc.
chain2, sourceTime, filter) *
311 getTransform<Transform>(desc.
chain1, targetTime, filter);
315 template<
typename Transform>
317 const Time& targetTime,
const Time& sourceTime)
319 return getTransform<Transform>(desc, targetTime, sourceTime,
325 template<
typename Transform,
typename Filter>
329 return getTransform<Transform>(desc, time, time, filter);
333 template<
typename Transform>
336 return getTransform<Transform>(desc, time,
347 template<
typename Transform,
typename Filter>
352 return getTransform<Transform>(desc, time, filter);
356 template<
typename Transform>
359 return getTransform<Transform>(target, source, time,
372 template<
typename Transform,
typename Filter>
375 NodePtr fixed, Filter&& filter)
378 return getTransform<Transform>(desc, targetTime, sourceTime, filter);
382 template<
typename Transform>
387 return getTransform<Transform>(target, targetTime,
388 source, sourceTime, fixed,
428 template<
typename Transform,
typename Filter>
430 const Transform& transform,
431 const Time& time, Filter&& filter)
471 "Cannot infer the transformation since all paths from '" <<
472 node->
getID() <<
"' to source '" << source->
getID() <<
"' " 473 "or target '" << target->
getID() <<
"' go via " 474 "the link that should be inferred.");
477 Transform y = getTransform<Transform>(node_source, time, filter);
484 Transform x = getTransform<Transform>(node_target, time, filter);
486 return x*transform.inverse()*y.inverse();
500 Transform y = getTransform<Transform>(node_target, time, filter);
507 Transform x = getTransform<Transform>(node_source, time, filter);
509 return x * transform * y.inverse();
514 template<
typename Transform>
516 const Transform& transform,
const Time& time)
518 return inferTransform<Transform>(node, target, source, transform, time,
536 return static_cast<Node*
>(node);
543 template<
typename Transform,
typename Filter>
546 Transform finalTransform;
550 finalTransform*=
castNode(n)->template getTransform<Transform>(time, filter).inverse();
554 finalTransform*=
castNode(n)->template getTransform<Transform>(time, filter);
556 return finalTransform;
572 template <
typename T,
int D,
template <
typename T_,
int D_>
class TTransform = RigidTransform>
Macro for iterating over all elements in a container.
1D nearest neighbor interpolator.
Definition: NearestNeighborInterpolator.h:68
specialize cv::DataType for our ImgPixel and inherit from cv::DataType<Vec>
Definition: IOService.h:67
#define MIRA_DEFINE_SERIALIZABLE_EXCEPTION(Ex, Base)
Macro for easily defining a new serializable exception class.
Definition: Exceptions.h:66
#define MIRA_THROW(ex, msg)
Macro for throwing an exception.
Definition: Exception.h:82
Wrapper class for boost::posix_time::ptime for adding more functionality to it.
Definition: Time.h:418
Commonly used exception classes.
Filter that returns the nearest neighbor.
#define foreach_reverse(i, c)
The macro can be used similar to foreach, but the containers are traversed in reverse order...
Definition: Foreach.h:110