Anatomist module for cortical folds graphs


afgraph.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 1999-2006 CEA
3 *
4 * This software and supporting documentation were developed by
5 * CEA/DSV/SHFJ
6 * 4 place du General Leclerc
7 * 91401 Orsay cedex
8 * France
9 *
10 */
11
12#ifndef ANAFOLD_FGRAPH_AFGRAPH_H
13#define ANAFOLD_FGRAPH_AFGRAPH_H
14
15
16#include <anatomist/graph/Graph.h>
17#include <anatomist/mobject/globjectlist.h>
18#include <iostream>
19
20
21namespace sigraph
22{
23 class DomainBox;
24 class DomainRBF;
25 class FGraph;
26 class FoldLabelsTranslator;
27 class Clique;
28}
29
30
31namespace anatomist
32{
33 template<int D> class ASurface;
35 //class ATriangulated;
36
37
38 class AFGraph : public ObjectList, public GLComponent
39 {
40 public:
49
50 AFGraph( AGraph* model, AGraph* folds );
51 virtual ~AFGraph();
52
53 virtual int MType() const { return( type() ); }
54
55 virtual bool CanRemove( AObject* obj );
56
57 virtual AObject* objectAt( const std::vector<float> & pos, float tol = 0 )
58 { return( _folds->objectAt( pos, tol ) ); }
59 virtual void SetMaterial( const Material & mat );
60 virtual void setPalette( const AObjectPalette & pal );
61 virtual void internalUpdate();
62 virtual bool render( PrimList &, const ViewState & );
63
64 AGraph* model() const { return( _model ); }
65 AGraph* folds() const { return( _folds ); }
66
69 virtual void setColors();
72 virtual void setColorsNodePot();
75 virtual void setColorsLabels();
77 Mode mapMode() const { return( _mapMode ); }
78 void setMapMode( Mode mode )
79 { if( mode != _mapMode ) { _mapMode = mode; setChanged(); } }
80 bool isMapWeighted() const { return( _weighted ); }
81 void setMapWeighted( bool wt )
82 { if( wt != _weighted ) { _weighted = wt; setChanged(); } }
83 bool isRelPotentials() const { return( _relPot ); }
84 void setRelPotentials( bool onoff )
85 { if( _relPot != onoff ) { _relPot = onoff; setChanged(); } }
86 bool pot0HasColor() const { return( _pot0Col ); }
87 void setPot0HasCol( bool onoff )
88 { if( _pot0Col != onoff ) { _pot0Col = onoff; setChanged(); } }
89 bool isPot0Centered() const { return( _pot0Center ); }
90 void setPot0Centered( bool onoff )
91 { if( _pot0Center != onoff ) { _pot0Center = onoff; setChanged(); } }
92 float pot0Red() const { return( _p0red ); }
93 float pot0Green() const { return( _p0green ); }
94 float pot0Blue() const { return( _p0blue ); }
95 float pot0Alpha() const;
96 bool pot0AlphaUsed() const;
97 void setPot0Color( float r, float g, float b, float a = 1.,
98 bool usea = false );
99 float noPotRed() const { return( _nopotRed ); }
100 float noPotGreen() const { return( _nopotGreen ); }
101 float noPotBlue() const { return( _nopotBlue ); }
102 float noPotAlpha() const;
103 bool noPotAlphaUsed() const;
104 void setNoPotColor( float r, float g, float b, float a = 0.2,
105 bool usea = true );
106
107 virtual Tree* optionTree() const;
108
109 static int classType() { return( _classType ); }
111 static void fusionControl( const std::set<AObject *> & );
113 static void annealWin( const std::set<AObject *> & );
115 void setModelWeights( double szfactor );
117 virtual float minTexValue() const;
118 virtual float maxTexValue() const;
119
120 virtual GLComponent* glAPI();
121 virtual const GLComponent* glAPI() const;
122 virtual const AObjectPalette* glPalette( unsigned tex = 0 ) const;
123
124 static Tree* _optionTree;
125
126 protected:
129 bool cliqueWeight( const sigraph::Clique* cl, double & wt );
130 bool nodePotential( const Vertex* v, double & pot );
131 bool nodePotentialSimple( const Vertex* v, double & pot );
132 bool nodePotentialTotal( const Vertex* v, double & pot );
133 bool nodePotentialLabels( const Vertex* v, double & pot );
134 bool nodePotentialConstant( const Vertex* v, double & pot );
135 bool nodePotentialTotalConst( const Vertex* v, double & pot );
136 bool edgePotential( const Edge* v, double & pot );
137 bool edgePotentialSimple( const Edge* v, double & pot );
138 bool edgePotentialConstant( const Edge* v, double & pot );
139 void makeDomTriang( ATriangulated* tri, sigraph::DomainBox* dom,
140 sigraph::FGraph* fg );
141 void makeDomTriang( ATriangulated* tri, sigraph::DomainRBF* dom,
142 sigraph::FGraph* fg );
143
144 virtual void createDefaultPalette( const std::string & name );
145
146 AGraph *_model;
147 AGraph *_folds;
154 float _p0red;
155 float _p0green;
156 float _p0blue;
160 sigraph::FoldLabelsTranslator *_translator;
161
162 private:
163 struct Private;
164
166 static int registerClass();
167
168 Private *d;
169 static int _classType;
170 };
171
172
173
174// Code
175
176
177inline bool AFGraph::CanRemove( AObject* )
178{
179 std::cout << "AFGraph::CanRemove\n je reponds false !";
180 return( false );
181}
182
183
184}
185
186#endif
187
188
bool edgePotentialSimple(const Edge *v, double &pot)
float pot0Alpha() const
virtual void setColors()
maps the appropriate color on the child fold graph objects.
virtual AObject * objectAt(const std::vector< float > &pos, float tol=0)
Definition afgraph.h:57
void makeDomTriang(ATriangulated *tri, sigraph::DomainRBF *dom, sigraph::FGraph *fg)
void setPot0HasCol(bool onoff)
Definition afgraph.h:87
virtual void setColorsNodePot()
maps the node cliques potentials (with or without the weight, according to the map mode)
AGraph * folds() const
Definition afgraph.h:65
Mode mapMode() const
mode for information mapping
Definition afgraph.h:77
virtual const AObjectPalette * glPalette(unsigned tex=0) const
virtual void setColorsLabels()
maps the labels colors from hierarchy (like in graph params settings)
bool isMapWeighted() const
Definition afgraph.h:80
AFGraph(AGraph *model, AGraph *folds)
bool noPotAlphaUsed() const
float noPotRed() const
Definition afgraph.h:99
void setMapMode(Mode mode)
Definition afgraph.h:78
float noPotAlpha() const
bool nodePotentialTotalConst(const Vertex *v, double &pot)
AGraph * _folds
Definition afgraph.h:147
virtual bool render(PrimList &, const ViewState &)
bool edgePotentialConstant(const Edge *v, double &pot)
static void annealWin(const std::set< AObject * > &)
Opens the annealing window (menu callback)
void makeDomTriang(ATriangulated *tri, sigraph::DomainBox *dom, sigraph::FGraph *fg)
virtual void createDefaultPalette(const std::string &name)
AGraph * _model
Definition afgraph.h:146
virtual const GLComponent * glAPI() const
void setPot0Centered(bool onoff)
Definition afgraph.h:90
void setModelWeights(double szfactor)
Modifies the model graph.
virtual int MType() const
Definition afgraph.h:53
virtual void internalUpdate()
bool cliqueWeight(const sigraph::Clique *cl, double &wt)
virtual Tree * optionTree() const
static int classType()
Definition afgraph.h:109
static void fusionControl(const std::set< AObject * > &)
Opens the fusion control window (menu callback)
void setNoPotColor(float r, float g, float b, float a=0.2, bool usea=true)
void setMapWeighted(bool wt)
Definition afgraph.h:81
bool edgePotential(const Edge *v, double &pot)
bool nodePotential(const Vertex *v, double &pot)
virtual void setPalette(const AObjectPalette &pal)
float noPotBlue() const
Definition afgraph.h:101
virtual void SetMaterial(const Material &mat)
bool nodePotentialTotal(const Vertex *v, double &pot)
bool nodePotentialConstant(const Vertex *v, double &pot)
virtual bool CanRemove(AObject *obj)
Definition afgraph.h:177
float pot0Red() const
Definition afgraph.h:92
static Tree * _optionTree
Definition afgraph.h:124
float pot0Green() const
Definition afgraph.h:93
virtual float maxTexValue() const
bool nodePotentialSimple(const Vertex *v, double &pot)
virtual GLComponent * glAPI()
bool nodePotentialLabels(const Vertex *v, double &pot)
bool pot0AlphaUsed() const
void setRelPotentials(bool onoff)
Definition afgraph.h:84
virtual float minTexValue() const
float noPotGreen() const
Definition afgraph.h:100
float pot0Blue() const
Definition afgraph.h:94
bool isPot0Centered() const
Definition afgraph.h:89
bool isRelPotentials() const
Definition afgraph.h:83
sigraph::FoldLabelsTranslator * _translator
Definition afgraph.h:160
AGraph * model() const
Definition afgraph.h:64
bool pot0HasColor() const
Definition afgraph.h:86
void setPot0Color(float r, float g, float b, float a=1., bool usea=false)
ASurface< 3 > ATriangulated
Definition afgraph.h:34