anatomist 6.0.4
3D neuroimaging data viewer
Volume.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_VOLUME_VOLUME_H
35#define ANA_VOLUME_VOLUME_H
36
39#include <cartodata/volume/volume.h>
40#include <aims/rgb/rgb.h>
41
42
43namespace anatomist
44{
45
46 class Referential;
47 class Transformation;
48 class Geometry;
49
53 : public SliceableObject, public PythonAObject
54 {
55 public:
57 virtual ~AVolumeBase();
58
59 virtual void setShaderParameters( const Shader &shader,
60 const ViewState & state ) const;
61 virtual void internalUpdate();
62 };
63
65 template <typename T>
66 class AVolume : public AVolumeBase
67 {
68 public:
69 AVolume( const std::string & filename = "" );
71 virtual ~AVolume();
72
73 virtual AObject* clone( bool shallow = true );
74
75 float MinT() const { return 0.0; }
76 float MaxT() const { return float(_volume->getSizeT()-1); }
77
78 virtual bool boundingBox2D( std::vector<float> & bmin,
79 std::vector<float> & bmax ) const;
80 virtual bool boundingBox( std::vector<float> & bmin,
81 std::vector<float> & bmax ) const;
82
83 void SetExtrema();
85
86 carto::rc_ptr<carto::Volume<T> > volume() { return _volume; }
87 const carto::rc_ptr<carto::Volume<T> > volume() const { return _volume; }
89 T & operator () ( size_t x=0, size_t y=0, size_t z=0, size_t t=0 )
90 { return (*_volume)( x, y , z ,t ); }
91 const T & operator () ( size_t x=0, size_t y=0, size_t z=0,
92 size_t t=0 ) const
93 { return (*_volume)( x, y , z ,t ); }
94
96 virtual bool update2DTexture( AImage &, const Point3df & posbase,
97 const SliceViewState &,
98 unsigned tex = 0 ) const;
99 virtual std::vector<float> voxelSize() const;
100 virtual void setVoxelSize( const std::vector<float> & vs );
102 float GetValue(Point3df pos,float time, Referential *winref,
103 Geometry *wingeom);
105 bool Is2DObject() { return(true); }
106 bool textured2D() const { return( true ); }
108 bool Is3DObject() { return(false); }
109 virtual bool isTransparent() const;
111 virtual AObject* objectAt( const std::vector<float> & pos, float tol = 0 );
112
113 virtual bool hasTexture() const { return( true ); }
114 virtual unsigned dimTexture() const { return( 1 ); }
115 virtual float mixedTexValue( const std::vector<float> & pos,
116 int poly = -1 ) const;
117 virtual std::vector<float>
118 texValues( const std::vector<float> & pos, int poly = -1 ) const;
119
121 virtual const carto::GenericObject* attributed() const;
122
123 virtual bool loadable() const { return( true ); }
124 virtual bool savable() const { return( true ); }
125 virtual bool reload( const std::string & filename );
126 virtual bool save( const std::string & filename );
127 virtual std::string objectFullTypeName(void) const;
128
130 virtual bool printTalairachCoord( const Point3df & pos,
131 const Referential* ) const;
132 virtual void setInternalsChanged();
133
134 protected:
136 void updateSlice( AImage & image, const Point3df & p0,
137 const std::vector<float> & time,
138 const Transformation* tra, const Point3df & inc,
139 const Point3df & offset, const Geometry* wingeom ) const;
141 void updateAxial( AImage *ximage, const Point3df & p0,
142 const std::vector<float> & time ) const;
144 void updateCoronal( AImage *ximage, const Point3df & p0,
145 const std::vector<float> & time ) const;
147 void updateSagittal( AImage *ximage, const Point3df & p0,
148 const std::vector<float> & time ) const;
149
150 private:
151 struct PrivateData;
152 PrivateData *d;
154 };
155
156
157 template<class T>
158 inline AObject*
159 anatomist::AVolume<T>::objectAt( const std::vector<float> &, float )
160 { return 0; }
161
162}
163
164
165#endif
Base Anatomist object (abstract)
Definition Object.h:97
virtual void internalUpdate()
Updates the state of the object.
virtual void setShaderParameters(const Shader &shader, const ViewState &state) const
virtual AObject * clone(bool shallow=true)
Makes a copy of the object, with a duplicated object structure, palette and material,...
bool textured2D() const
true if 2D rendering uses a textured plane (not a full openGL object)
Definition Volume.h:106
bool Is3DObject()
Can be display in 3D windows.
Definition Volume.h:108
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 unsigned dimTexture() const
Number of texture values for a point.
Definition Volume.h:114
bool Is2DObject()
Can be display in 2D windows.
Definition Volume.h:105
void updateSagittal(AImage *ximage, const Point3df &p0, const std::vector< float > &time) const
Optimized texture filling routine (no transformation)
virtual bool isTransparent() const
float GetValue(Point3df pos, float time, Referential *winref, Geometry *wingeom)
Retourne la valeur d'un voxel du volume.
AVolume(carto::rc_ptr< carto::Volume< T > >)
void adjustPalette()
Creates or updates object palette according to object values (if needed)
float MaxT() const
Obsolete, deprecated.
Definition Volume.h:76
virtual carto::GenericObject * attributed()
virtual void setInternalsChanged()
Notifies some underlying lower-level objects have changed.
const carto::rc_ptr< carto::Volume< T > > volume() const
Definition Volume.h:87
virtual const carto::GenericObject * attributed() const
virtual void setVolume(carto::rc_ptr< carto::Volume< T > > vol)
virtual bool hasTexture() const
Textured objects have values associated with a geometric coordinate.
Definition Volume.h:113
void updateSlice(AImage &image, const Point3df &p0, const std::vector< float > &time, const Transformation *tra, const Point3df &inc, const Point3df &offset, const Geometry *wingeom) const
Generic texture filling routine for any transformation.
virtual std::string objectFullTypeName(void) const
Get Object Full Type Name.
virtual bool reload(const std::string &filename)
Re-reads objects from disk.
void updateAxial(AImage *ximage, const Point3df &p0, const std::vector< float > &time) const
Optimized texture filling routine (no transformation)
virtual bool printTalairachCoord(const Point3df &pos, const Referential *) const
should be replaced by a real referential
virtual bool boundingBox2D(std::vector< float > &bmin, std::vector< float > &bmax) const
Bounding box in 2D views mode.
float MinT() const
Obsolete, deprecated.
Definition Volume.h:75
AVolume(const std::string &filename="")
virtual std::vector< float > texValues(const std::vector< float > &pos, int poly=-1) const
void SetExtrema()
Scans the object internals and determines its (texture) extrema values.
virtual AObject * objectAt(const std::vector< float > &pos, float tol=0)
Not selectable: always returns Null.
Definition Volume.h:159
virtual bool savable() const
Definition Volume.h:124
carto::rc_ptr< carto::Volume< T > > volume()
Definition Volume.h:86
void updateCoronal(AImage *ximage, const Point3df &p0, const std::vector< float > &time) const
Optimized texture filling routine (no transformation)
T & operator()(size_t x=0, size_t y=0, size_t z=0, size_t t=0)
Definition Volume.h:89
virtual bool update2DTexture(AImage &, const Point3df &posbase, const SliceViewState &, unsigned tex=0) const
new API
virtual std::vector< float > voxelSize() const
Returns at least 4 sizes. For 3D objects, returns (1, 1, 1, 1)
virtual bool loadable() const
Definition Volume.h:123
virtual void setVoxelSize(const std::vector< float > &vs)
virtual bool save(const std::string &filename)
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.
Referential: marker for transformations, with an associated color.
Definition Referential.h:56
Transformation between two referentials.
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