anatomist 6.0.4
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
43namespace 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;
111
112 virtual bool hasTexture() const { return( true ); }
113 virtual unsigned dimTexture() const { return( 2 ); }
114 virtual float mixedTexValue( const std::vector<float> & pos,
115 int poly = -1 ) const;
116 virtual float mixedTexValue( const std::vector<float> & pos,
117 const Referential* orgRef,
118 int poly = -1 ) const;
119 virtual std::vector<float>
120 texValues( const std::vector<float> & pos, int poly = -1 ) const;
121 virtual std::vector<float> texValues( const std::vector<float> & pos,
122 const Referential* orgRef,
123 int poly = -1 ) const;
124 virtual float mixedValue( const std::vector<float> & pv ) const;
125 virtual const Material *glMaterial() const;
126 virtual bool isTransparent() const;
127 bool isDynamic() const { return _dynamic; }
128 void setDynamic( bool dynamic ) { _dynamic = dynamic; }
129
130 virtual Tree* optionTree() const;
132
133 protected:
135
137 };
138
139
141 {
142 return _dynamic && size() >= 2;
143 }
144
145}
146
147
148#endif
Base Anatomist object (abstract)
Definition Object.h:97
virtual const AObjectPalette * glPalette(unsigned tex=0) const
unsigned glNumTextures(const ViewState &) const
virtual bool CanRemove(AObject *obj)
Definition Fusion2D.h:140
virtual bool isTransparent() const
virtual Sliceable * sliceableAPI()
Definition Fusion2D.h:66
virtual bool update2DTexture(AImage &, const Point3df &posbase, const SliceViewState &, unsigned tex=0) const
this function must be overloaded to actually fill the slice image
virtual GLComponent * glAPI()
OpenGL objects API.
Definition Fusion2D.h:64
std::set< glTextureMode > glAllowedTexModes(unsigned tex=0) const
List of actually allowed texturing modes for this particular object.
virtual std::vector< float > texValues(const std::vector< float > &pos, int poly=-1) const
virtual std::vector< float > glVoxelSize() const
virtual bool Is2DObject()
Can be displayed in 2D windows.
Definition Fusion2D.h:84
virtual Tree * optionTree() const
Menu tree for new options, see object/optionMatcher.h.
virtual unsigned dimTexture() const
Number of texture values for a point.
Definition Fusion2D.h:113
AObject * mri() const
Definition Fusion2D.h:68
void moveVolume(AObject *vol, int dstpos)
move the sub-object vol to position dstpos.
virtual void unregisterObservable(Observable *)
Called when an observable is destroyed, only called by Observable: don't use this function directly.
virtual float mixedTexValue(const std::vector< float > &pos, int poly=-1) const
Same as above except that coordinates are not transformed but taken in object coordinates system.
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 std::vector< float > texValues(const std::vector< float > &pos, const Referential *orgRef, int poly=-1) const
Gets the array of texture values at a given location.
virtual const GLComponent * glAPI() const
OpenGL objects const API.
Definition Fusion2D.h:63
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.
virtual AObject * fallbackReferentialInheritance() const
object to take referential from when no ref is assigned
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
virtual const Material * glMaterial() const
virtual const Sliceable * sliceableAPI() const
Definition Fusion2D.h:65
virtual bool render(PrimList &, const ViewState &)
rendering (generally 2D or 3D using OpenGL).
virtual void glSetChanged(glPart, bool=true) const
virtual float mixedTexValue(const std::vector< float > &pos, const Referential *orgRef, int poly=-1) const
Gets a "mixed" texture value at a given space / time location.
virtual std::vector< float > glMin2D() const
const Referential * getReferential() const
virtual std::vector< float > voxelSize() const
Returns at least 4 sizes. For 3D objects, returns (1, 1, 1, 1)
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:128
static Tree * _optionTree
Definition Fusion2D.h:131
bool isDynamic() const
Definition Fusion2D.h:127
virtual std::vector< float > glMax2D() 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.
This class has to be rewritten, it's really really a shame.......
Definition Material.h:48
virtual size_t size() const
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:56
std::list< carto::rc_ptr< GLItem > > PrimList
Definition Object.h:74
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
AimsVector< float, 3 > Point3df