anatomist  5.1.2
3D neuroimaging data viewer
surface.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 ANA_SURFACE_SURFACE_H
35 #define ANA_SURFACE_SURFACE_H
36 
37 
40 #include <aims/mesh/surface.h>
42 
43 /*
44 class QGLShaderProgram;
45 class QGLShader;*/
46 
47 
48 namespace anatomist
49 {
50 
53  template<int D>
54  class ASurface : public AGLObject, public PythonAObject
55  {
56  public:
57 
61 
62  ASurface( const char *filename = "" );
63  ~ASurface();
64 
65  virtual AObject* clone( bool shallow = true );
66 
67  virtual Tree* optionTree() const;
68 
69  virtual void UpdateMinAndMax();
70 
71  virtual bool render( anatomist::PrimList& primitiveList,
72  const anatomist::ViewState& viewState );
73  virtual bool glMakeBodyGLL( const anatomist::ViewState& viewState,
74  const anatomist::GLList& glList ) const;
75 
77  { return( _surface ); }
82  void setSurface( TimeSurfaceType *surf );
83  const SurfaceType* surfaceOfTime( float time ) const;
84  float actualTime( float time ) const;
85 
86  virtual float MinT() const;
87  virtual float MaxT() const;
88 
89  virtual bool boundingBox( std::vector<float> & bmin,
90  std::vector<float> & bmax ) const;
91 
93  virtual AObject* objectAt( const std::vector<float> & pos, float tol = 0 );
94 
96  bool Is2DObject() { return false; }
98  bool Is3DObject() { return true; }
99 
100  virtual unsigned glNumVertex( const ViewState & ) const;
101  virtual const GLfloat* glVertexArray( const ViewState & ) const;
102  virtual unsigned glNumNormal( const ViewState & ) const;
103  virtual const GLfloat* glNormalArray( const ViewState & ) const;
104  virtual unsigned glNumPolygon( const ViewState & ) const;
105  virtual unsigned glPolygonSize( const ViewState & ) const;
106  virtual const GLuint* glPolygonArray( const ViewState & ) const;
107 
108  virtual bool loadable() const { return( true ); }
109  virtual bool savable() const { return( true ); }
110  virtual bool save( const std::string & filename );
111  virtual bool reload( const std::string & filename );
112 
113  SurfaceType* surfaceOfTime( float time );
114 
115  bool isPlanar() const { return _planar; }
116 
117  void invertPolygons();
118  static void invertPolygonsStatic( const std::set<AObject *> & obj );
119 
120  virtual void notifyObservers( void * = 0 );
121 
122  virtual carto::GenericObject* attributed();
123  virtual const carto::GenericObject* attributed() const;
124  virtual void setInternalsChanged();
125 
126  protected:
128  bool _planar;
129 /*
130  QGLShaderProgram *_shader_program;
131  QGLShader *_vertex_shader;
132  QGLShader *_fragment_shader;
133 */
134  void freeSurface();
135  };
136 
137 }
138 
139 
140 #endif
Base Anatomist object (abstract)
Definition: Object.h:96
Template surface type.
Definition: surface.h:55
AimsVector< uint, D > Triangle
Definition: surface.h:58
bool Is2DObject()
Can't be display in 2D windows.
Definition: surface.h:96
virtual void notifyObservers(void *=0)
If this object has changed, as indicated by the hasChanged method, then notify all of its observers.
Definition: surface_d.h:547
virtual bool render(anatomist::PrimList &primitiveList, const anatomist::ViewState &viewState)
rendering (generally 2D or 3D using OpenGL).
Definition: surface_d.h:104
virtual unsigned glNumPolygon(const ViewState &) const
Definition: surface_d.h:354
carto::rc_ptr< TimeSurfaceType > _surface
Definition: surface.h:127
bool Is3DObject()
Can be display in 3D windows.
Definition: surface.h:98
virtual bool glMakeBodyGLL(const anatomist::ViewState &viewState, const anatomist::GLList &glList) const
If you want to make a non-standard GL display list for the body geometry, overload this function to f...
Definition: surface_d.h:112
virtual bool save(const std::string &filename)
Definition: surface_d.h:437
virtual Tree * optionTree() const
Menu tree for new options, see object/optionMatcher.h.
Definition: surface_d.h:365
carto::rc_ptr< TimeSurfaceType > surface()
Definition: surface.h:78
void setSurface(carto::rc_ptr< TimeSurfaceType > surf)
Definition: surface_d.h:234
virtual unsigned glPolygonSize(const ViewState &) const
number of vertices per polygon (default = 3: triangles)
Definition: surface_d.h:555
const SurfaceType * surfaceOfTime(float time) const
Definition: surface_d.h:148
virtual const GLfloat * glVertexArray(const ViewState &) const
Definition: surface_d.h:307
virtual const GLuint * glPolygonArray(const ViewState &) const
Definition: surface_d.h:343
ASurface(const char *filename="")
Definition: surface_d.h:97
virtual carto::GenericObject * attributed()
Definition: surface_d.h:562
virtual float MinT() const
Obsolete, deprecated.
Definition: surface_d.h:225
virtual bool reload(const std::string &filename)
Re-reads objects from disk.
Definition: surface_d.h:458
virtual unsigned glNumNormal(const ViewState &) const
Definition: surface_d.h:318
virtual AObject * clone(bool shallow=true)
Makes a copy of the object, with a duplicated object structure, palette and material,...
Definition: surface_d.h:127
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.
Definition: surface_d.h:491
virtual float MaxT() const
Obsolete, deprecated.
Definition: surface_d.h:216
virtual AObject * objectAt(const std::vector< float > &pos, float tol=0)
selection is disabled for surfaces
Definition: surface_d.h:430
static void invertPolygonsStatic(const std::set< AObject * > &obj)
Definition: surface_d.h:471
bool isPlanar() const
Definition: surface.h:115
virtual bool savable() const
Definition: surface.h:109
float actualTime(float time) const
Definition: surface_d.h:531
virtual unsigned glNumVertex(const ViewState &) const
Definition: surface_d.h:296
AimsSurface< D, Void > SurfaceType
Definition: surface.h:59
virtual void UpdateMinAndMax()
Definition: surface_d.h:188
const carto::rc_ptr< TimeSurfaceType > surface() const
Definition: surface.h:76
virtual const GLfloat * glNormalArray(const ViewState &) const
normals array (optional), default=0 (no normals, flat shaded faces)
Definition: surface_d.h:329
AimsTimeSurface< D, Void > TimeSurfaceType
Definition: surface.h:60
virtual bool loadable() const
Definition: surface.h:108
virtual void setInternalsChanged()
Notifies some underlying lower-level objects have changed.
Definition: surface_d.h:590
Attributed objects wrapper.
Definition: pythonAObject.h:46
std::list< carto::rc_ptr< GLItem > > PrimList
Definition: Object.h:72
ViewState holds information about how a view wants to see an object.
Definition: viewstate.h:67