aimsdata  5.1.2
Neuroimaging data handling
aims::GraphManip Class Reference

Various manipulations on graphs. More...

#include <aims/graph/graphmanip.h>

Public Types

typedef BucketMap< Void > *(* CreateBucketFunc) (GraphObject *, const std::string &)
 

Public Member Functions

std::vector< int > attributeColor (const Graph &graph, const std::string &att)
 

Static Public Member Functions

static AffineTransformation3d talairach (const Graph &g)
 Extract Talairach transformation (graph -> Talairach) More...
 
static void storeTalairach (Graph &g, const AffineTransformation3d &m, bool force_old_attributes=false)
 Store Talairach transformation in graph. More...
 
static bool hasOldTalairachTransform (const Graph &g)
 Test if a Graph has the old Talairach attributes. More...
 
static AffineTransformation3d getICBMTransform (const Graph &g)
 Extract the transformation to the MNI ICBM152 space. More...
 
static AffineTransformation3d getICBM2009cTemplateTransform (const Graph &g)
 Extract the transformation to the MNI ICBM152 space, shifted to the "most standard" field of view of the template image, the one from the ICBM2009c_nlin_asym template from the MNI. More...
 
static bool buckets2Volume (Graph &g)
 converts internal representations of graph nodes from buckets to volume More...
 
static bool volume2Buckets (Graph &g, CreateBucketFunc f=0)
 converts internal representations of graph nodes from volume to buckets. More...
 
static GraphElementCodegraphElementCode (Graph &, const std::string &syntax, const std::string &id)
 
static GraphElementCodegraphElementCodeByAtt (Graph &, const std::string &syntax, const std::string &attrib)
 
template<typename T >
static void storeAims (Graph &graph, GraphObject *vertex, const std::string &attribute, carto::rc_ptr< T > obj)
 This template function stores the given object in the given Vertex / Edge of the graph and takes care of IO information to maintain in the graph. More...
 
template<typename T >
static GraphgraphFromVolume (const carto::rc_ptr< carto::Volume< T > > &vol, T background=0, std::map< T, std::string > *trans=0)
 builds a ROI graph from a volume of labels More...
 
template<typename T >
static void graphFromVolume (const carto::rc_ptr< carto::Volume< T > > &vol, Graph &g, T background=0, std::map< T, std::string > *trans=0, bool automaticBackgroundSearch=true)
 builds a ROI graph from a volume of labels More...
 
static void setAttributeColor (Graph &graph, const std::string &att, const AimsRGB &)
 
static void setAttributeColor (Graph &graph, const std::string &att, const AimsRGBA &)
 
static void setAttributeColor (Graph &graph, const std::string &att, const std::vector< int > &)
 
static void completeGraph (Graph &)
 Completes folds graph information. More...
 
static GraphmergeGraph (const std::string &, Graph &, Graph &, bool mergeMesh=true, bool invNormal=false)
 
static void printGraphElementTable (const Graph &, std::ostream &ostr=std::cout)
 
static std::string defaultExtensionForObjectType (const std::string &otype, const std::string &dtype)
 
static std::list< Edge * > getPath (const Vertex *from, const Vertex *to)
 Get edges path from a vertex to another one. More...
 

Detailed Description

Various manipulations on graphs.

Definition at line 125 of file graphmanip.h.

Member Typedef Documentation

◆ CreateBucketFunc

typedef BucketMap<Void>*(* aims::GraphManip::CreateBucketFunc) (GraphObject *, const std::string &)

Definition at line 128 of file graphmanip.h.

Member Function Documentation

◆ attributeColor()

std::vector<int> aims::GraphManip::attributeColor ( const Graph graph,
const std::string &  att 
)

◆ buckets2Volume()

static bool aims::GraphManip::buckets2Volume ( Graph g)
static

converts internal representations of graph nodes from buckets to volume

Returns
false if it fails: if all buckets have not been read from disk

◆ completeGraph()

static void aims::GraphManip::completeGraph ( Graph )
static

Completes folds graph information.

Adds missing information to sulcal nodes, like meshes surface...

◆ defaultExtensionForObjectType()

static std::string aims::GraphManip::defaultExtensionForObjectType ( const std::string &  otype,
const std::string &  dtype 
)
static

Referenced by storeAims().

◆ getICBM2009cTemplateTransform()

static AffineTransformation3d aims::GraphManip::getICBM2009cTemplateTransform ( const Graph g)
static

Extract the transformation to the MNI ICBM152 space, shifted to the "most standard" field of view of the template image, the one from the ICBM2009c_nlin_asym template from the MNI.

Actually we find various fields of view for the templates. The one we use here is (193, 229, 193). The transform to the "real" ICBM space (0 roughly at AC) is provided in the output transformation header. This space has a fixed transformation with our Aims Talairach, along with the template volume size and voxel size. Includes shifts and axes inversions.

◆ getICBMTransform()

static AffineTransformation3d aims::GraphManip::getICBMTransform ( const Graph g)
static

