anatomist  5.1.2
3D neuroimaging data viewer
Fusion2D.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_MOBJECT_FUSION2D_H
36 #define ANA_MOBJECT_FUSION2D_H
37 
38 
41 
42 
43 namespace anatomist
44 {
45 
46  class Referential;
47  class Geometry;
48 
49 
53  class Fusion2D : public ObjectVector, public Sliceable
54  {
55  public:
60  Fusion2D( const std::vector<AObject *> & obj, bool dynamic = false );
61  virtual ~Fusion2D();
62 
63  virtual const GLComponent* glAPI() const { return this; }
64  virtual GLComponent* glAPI() { return this; }
65  virtual const Sliceable* sliceableAPI() const { return this; }
66  virtual Sliceable* sliceableAPI() { return this; }
67 
68  AObject* mri() const
69  { if( size() == 0 ) return 0; return _data.begin()->get(); }
70  virtual int MType() const { return( AObject::FUSION2D ); }
71  virtual std::vector<float> voxelSize() const;
72  virtual std::vector<float> glVoxelSize() const;
73  virtual std::vector<float> glMin2D() const;
74  virtual std::vector<float> glMax2D() const;
76 
77  virtual bool CanRemove( AObject* obj );
78 
79  virtual bool render( PrimList &, const ViewState & );
80  virtual bool update2DTexture( AImage &, const Point3df & posbase,
81  const SliceViewState &,
82  unsigned tex = 0 ) const;
84  virtual bool Is2DObject() { return(true); }
86  virtual bool Is3DObject() { return(false); }
87  virtual bool textured2D() const { return( true ); }
88 
91  void moveVolume( AObject* vol, int dstpos );
94  void moveVolume( int srcpos, int dstpos );
96  void reorder( const std::vector<AObject *> & );
97 
98  virtual void glClearHasChangedFlags() const;
99  virtual void glSetChanged( glPart, bool = true ) const;
100  virtual void glSetTexMode( glTextureMode mode, unsigned tex = 0 );
101  virtual void glSetTexImageChanged( bool x = true,
102  unsigned tex = 0 ) const ;
103  virtual void glSetTexEnvChanged( bool x = true, unsigned tex = 0 ) const;
104  unsigned glNumTextures( const ViewState & ) const;
105  std::set<glTextureMode> glAllowedTexModes( unsigned tex = 0 ) const;
106 
107  virtual void update(const Observable* observable, void* arg);
108 
109  virtual const AObjectPalette* glPalette( unsigned tex = 0 ) const;
110  const Referential *getReferential() const;
111 
112  virtual bool hasTexture() const { return( true ); }
113  virtual unsigned dimTexture() const { return( 2 ); }
114  virtual float mixedTexValue( const std::vector<float> & pos ) const;
115  virtual float mixedTexValue( const std::vector<float> & pos,
116  const Referential* orgRef ) const;
117  virtual std::vector<float>
118  texValues( const std::vector<float> & pos ) const;
119  virtual std::vector<float> texValues( const std::vector<float> & pos,
120  const Referential* orgRef ) const;
121  virtual float mixedValue( const std::vector<float> & pv ) const;
122  virtual const Material *glMaterial() const;
123  virtual bool isTransparent() const;
124  bool isDynamic() const { return _dynamic; }
125  void setDynamic( bool dynamic ) { _dynamic = dynamic; }
126 
127  virtual Tree* optionTree() const;
128  static Tree* _optionTree;
129 
130  protected:
132 
133  bool _dynamic;
134  };
135 
136 
137  inline bool Fusion2D::CanRemove( AObject * )
138  {
139  return _dynamic && size() >= 2;
140  }
141 
142 }
143 
144 
145 #endif
Base Anatomist object (abstract)
Definition: Object.h:96
Anatomist object which contains two volumes: one for the MRI anatomic image, and another for the func...
Definition: Fusion2D.h:54
unsigned glNumTextures(const ViewState &) const
virtual bool CanRemove(AObject *obj)
Definition: Fusion2D.h:137
virtual float mixedTexValue(const std::vector< float > &pos) const
Same as above except that coordinates are not transformed but taken in object coordinates system.
virtual float mixedTexValue(const std::vector< float > &pos, const Referential *orgRef) const
Gets a "mixed" texture value at a given space / time location.
virtual const GLComponent * glAPI() const
Definition: Fusion2D.h:63
virtual AObject * fallbackReferentialInheritance() const
object to take referential from when no ref is assigned
const Referential * getReferential() const
virtual bool isTransparent() const
virtual bool update2DTexture(AImage &, const Point3df &posbase, const SliceViewState &, unsigned tex=0) const
this function must be overloaded to actually fill the slice image
AObject * mri() const
Definition: Fusion2D.h:68
virtual std::vector< float > voxelSize() const
Returns at least 4 sizes. For 3D objects, returns (1, 1, 1, 1)
virtual bool Is2DObject()
Can be displayed in 2D windows.
Definition: Fusion2D.h:84
virtual std::vector< float > glMin2D() const
virtual unsigned dimTexture() const
Number of texture values for a point.
Definition: Fusion2D.h:113
void moveVolume(AObject *vol, int dstpos)
move the sub-object vol to position dstpos.
virtual std::vector< float > texValues(const std::vector< float > &pos) const
virtual GLComponent * glAPI()
Definition: Fusion2D.h:64
virtual void unregisterObservable(Observable *)
Called when an observable is destroyed, only called by Observable: don't use this function directly.
virtual std::vector< float > texValues(const std::vector< float > &pos, const Referential *orgRef) const
Gets the array of texture values at a given location.
virtual void glSetTexEnvChanged(bool x=true, unsigned tex=0) const
virtual float mixedValue(const std::vector< float > &pv) const
virtual bool hasTexture() const
Textured objects have values associated with a geometric coordinate.
Definition: Fusion2D.h:112
virtual void glSetTexMode(glTextureMode mode, unsigned tex=0)
virtual const AObjectPalette * glPalette(unsigned tex=0) const
virtual std::vector< float > glMax2D() const
Fusion2D(const std::vector< AObject * > &obj, bool dynamic=false)
The dynamic parameter has been added in Anatomist 4.6.1 and is false by default.
void moveVolume(int srcpos, int dstpos)
move the sub-object at position srcpos to position dstpos.
virtual void glClearHasChangedFlags() const
virtual int MType() const
Precise type of multi-object.
Definition: Fusion2D.h:70
virtual bool textured2D() const
true if 2D rendering uses a textured plane (not a full openGL object)
Definition: Fusion2D.h:87
std::set< glTextureMode > glAllowedTexModes(unsigned tex=0) const
List of actually allowed texturing modes for this particular object.
virtual bool render(PrimList &, const ViewState &)
rendering (generally 2D or 3D using OpenGL).
virtual void glSetChanged(glPart, bool=true) const
virtual const Material * glMaterial() const
virtual Sliceable * sliceableAPI()
Definition: Fusion2D.h:66
virtual const Sliceable * sliceableAPI() const
Definition: Fusion2D.h:65
void reorder(const std::vector< AObject * > &)
Reorder sub-objects.
virtual bool Is3DObject()
Can't be displayed in 3D windows.
Definition: Fusion2D.h:86
void setDynamic(bool dynamic)
Definition: Fusion2D.h:125
static Tree * _optionTree
Definition: Fusion2D.h:128
bool isDynamic() const
Definition: Fusion2D.h:124
virtual Tree * optionTree() const
Menu tree for new options, see object/optionMatcher.h.
virtual std::vector< float > glVoxelSize() const
virtual void update(const Observable *observable, void *arg)
This class is an Observer of each of the AObject it groups.
virtual void glSetTexImageChanged(bool x=true, unsigned tex=0) const
Base class for all OpenGL objects in Anatomist (with OpenGL display lists)
Definition: glcomponent.h:67
glPart
GL object parts, each driving a GL list.
Definition: glcomponent.h:114
This class has to be rewritten, it's really really a shame.......
Definition: Material.h:48
it's a list, in fact...
Definition: objectVector.h:212
virtual size_t size() const
Definition: objectVector.h:244
This class can be subclassed to represent an object that the programmer wants to have observed.
Definition: Observable.h:68
Referential: marker for transformations, with an associated color.
Definition: Referential.h:55
Sliceable objects can draw themselves in a 2D texture.
Definition: sliceable.h:59
std::list< carto::rc_ptr< GLItem > > PrimList
Definition: Object.h:72
Specialization for a sliceable object.
Definition: viewstate.h:99
ViewState holds information about how a view wants to see an object.
Definition: viewstate.h:67