anatomist 6.0.8
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();
63 virtual AObject *rgbVolumeFrom5D() const = 0;
65 virtual AObject *rgbaVolumeFrom5D() const = 0;
66 };
67
69 template <typename T>
70 class AVolume : public AVolumeBase
71 {
72 public:
73 AVolume( const std::string & filename = "" );
75 virtual ~AVolume();
76
77 virtual AObject* clone( bool shallow = true );
78
79 float MinT() const { return 0.0; }
80 float MaxT() const { return float(_volume->getSizeT()-1); }
81
82 virtual bool boundingBox2D( std::vector<float> & bmin,
83 std::vector<float> & bmax ) const;
84 virtual bool boundingBox( std::vector<float> & bmin,
85 std::vector<float> & bmax ) const;
86
87 void SetExtrema();
89
90 carto::rc_ptr<carto::Volume<T> > volume() { return _volume; }
91 const carto::rc_ptr<carto::Volume<T> > volume() const { return _volume; }
93 T & operator () ( size_t x=0, size_t y=0, size_t z=0, size_t t=0 )
94 { return (*_volume)( x, y , z ,t ); }
95 const T & operator () ( size_t x=0, size_t y=0, size_t z=0,
96 size_t t=0 ) const
97 { return (*_volume)( x, y , z ,t ); }
98
100 virtual bool update2DTexture( AImage &, const Point3df & posbase,
101 const SliceViewState &,
102 unsigned tex = 0 ) const;
103 virtual std::vector<float> voxelSize() const;
104 virtual void setVoxelSize( const std::vector<float> & vs );
106 float GetValue(Point3df pos,float time, Referential *winref,
107 Geometry *wingeom);
109 bool Is2DObject() { return(true); }
110 bool textured2D() const { return( true ); }
112 bool Is3DObject() { return(false); }
113 virtual bool isTransparent() const;
115 virtual AObject* objectAt( const std::vector<float> & pos, float tol = 0 );
116
117 virtual bool hasTexture() const { return( true ); }
118 virtual unsigned dimTexture() const { return( 1 ); }
119 virtual float mixedTexValue( const std::vector<float> & pos,
120 int poly = -1 ) const;
121 virtual std::vector<float>
122 texValues( const std::vector<float> & pos, int poly = -1 ) const;
123
125 virtual const carto::GenericObject* attributed() const;
126
127 virtual bool loadable() const { return( true ); }
128 virtual bool savable() const { return( true ); }
129 virtual bool reload( const std::string & filename );
130 virtual bool save( const std::string & filename );
131 virtual std::string objectFullTypeName(void) const;
132
134 virtual bool printTalairachCoord( const Point3df & pos,
135 const Referential* ) const;
136 virtual void setInternalsChanged();
138 virtual AObject *rgbVolumeFrom5D() const;
140 virtual AObject *rgbaVolumeFrom5D() const;
141
142 protected:
144 void updateSlice( AImage & image, const Point3df & p0,
145 const std::vector<float> & time,
146 const Transformation* tra, const Point3df & inc,
147 const Point3df & offset, const Geometry* wingeom ) const;
149 void updateAxial( AImage *ximage, const Point3df & p0,
150 const std::vector<float> & time ) const;
152 void updateCoronal( AImage *ximage, const Point3df & p0,
153 const std::vector<float> & time ) const;
155 void updateSagittal( AImage *ximage, const Point3df & p0,
156 const std::vector<float> & time ) const;
157
158 private:
159 struct PrivateData;
160 PrivateData *d;
162 };
163
164
165 template<class T>
166 inline AObject*
167 anatomist::AVolume<T>::objectAt( const std::vector<float> &, float )
168 { return 0; }
169
170}
171
172
173#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 * rgbVolumeFrom5D() const =0
some Nifti volumes are RGB/RGBA with channels separated in the 5th dim
virtual AObject * rgbaVolumeFrom5D() const =0
some Nifti volumes are RGB/RGBA with channels separated in the 5th dim
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:110
bool Is3DObject()
Can be display in 3D windows.
Definition Volume.h:112
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:118
bool Is2DObject()
Can be display in 2D windows.
Definition Volume.h:109
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:80
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:91
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:117
virtual AObject * rgbaVolumeFrom5D() const
some Nifti volumes are RGB/RGBA with channels separated in the 5th dim
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:79
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:167
virtual bool savable() const
Definition Volume.h:128
carto::rc_ptr< carto::Volume< T > > volume()
Definition Volume.h:90
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:93
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:127
virtual void setVoxelSize(const std::vector< float > &vs)
virtual AObject * rgbVolumeFrom5D() const
some Nifti volumes are RGB/RGBA with channels separated in the 5th dim
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