anatomist 6.0.4
3D neuroimaging data viewer
Graph.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
35#ifndef ANA_GRAPH_GRAPH_H
36#define ANA_GRAPH_GRAPH_H
37
38
43#include <graph/graph/graph.h>
44#include <cartodata/volume/volume.h>
45
46
48
49namespace anatomist
50{
51
52 class AGraphObject;
53
56 class AGraph : public MObject, public GLComponent, public AttributedAObject
57 {
58 public:
60 {
62 };
63 AGraph( Graph *dataGraph, const std::string & filename,
64 bool init,
65 const Point3d& labelDimension );
66 AGraph( Graph *dataGraph, const std::string & filename,
67 bool init = true,
68 const Point3dl& labelDimension = Point3dl(64, 64, 64) );
69 AGraph( carto::rc_ptr<Graph> dataGraph, const std::string & filename,
70 bool init,
71 const Point3d& labelDimension );
72 AGraph( carto::rc_ptr<Graph> dataGraph, const std::string & filename,
73 bool init = true,
74 const Point3dl& labelDimension = Point3dl(64, 64, 64) );
75
76 virtual ~AGraph();
77
78 virtual AObject* clone( bool shallow = true );
79
80 virtual int MType() const { return( AObject::GRAPH ); }
81 virtual size_t size() const;
82 virtual iterator begin();
83 virtual const_iterator begin() const;
84 virtual iterator end();
85 virtual const_iterator end() const;
86 virtual void insert( AObject * );
87 virtual void insert( AObject* obj, std::string syntacticAtt );
88 virtual void insert( const carto::shared_ptr<AObject> & obj,
89 std::string syntacticAtt = "fold" );
90 void insert( AObject* obj, carto::GenericObject* vertex );
91 virtual const_iterator find( const AObject * ) const;
92 virtual void erase( iterator & );
94 Graph* graph() const;
96
97 virtual std::list<AObject *> renderedSubObjects( const ViewState & ) const;
98 virtual bool render( PrimList &, const ViewState & );
99
100 virtual void setGeomExtrema();
101 virtual bool boundingBox( std::vector<float> & bmin,
102 std::vector<float> & bmax ) const;
103 virtual bool boundingBox2D( std::vector<float> & bmin,
104 std::vector<float> & bmax ) const
105 { return boundingBox( bmin, bmax ); }
106
107 bool Is2DObject() { return(true); }
109 bool Is3DObject() { return(true); }
110 virtual AObject* objectAt( const std::vector<float> & pos, float tol = 0 );
111 virtual void SetMaterial( const Material & mat );
112 virtual bool shouldRemoveChildrenWithMe() const;
113
115 virtual const carto::GenericObject* attributed() const;
116
117 static AObject* LoadGraph( const std::string & filename,
118 carto::Object options=carto::none() );
119 virtual bool save( const std::string & filename );
120 virtual bool savable() const { return true; }
121 void loadSubObjects( int mask );
123 void setColorMode( ColorMode, bool update = true );
124 int colorPropertyMask() const;
126 void setColorPropertyMask( int, bool update = true );
128 std::string colorProperty() const;
129 void setColorProperty( const std::string &, bool update = true );
130 void updateColors(void);
131
136 static bool (*specialColorFunc)( AGraph* ag, AGraphObject* go,
137 Material & mat );
138
143 void copyAttributes( const std::string & oldatt,
144 const std::string & newatt, bool removeOld = false,
145 bool dorels = false );
152 std::string labelProperty( bool allowDefault = true ) const;
153 void setLabelProperty( const std::string & prop );
154
155 virtual std::vector<float> voxelSize() const;
156 virtual void setVoxelSize( const std::vector<float> & vs );
158 void setLabelsVolumeDimension( unsigned dx, unsigned dy, unsigned dz );
163 virtual void createDefaultPalette( const std::string & name );
164 virtual void setPalette( const AObjectPalette & pal );
167
168 virtual GLComponent* glAPI();
169 virtual const GLComponent* glAPI() const;
170 virtual const AObjectPalette* glPalette( unsigned tex = 0 ) const;
171 virtual void setProperties( carto::Object options );
172 std::set<std::string> mappableVertexProperties() const;
173 std::set<std::string> mappableEdgeProperties() const;
174
175 protected:
176 void saveSubObjects( bool filenamechanged = false );
178 virtual void fillVol( carto::VolumeRef<AObject *> & vol, int t, float mx,
179 float my, float mz, float Mx, float My, float Mz );
180 void recolor();
182
184 typedef std::set<carto::shared_ptr<AObject> > datatype;
185
186 private:
187 friend class ::QGraphProperties;
188
189 void initialize( const std::string & filename, bool init,
190 const Point3dl& labelDimension );
191
192 struct Private;
193 Private *d;
194 };
195
196}
197
198
199namespace carto
200{
202}
203
204#endif
Anatomist graph object: a list that manages destruction of its sub-elements.
Definition GraphObject.h:53
AGraph object class.
Definition Graph.h:57
virtual const_iterator end() const
virtual void fillVol(carto::VolumeRef< AObject * > &vol, int t, float mx, float my, float mz, float Mx, float My, float Mz)
Fills a volume of labels for a given time.
virtual void setGeomExtrema()
Scans the object internals and determines its geometry extrema.
virtual const AObjectPalette * glPalette(unsigned tex=0) const
void saveSubObjects(bool filenamechanged=false)
virtual size_t size() const
virtual const GLComponent * glAPI() const
OpenGL objects const API.
virtual const_iterator find(const AObject *) const
Point3dl labelsVolumeDimension() const
void copyAttributes(const std::string &oldatt, const std::string &newatt, bool removeOld=false, bool dorels=false)
virtual void setVoxelSize(const std::vector< float > &vs)
virtual void setPalette(const AObjectPalette &pal)
AGraph(Graph *dataGraph, const std::string &filename, bool init, const Point3d &labelDimension)
virtual const_iterator begin() const
virtual void createDefaultPalette(const std::string &name)
function called by getOrCreatePalette() - overloadable, need not be called directly
virtual AObject * clone(bool shallow=true)
Makes a copy of the object, with a duplicated object structure, palette and material,...
void setLabelProperty(const std::string &prop)
carto::VolumeRef< AObject * > & volumeOfLabels(int t=0)
std::set< std::string > mappableVertexProperties() const
virtual void setProperties(carto::Object options)
Same as setHeaderOptions() and used by it, allows passing a dictionary.
void setColorPropertyMask(int, bool update=true)
bitwise combination of 1: nodes, 2: relations
bool Is3DObject()
Can be display in 3D windows.
Definition Graph.h:109
virtual bool shouldRemoveChildrenWithMe() const
tells whether children objects should be removed from views when this MObject is removed from a view.
virtual bool save(const std::string &filename)
AGraph(carto::rc_ptr< Graph > dataGraph, const std::string &filename, bool init, const Point3d &labelDimension)
virtual AObject * objectAt(const std::vector< float > &pos, float tol=0)
Find the object (sub-object) at given postion with a tolerence.
void setColorMode(ColorMode, bool update=true)
void clearLabelsVolume()
void setLabelsVolumeDimension(const Point3d &vd)
virtual int MType() const
Precise type of multi-object.
Definition Graph.h:80
virtual bool render(PrimList &, const ViewState &)
rendering (generally 2D or 3D using OpenGL).
void setLabelsVolumeDimension(unsigned dx, unsigned dy, unsigned dz)
virtual void erase(iterator &)
std::set< std::string > mappableEdgeProperties() const
virtual void insert(const carto::shared_ptr< AObject > &obj, std::string syntacticAtt="fold")
std::string labelProperty(bool allowDefault=true) const
property used to store the current label.
void updateColors(void)
AGraph(carto::rc_ptr< Graph > dataGraph, const std::string &filename, bool init=true, const Point3dl &labelDimension=Point3dl(64, 64, 64))
static AObject * LoadGraph(const std::string &filename, carto::Object options=carto::none())
virtual carto::GenericObject * attributed()
int colorPropertyMask() const
void setColorProperty(const std::string &, bool update=true)
virtual void SetMaterial(const Material &mat)
void loadSubObjects(int mask)
virtual std::list< AObject * > renderedSubObjects(const ViewState &) const
lis of objects displayed in render() in a default implementation
virtual std::vector< float > voxelSize() const
Returns at least 4 sizes. For 3D objects, returns (1, 1, 1, 1)
void insert(AObject *obj, carto::GenericObject *vertex)
bool Is2DObject()
Can be display in 2D windows.
Definition Graph.h:107
void updateAfterAimsChange()
to be called when there has been a structural modif on the AIMS graph
carto::rc_ptr< std::map< std::string, std::vector< int > > > objAttColors()
std::set< carto::shared_ptr< AObject > > datatype
Data storage type, to be redefined by children classes.
Definition Graph.h:184
AGraph(Graph *dataGraph, const std::string &filename, bool init=true, const Point3dl &labelDimension=Point3dl(64, 64, 64))
ColorMode colorMode() const
std::string colorProperty() const
property mapped with colormap
virtual bool savable() const
Definition Graph.h:120
Graph * graph() const
low-level data acces
virtual bool boundingBox2D(std::vector< float > &bmin, std::vector< float > &bmax) const
Bounding box in 2D views mode.
Definition Graph.h:103
void setLabelsVolumeDimension(const Point3dl &vd)
virtual iterator begin()
static bool(* specialColorFunc)(AGraph *ag, AGraphObject *go, Material &mat)
Used to map special colors on graph objects while changing the graph material.
Definition Graph.h:136
void setGraph(carto::rc_ptr< Graph >)
const carto::rc_ptr< std::map< std::string, std::vector< int > > > objAttColors() const
virtual const carto::GenericObject * attributed() const
virtual void insert(AObject *obj, std::string syntacticAtt)
virtual void insert(AObject *)
virtual GLComponent * glAPI()
OpenGL objects API.
virtual bool boundingBox(std::vector< float > &bmin, std::vector< float > &bmax) const
Fills bmin and bmax with the N-D bounding box extrema in the object's referential coordinates.
virtual iterator end()
Base Anatomist object (abstract)
Definition Object.h:97
std::string name() const
Name shown in control window.
Definition Object.h:166
AIterator const_iterator
Definition MObject.h:239
virtual void update(const Observable *observable, void *arg)
This class is an Observer of each of the AObject it groups.
AIterator iterator
Definition MObject.h:238
This class has to be rewritten, it's really really a shame.......
Definition Material.h:48
std::list< carto::rc_ptr< GLItem > > PrimList
Definition Object.h:74
PythonAObject AttributedAObject
Object none()
#define DECLARE_GENERIC_OBJECT_TYPE(T)
ViewState holds information about how a view wants to see an object.
Definition viewstate.h:67
AimsVector< int16_t, 3 > Point3d
AimsVector< int64_t, 3 > Point3dl