aimsdata 6.0.0
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>
40
41
42namespace aims
43{
44
92 {
93 public:
96
100 void updateIds();
114 Vertex* referentialById( const std::string & id ) const;
155 Vertex* referentialByCode( const std::string & id,
156 carto::Object header,
157 const std::vector<std::string> & refs ) const;
160 Vertex* referentialByCode( const std::string & id,
161 const carto::DictionaryInterface *header,
162 const std::vector<std::string> & refs ) const;
164 Edge* transformationById( const std::string & id ) const;
166 static std::string referential( const Vertex *v );
173 const Edge *edge );
180 const std::string & id ) const;
181
183 const carto::AllocatorContext & allocatorContext() const
184 { return _allocator; }
185
191 void setAllocatorContext( const carto::AllocatorContext & alloc )
192 { _allocator = alloc; }
193
198 Edge* getTransformation( const std::string & src_ref,
199 const std::string & dst_ref ) const;
209 Edge* getTransformation( const std::string & src_ref,
210 const std::string & dst_ref,
211 bool allow_compose );
216 Edge* getTransformation( const Vertex *src_ref,
217 const Vertex *dst_ref ) const;
228 Vertex *dst_ref,
229 bool allow_compose );
230
233 const Vertex *dst_ref ) const;
235 Edge *getTransformation_raw( const std::string & src_ref,
236 const std::string & dst_ref ) const;
237
252 Edge *registerTransformation( const std::string & src_ref,
253 const std::string & dst_ref,
255 bool deduced=false );
258 bool deduced=false );
259 Edge *registerTransformation( const std::string & src_ref,
260 const std::string & dst_ref,
261 const std::string & filename );
263 const std::string & filename );
270 void registerReferentialAlias( const std::string & uuid,
271 const std::string & existing_id );
276 void mergeReferentials( const std::string & uuid,
277 const std::string & existing_id );
278
337 const std::string & dirname );
354 carto::Object asDict( bool affine_only = false, bool allow_read = false,
355 bool embed_affines = false,
356 const std::string & rel_to_path = "" ) const;
362 void clearCache( bool chain_only=false );
373 void registerInverseTransformations( bool loadAffines = false );
374 std::list<Edge *> loadAffineTransformations();
375
385 const Vertex *src_ref, const Vertex *dst_ref ) const;
387 const std::string & src_ref, const std::string & dst_ref ) const;
388
390 loadTransformation( Edge *edge, bool affine_only=false ) const;
391
417 std::vector<std::string> updateFromObjectHeader(
418 carto::Object header, bool includeDiskSpace = false );
420 std::vector<std::string> updateFromObjectHeader(
421 const carto::DictionaryInterface *header,
422 bool includeDiskSpace = false );
423
429 const carto::DictionaryInterface *header );
430
431 private:
432 mutable std::map<std::string, Vertex *> _refs_by_id;
433 mutable std::map<std::string, Edge *> _tr_by_id;
434 std::set<std::pair<const Vertex *, const Vertex *> > _disconnected;
435 carto::AllocatorContext _allocator;
436
437 };
438
439}
440
441namespace carto
442{
443
444 template <> inline
446 { return "TransformationGraph3d"; }
447
448 template <> inline
450 { return "VOID"; }
451
452 template <> inline
454 {
455 return "TransformationGraph3d";
456 }
457
458 DECLARE_GENERIC_OBJECT_TYPE( carto::rc_ptr<soma::Transformation3d> )
459}
460
461#endif
462
Graph(const std::string &s="")
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 * transformationById(const std::string &id) const
Get the edge (transformation) with given ID.
Edge * getTransformation(const Vertex *src_ref, const Vertex *dst_ref) const
Get the transformation between source_ref and dst_ref.
Edge * registerTransformation(Vertex *src_ref, Vertex *dst_ref, carto::rc_ptr< soma::Transformation3d >, bool deduced=false)
carto::rc_ptr< soma::Transformation3d > getTransformChain(const Vertex *src_ref, const Vertex *dst_ref) const
Get a transformation chain between two vertices.
Vertex * referentialByCode(const std::string &id, carto::Object header, const std::vector< std::string > &refs) const
Same as referentialById( const string & id ), but with the help of an object header,...
static carto::rc_ptr< soma::Transformation3d > transformToDiskSpace(const carto::DictionaryInterface *header)
static helper function which extracts the transformation from the AIMS referential to disk space orie...
Vertex * referentialById(const std::string &id) const
Get the vertex (referential) with given ID.
void setAllocatorContext(const carto::AllocatorContext &alloc)
Set the allocator context used in all transformations reading operations.
const carto::AllocatorContext & allocatorContext() const
Allocator context used in transformations reading operations.
Edge * getTransformation_raw(const Vertex *src_ref, const Vertex *dst_ref) const
same as getTransformation() but don't perform lazy loading.
void mergeReferentials(const std::string &uuid, const std::string &existing_id)
Merge two existing referentials into a single one (the second).
carto::rc_ptr< soma::Transformation3d > transformation(const std::string &id) const
Get the Transformation3d object for the given UUID.
std::vector< std::string > updateFromObjectHeader(const carto::DictionaryInterface *header, bool includeDiskSpace=false)
Insert all transformations / referentials found in an object header.
carto::Object asDict(bool affine_only=false, bool allow_read=false, bool embed_affines=false, const std::string &rel_to_path="") const
convert to a dict-like structure compatible with loadTransformationsGraph()
carto::rc_ptr< soma::Transformation3d > getTransformChain(const std::string &src_ref, const std::string &dst_ref) const
Edge * registerTransformation(Vertex *src_ref, Vertex *dst_ref, const std::string &filename)
void clearCache(bool chain_only=false)
remove deduced transformations (built from composition or inversion).
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.
Vertex * referentialByCode(const std::string &id, const carto::DictionaryInterface *header, const std::vector< std::string > &refs) const
same as referentialByCode( const string, Object ) but with another way of passing the header
void registerReferentialAlias(const std::string &uuid, const std::string &existing_id)
registers a different referential, additional UUID for an existing referential.
Edge * registerTransformation(const std::string &src_ref, const std::string &dst_ref, const std::string &filename)
std::list< Edge * > loadAffineTransformations()
Edge * getTransformation(Vertex *src_ref, Vertex *dst_ref, bool allow_compose)
Get the transformation between source_ref and dst_ref.
std::vector< std::string > updateFromObjectHeader(carto::Object header, bool includeDiskSpace=false)
Insert all transformations / referentials found in an object header.
Edge * getTransformation_raw(const std::string &src_ref, const std::string &dst_ref) const
same as getTransformation() but don't perform lazy loading.
void updateIds()
Update the internal UUIDs cache.
static std::string referential(const Vertex *v)
Get the referential ID in the Vertex (its uuid property)
static carto::rc_ptr< soma::Transformation3d > transformation(const Edge *edge)
Get the Transformation3d object inside an edge.
carto::rc_ptr< soma::Transformation3d > loadTransformation(Edge *edge, bool affine_only=false) const
Edge * getTransformation(const std::string &src_ref, const std::string &dst_ref) const
Get the transformation between source_ref and dst_ref.
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.
#define DECLARE_GENERIC_OBJECT_TYPE(T)