anatomist  5.0.5
3D neuroimaging data viewer
sliceable.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_OBJECT_SLICEABLE_H
36 #define ANA_OBJECT_SLICEABLE_H
37 
39 #include <aims/vector/vector.h>
40 #include <aims/rgb/rgb.h>
41 
42 namespace carto
43 {
44  template <typename T> class Volume;
45  template <typename T> class VolumeRef;
46 }
47 
48 namespace anatomist
49 {
50 
51  struct AImage;
52  struct SliceViewState;
53 
54 
58  class Sliceable : public GLComponent
59  {
60  public:
61  Sliceable();
62  virtual ~Sliceable();
63 
64  virtual const Sliceable* sliceableAPI() const { return this; }
65  virtual Sliceable* sliceableAPI() { return this; }
66 
67  virtual unsigned glNumVertex( const ViewState & ) const;
68  virtual const GLfloat* glVertexArray( const ViewState & ) const;
69  virtual const GLfloat* glNormalArray( const ViewState & state ) const;
70  virtual unsigned glPolygonSize( const ViewState & ) const;
71  virtual unsigned glNumPolygon( const ViewState & ) const;
72  virtual const GLuint* glPolygonArray( const ViewState & ) const;
73 
74  virtual unsigned glDimTex( const ViewState &, unsigned tex = 0 ) const;
75  virtual unsigned glTexCoordSize( const ViewState &,
76  unsigned tex = 0 ) const;
77  virtual const GLfloat* glTexCoordArray( const ViewState &,
78  unsigned tex = 0 ) const;
79 
80  virtual carto::VolumeRef<AimsRGBA> glBuildTexImage(
81  const ViewState & state, unsigned tex, int dimx = -1,
82  int dimy = -1, bool useTexScale = true ) const;
83  virtual bool glMakeTexImage( const ViewState & state,
84  const GLTexture & gltex, unsigned tex ) const;
85 
87  virtual bool update2DTexture( AImage &, const Point3df & posbase,
88  const SliceViewState &,
89  unsigned tex = 0 ) const;
91  virtual carto::VolumeRef<AimsRGBA> rgbaVolume( const SliceViewState* = 0,
92  int tex = 0 ) const;
94  virtual void rgbaVolume( carto::Volume<AimsRGBA> &,
95  const SliceViewState* = 0, int tex = 0 ) const;
96  virtual std::vector<float> glVoxelSize() const;
97  virtual std::vector<float> glMin2D() const = 0;
98  virtual std::vector<float> glMax2D() const = 0;
99  virtual bool glAllowedTexRGBInterpolation( unsigned tex = 0 ) const;
100  virtual const Referential *getReferential() const = 0;
101  virtual std::string viewStateID( glPart part, const ViewState & ) const;
102 
103  private:
104  struct Private;
105  Private *d;
106  };
107 
108 
111  class SliceableObject : public AObject, public Sliceable
112  {
113  public:
114  SliceableObject();
115  virtual ~SliceableObject();
116 
117  virtual const GLComponent* glAPI() const { return this; }
118  virtual GLComponent* glAPI() { return this; }
119  virtual const Sliceable* sliceableAPI() const { return this; }
120  virtual Sliceable* sliceableAPI() { return this; }
121 
122  virtual std::vector<float> glVoxelSize() const;
123  virtual std::vector<float> glMin2D() const;
124  virtual std::vector<float> glMax2D() const;
125 
126  virtual void glSetChanged( glPart, bool = true ) const;
127  virtual void glSetTexImageChanged( bool x = true, unsigned tex = 0 ) const;
128  virtual void glSetTexEnvChanged( bool x = true, unsigned tex = 0 ) const;
129 
130  virtual const Material *glMaterial() const;
131  virtual const AObjectPalette* glPalette( unsigned tex = 0 ) const;
132  const Referential *getReferential() const;
133  };
134 
135 }
136 
137 #endif
138 
ViewState holds information about how a view wants to see an object.
Definition: viewstate.h:66
Base Anatomist object (abstract)
Definition: Object.h:95
virtual const GLComponent * glAPI() const
OpenGL objects const API.
Definition: sliceable.h:117
AObject-inherited version of Sliceable.
Definition: sliceable.h:111
This class has to be rewritten, it&#39;s really really a shame.......
Definition: Material.h:47
virtual const Sliceable * sliceableAPI() const
Definition: sliceable.h:119
virtual const Sliceable * sliceableAPI() const
Definition: sliceable.h:64
Base class for all OpenGL objects in Anatomist (with OpenGL display lists)
Definition: glcomponent.h:66
virtual GLComponent * glAPI()
OpenGL objects API.
Definition: sliceable.h:118
glPart
GL object parts, each driving a GL list.
Definition: glcomponent.h:113
virtual Sliceable * sliceableAPI()
Definition: sliceable.h:65
virtual Sliceable * sliceableAPI()
Definition: sliceable.h:120
Referential: marker for transformations, with an associated color.
Definition: Referential.h:54
Specialization for a sliceable object.
Definition: viewstate.h:98
Sliceable objects can draw themselves in a 2D texture.
Definition: sliceable.h:58