anatomist  5.1.2
3D neuroimaging data viewer
texture.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_SURFACE_TEXTURE_H
36 #define ANA_SURFACE_TEXTURE_H
37 
38 
41 #include <aims/mesh/texture.h>
42 
43 
44 namespace anatomist
45 {
46 
51  class ATexture : public AGLObject, public PythonAObject
52  {
53  public:
55  virtual ~ATexture();
56 
57  virtual ObjectMenu* optionMenu() const;
58 
59  virtual unsigned size( float time = 0 ) const;
60  virtual const float* textureCoords() const;
61  virtual const float* textureCoords( float time ) const;
62  virtual float textureTime( float time ) const;
63  virtual const float* glTexCoordArray( const ViewState &,
64  unsigned tex = 0 ) const;
65  virtual unsigned glNumTextures() const;
66  virtual unsigned glNumTextures( const ViewState & ) const;
67  virtual unsigned glDimTex( const ViewState &, unsigned tex = 0 ) const;
68  virtual unsigned glTexCoordSize( const ViewState &,
69  unsigned tex = 0 ) const;
70 
71  virtual bool Is2DObject() { return( false ); }
72  virtual bool Is3DObject() { return( false ); }
73 
74  virtual unsigned dimTexture() const;
75  virtual bool boundingBox( std::vector<float> & bmin,
76  std::vector<float> & bmax ) const;
77 
78  virtual AObject* objectAt( const std::vector<float> &, float = 0 )
79  { return 0 ; }
80 
81  virtual void setTexExtrema();
82  void setTexExtrema(float min,float max);
83 
84  virtual void normalize();
85  template <typename T> void setTexture( carto::rc_ptr<TimeTexture<T> >
86  tex, bool normalize_data = true );
87  template <typename T>
88  carto::rc_ptr<TimeTexture<T> > texture( bool rescaled = false,
89  bool always_copy = false ) const;
90  virtual void createDefaultPalette( const std::string & name = "" );
91  virtual void update( const Observable* observable, void* arg );
92  virtual void notifyObservers( void * = 0 );
93  virtual void setInternalsChanged();
94 
95  virtual bool loadable() const { return true; }
96  virtual bool savable() const { return true; }
97  virtual bool reload( const std::string & filename );
98  bool save( const std::string & filename );
99  virtual AObject* clone( bool shallow = true );
101  virtual const carto::GenericObject* attributed() const;
102 
103  protected:
104  virtual void freeTexture();
105 
106  private:
107  struct Private;
108  template <typename T> struct Private_;
109  Private *d;
110  };
111 
112 }
113 
114 
115 #endif
Base Anatomist object (abstract)
Definition: Object.h:96
std::string name() const
Name shown in control window.
Definition: Object.h:165
High-level Texture object in Anatomist.
Definition: texture.h:52
virtual carto::GenericObject * attributed()
virtual void update(const Observable *observable, void *arg)
This method is called whenever the observed object is changed.
virtual bool reload(const std::string &filename)
Re-reads objects from disk.
virtual bool loadable() const
Definition: texture.h:95
virtual ObjectMenu * optionMenu() const
void setTexture(carto::rc_ptr< TimeTexture< T > > tex, bool normalize_data=true)
virtual AObject * objectAt(const std::vector< float > &, float=0)
Find the object (sub-object) at given postion with a tolerence.
Definition: texture.h:78
virtual bool Is2DObject()
Definition: texture.h:71
virtual unsigned dimTexture() const
Number of texture values for a point.
virtual void notifyObservers(void *=0)
If this object has changed, as indicated by the hasChanged method, then notify all of its observers.
virtual void setInternalsChanged()
Notifies some underlying lower-level objects have changed.
bool save(const std::string &filename)
carto::rc_ptr< TimeTexture< T > > texture(bool rescaled=false, bool always_copy=false) const
virtual const float * textureCoords() const
virtual unsigned glNumTextures() const
virtual const float * glTexCoordArray(const ViewState &, unsigned tex=0) const
virtual unsigned glTexCoordSize(const ViewState &, unsigned tex=0) const
texture array size (must be >= numVertex to work), defalut=0
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.
void setTexExtrema(float min, float max)
virtual float textureTime(float time) const
virtual const float * textureCoords(float time) const
virtual void freeTexture()
virtual void normalize()
virtual unsigned glDimTex(const ViewState &, unsigned tex=0) const
texture dimension (1, 2 [or 3])
virtual bool savable() const
Definition: texture.h:96
virtual void setTexExtrema()
virtual unsigned size(float time=0) const
virtual unsigned glNumTextures(const ViewState &) const
virtual AObject * clone(bool shallow=true)
Makes a copy of the object, with a duplicated object structure, palette and material,...
virtual void createDefaultPalette(const std::string &name="")
function called by getOrCreatePalette() - overloadable, need not be called directly
virtual bool Is3DObject()
Definition: texture.h:72
virtual const carto::GenericObject * attributed() const
This class can be subclassed to represent an object that the programmer wants to have observed.
Definition: Observable.h:68
Attributed objects wrapper.
Definition: pythonAObject.h:46
ViewState holds information about how a view wants to see an object.
Definition: viewstate.h:67