Extract the transformation to the MNI ICBM152 space.

This space has a fixed transformation with our Aims Talairach.

◆ getPath()

static std::list<Edge *> aims::GraphManip::getPath ( const Vertex from,
const Vertex to 
)
static

Get edges path from a vertex to another one.

Adapted from Yann Leprince's code on: https://github.com/HumanBrainProject/hbp-spatial-backend/blob/fc79a6adc5d71fe6a02021f0d36698c5fde86b43/hbp_spatial_backend/transform_graph.py#L36

TODO: detect ambiguities (multiple same-length chains)

◆ graphElementCode()

static GraphElementCode& aims::GraphManip::graphElementCode ( Graph ,
const std::string &  syntax,
const std::string &  id 
)
static

◆ graphElementCodeByAtt()

static GraphElementCode& aims::GraphManip::graphElementCodeByAtt ( Graph ,
const std::string &  syntax,
const std::string &  attrib 
)
static

Referenced by storeAims().

◆ graphFromVolume() [1/2]

template<typename T >
static void aims::GraphManip::graphFromVolume ( const carto::rc_ptr< carto::Volume< T > > &  vol,
Graph g,
background = 0,
std::map< T, std::string > *  trans = 0,
bool  automaticBackgroundSearch = true 
)
static

builds a ROI graph from a volume of labels

◆ graphFromVolume() [2/2]

template<typename T >
static Graph* aims::GraphManip::graphFromVolume ( const carto::rc_ptr< carto::Volume< T > > &  vol,
background = 0,
std::map< T, std::string > *  trans = 0 
)
static

builds a ROI graph from a volume of labels

◆ hasOldTalairachTransform()

static bool aims::GraphManip::hasOldTalairachTransform ( const Graph g)
static

Test if a Graph has the old Talairach attributes.

These attributes are "Talairach_translation", "Talairach_rotation" (both required), and "Talairach_scale" (optional). The modern way of storing the transformation to Talairach is in the "referentials" and "transformations" attributes.

◆ mergeGraph()

static Graph* aims::GraphManip::mergeGraph ( const std::string &  ,
Graph ,
Graph ,
bool  mergeMesh = true,
bool  invNormal = false 
)
static

◆ printGraphElementTable()

static void aims::GraphManip::printGraphElementTable ( const Graph ,
std::ostream &  ostr = std::cout 
)
static

◆ setAttributeColor() [1/3]

static void aims::GraphManip::setAttributeColor ( Graph graph,
const std::string &  att,
const AimsRGB  
)
static

◆ setAttributeColor() [2/3]

static void aims::GraphManip::setAttributeColor ( Graph graph,
const std::string &  att,
const AimsRGBA  
)
static

◆ setAttributeColor() [3/3]

static void aims::GraphManip::setAttributeColor ( Graph graph,
const std::string &  att,
const std::vector< int > &   
)
static

◆ storeAims()

template<typename T >
void aims::GraphManip::storeAims ( Graph graph,
GraphObject vertex,
const std::string &  attribute,
carto::rc_ptr< T >  obj 
)
static

This template function stores the given object in the given Vertex / Edge of the graph and takes care of IO information to maintain in the graph.

More precisely, it calls GraphObject::setProperty and fills the GraphElementTable accordingly in the graph

Definition at line 46 of file graphmanip_d.h.

References aims::GraphElementCode::attribute, aims::GraphElementCode::dataType, carto::DataTypeCode< class >::dataType(), defaultExtensionForObjectType(), aims::GraphElementCode::global_filename, aims::GraphElementCode::global_index_attribute, graphElementCodeByAtt(), aims::GraphElementCode::local_file_attribute, aims::GraphElementCode::objectType, and carto::DataTypeCode< class >::objectType().

Referenced by aims::Tex2Graph< T >::makeGraph().

◆ storeTalairach()

static void aims::GraphManip::storeTalairach ( Graph g,
const AffineTransformation3d m,
bool  force_old_attributes = false 
)
static

Store Talairach transformation in graph.

The transformation is written in the modern attributes ("referentials" and "transformations"). It is also written to the legacy attributes ("Talairach_translation", "Talairach_rotation", and "Talairach_scale"), if these are already present, or if force_old_attributes is true.

◆ talairach()

static AffineTransformation3d aims::GraphManip::talairach ( const Graph g)
static

Extract Talairach transformation (graph -> Talairach)

The transformation is returned from one of these sources, in order of priority:

  1. The "transformations" attribute, corresponding to the "Talairach-AC/PC-Anatomist" referential.
  2. The legacy "Talairach_translation", "Talairach_rotation", and "Talairach_scale" attributes.
  3. Otherwise, identity is returned.

◆ volume2Buckets()

static bool aims::GraphManip::volume2Buckets ( Graph g,
CreateBucketFunc  f = 0 
)
static

converts internal representations of graph nodes from volume to buckets.

Returns
false if it fails: if all volumes have not been read from disk

The documentation for this class was generated from the following files: