aimsdata  5.1.2
Neuroimaging data handling
transformationgraph3d.h
Go to the documentation of this file.
1 /* This software and supporting documentation are distributed by
2  * Institut Federatif de Recherche 49
3  * CEA/NeuroSpin, Batiment 145,
4  * 91191 Gif-sur-Yvette cedex
5  * France
6  *
7  * This software is governed by the CeCILL-B license under
8  * French law and abiding by the rules of distribution of free software.
9  * You can use, modify and/or redistribute the software under the
10  * terms of the CeCILL-B license as circulated by CEA, CNRS
11  * and INRIA at the following URL "http://www.cecill.info".
12  *
13  * As a counterpart to the access to the source code and rights to copy,
14  * modify and redistribute granted by the license, users are provided only
15  * with a limited warranty and the software's author, the holder of the
16  * economic rights, and the successive licensors have only limited
17  * liability.
18  *
19  * In this respect, the user's attention is drawn to the risks associated
20  * with loading, using, modifying and/or developing or reproducing the
21  * software by the user in light of its specific status of free software,
22  * that may mean that it is complicated to manipulate, and that also
23  * therefore means that it is reserved for developers and experienced
24  * professionals having in-depth computer knowledge. Users are therefore
25  * encouraged to load and test the software's suitability as regards their
26  * requirements in conditions enabling the security of their systems and/or
27  * data to be ensured and, more generally, to use and operate it in the
28  * same conditions as regards security.
29  *
30  * The fact that you are presently reading this means that you have had
31  * knowledge of the CeCILL-B license and that you accept its terms.
32  */
33 
34 #ifndef AIMS_TRANSFORMATION_TRANSFORMATIONGRAPH3D_H
35 #define AIMS_TRANSFORMATION_TRANSFORMATIONGRAPH3D_H
36 
37 #include <graph/graph/graph.h>
39 
40 
41 namespace aims
42 {
43 
91  {
92  public:
95 
99  void updateIds();
101  Vertex* referentialById( const std::string & id ) const;
103  Edge* transformationById( const std::string & id ) const;
105  static std::string referential( const Vertex *v );
112  const Edge *edge );
119  const std::string & id ) const;
120 
125  Edge* getTransformation( const std::string & src_ref,
126  const std::string & dst_ref ) const;
136  Edge* getTransformation( const std::string & src_ref,
137  const std::string & dst_ref,
138  bool allow_compose );
143  Edge* getTransformation( const Vertex *src_ref,
144  const Vertex *dst_ref ) const;
155  Vertex *dst_ref,
156  bool allow_compose );
157 
160  const Vertex *dst_ref ) const;
162  Edge *getTransformation_raw( const std::string & src_ref,
163  const std::string & dst_ref ) const;
164 
179  Edge *registerTransformation( const std::string & src_ref,
180  const std::string & dst_ref,
182  bool deduced=false );
183  Edge *registerTransformation( Vertex *src_ref, Vertex *dst_ref,
185  bool deduced=false );
186  Edge *registerTransformation( const std::string & src_ref,
187  const std::string & dst_ref,
188  const std::string & filename );
189  Edge *registerTransformation( Vertex *src_ref, Vertex *dst_ref,
190  const std::string & filename );
191 
250  const std::string & dirname );
265  carto::Object asDict( bool affine_only = false, bool allow_read = false,
266  bool embed_affines = false ) const;
272  void clearCache( bool chain_only=false );
283  void registerInverseTransformations( bool loadAffines = false );
284  std::list<Edge *> loadAffineTransformations();
285 
295  const Vertex *src_ref, const Vertex *dst_ref ) const;
297  const std::string & src_ref, const std::string & dst_ref ) const;
298 
300  loadTransformation( Edge *edge, bool affine_only=false ) const;
301 
302  private:
303  mutable std::map<std::string, Vertex *> _refs_by_id;
304  mutable std::map<std::string, Edge *> _tr_by_id;
305  std::set<std::pair<const Vertex *, const Vertex *> > _disconnected;
306 
307  };
308 
309 }
310 
311 namespace carto
312 {
313 
314  template <> inline
316  { return "TransformationGraph3d"; }
317 
318  template <> inline
320  { return "VOID"; }
321 
322  template <> inline
324  {
325  return "TransformationGraph3d";
326  }
327 
329 }
330 
331 #endif
332 
Manage transformations (affine and non-linear) transformations graph.
carto::rc_ptr< soma::Transformation3d > getTransformChain(const std::string &src_ref, const std::string &dst_ref) const
carto::rc_ptr< soma::Transformation3d > loadTransformation(Edge *edge, bool affine_only=false) const
Edge * getTransformation_raw(const Vertex *src_ref, const Vertex *dst_ref) const
same as getTransformation() but don't perform lazy loading.
Edge * getTransformation(const std::string &src_ref, const std::string &dst_ref, bool allow_compose)
Get the transformation between source_ref and dst_ref.
Edge * registerTransformation(const std::string &src_ref, const std::string &dst_ref, carto::rc_ptr< soma::Transformation3d >, bool deduced=false)
Add (or register) the given transformation in the transformations graph.
Edge * getTransformation(const std::string &src_ref, const std::string &dst_ref) const
Get the transformation between source_ref and dst_ref.
Vertex * referentialById(const std::string &id) const
Get the vertex (referential) with given ID.
Edge * getTransformation_raw(const std::string &src_ref, const std::string &dst_ref) const
same as getTransformation() but don't perform lazy loading.
carto::rc_ptr< soma::Transformation3d > transformation(const std::string &id) const
Get the Transformation3d object for the given UUID.
std::list< Edge * > loadAffineTransformations()
static carto::rc_ptr< soma::Transformation3d > transformation(const Edge *edge)
Get the Transformation3d object inside an edge.
carto::Object asDict(bool affine_only=false, bool allow_read=false, bool embed_affines=false) const
convert to a dict-like structure compatible with loadTransformationsGraph()
carto::rc_ptr< soma::Transformation3d > getTransformChain(const Vertex *src_ref, const Vertex *dst_ref) const
Get a transformation chain between two vertices.
Edge * registerTransformation(Vertex *src_ref, Vertex *dst_ref, const std::string &filename)
Edge * registerTransformation(Vertex *src_ref, Vertex *dst_ref, carto::rc_ptr< soma::Transformation3d >, bool deduced=false)
Edge * registerTransformation(const std::string &src_ref, const std::string &dst_ref, const std::string &filename)
void clearCache(bool chain_only=false)
remove deduced transformations (built from composition or inversion).
Edge * getTransformation(Vertex *src_ref, Vertex *dst_ref, bool allow_compose)
Get the transformation between source_ref and dst_ref.
void updateIds()
Update the internal UUIDs cache.
static std::string referential(const Vertex *v)
Get the referential ID in the Vertex (its uuid property)
Edge * getTransformation(const Vertex *src_ref, const Vertex *dst_ref) const
Get the transformation between source_ref and dst_ref.
Edge * transformationById(const std::string &id) const
Get the edge (transformation) with given ID.
void registerInverseTransformations(bool loadAffines=false)
register inverse transformations when they can be obtained.
void loadTransformationsGraph(carto::Object desc, const std::string &dirname)
Load a full transformations graph from a dict-like object.
std::string name()
std::string objectType()
std::string dataType()
The class for EcatSino data write operation.
Definition: borderfiller.h:13
#define DECLARE_GENERIC_OBJECT_TYPE(T)