anatomist  5.1.2
3D neuroimaging data viewer
volumeview.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_VOLUMEVIEW_H
35 #define ANA_VOLUME_VOLUMEVIEW_H
36 
39 
40 
41 namespace anatomist
42 {
43 
44  template <typename T>
45  class AVolumeView : public ObjectVector
46  {
47  public:
48  AVolumeView( const std::list<AObject *> & );
49  AVolumeView( const std::string & filename );
51  AVolumeView( const std::vector<carto::rc_ptr<carto::Volume<T> > > & vols );
52  virtual ~AVolumeView();
53 
54  virtual void setVolume( carto::rc_ptr<carto::Volume<T> > vol );
55  // void move( const Point3d & pos, const Point3d & size );
56 
59  void setTargetSize( const std::vector<int> & );
60  const std::vector<int> & targetSize() const;
61  int resolutionLevel() const { return _resolution_level; }
62  int selectBestResolutionLevel( const Point3df & vs ) const;
63  const carto::rc_ptr<AVolume<T> > view() const { return _myvolume; }
64  carto::rc_ptr<AVolume<T> > view() { return _myvolume; }
65  Point3df initialFOV() const { return _initial_fov; }
66  void setInitialFOV( const Point3df & fov );
67 
68  // overloads
69  virtual int MType() const { return type(); }
70  static int classType();
71  virtual bool CanRemove( AObject* /*obj*/ ) { return false; }
72  virtual bool render( PrimList & prim, const ViewState & vs );
73  virtual void setFileName( const std::string & fname );
74  virtual void SetExtrema();
75  virtual void adjustPalette();
76  virtual std::vector<float> voxelSize() const
77  { return _myvolume->voxelSize(); }
78  bool Is2DObject() { return(true); }
79  bool textured2D() const { return( true ); }
80  bool Is3DObject() { return(false); }
81  virtual bool isTransparent() const { return _myvolume->isTransparent(); }
82  float MinT() const { return _myvolume->MinT(); }
83  float MaxT() const { return _myvolume->MaxT(); }
84  virtual bool boundingBox( std::vector<float> & bmin,
85  std::vector<float> & bmax ) const
86  { return _myvolume->boundingBox( bmin, bmax ); }
87  virtual bool boundingBox2D( std::vector<float> & bmin,
88  std::vector<float> & bmax ) const
89  { return _myvolume->boundingBox2D( bmin, bmax ); }
90 
91  virtual void update( const Observable *observable, void *arg );
92 
93  private:
94  void init( const std::vector<carto::rc_ptr<carto::Volume<T> > > & vols );
95 
96  carto::rc_ptr<AVolume<T> > _myvolume;
97  std::vector<carto::rc_ptr<AVolume<T> > > _avolume;
98  std::vector<int> _target_size;
99  Point3df _initial_fov;
100  int _resolution_level;
101  };
102 
103 }
104 
105 #endif
Base Anatomist object (abstract)
Definition: Object.h:96
int type() const
Object type identifier.
Definition: Object.h:158
virtual std::vector< float > voxelSize() const
Returns at least 4 sizes. For 3D objects, returns (1, 1, 1, 1)
Definition: volumeview.h:76
virtual int MType() const
Precise type of multi-object.
Definition: volumeview.h:69
bool Is2DObject()
Can be display in 2D windows.
Definition: volumeview.h:78
static int classType()
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.
Definition: volumeview.h:84
AVolumeView(carto::rc_ptr< carto::Volume< T > > vol)
virtual void setVolume(carto::rc_ptr< carto::Volume< T > > vol)
virtual void SetExtrema()
Scans the object internals and determines its (texture) extrema values.
virtual void adjustPalette()
Creates or updates object palette according to object values (if needed)
AVolumeView(const std::vector< carto::rc_ptr< carto::Volume< T > > > &vols)
bool textured2D() const
true if 2D rendering uses a textured plane (not a full openGL object)
Definition: volumeview.h:79
virtual bool boundingBox2D(std::vector< float > &bmin, std::vector< float > &bmax) const
Bounding box in 2D views mode.
Definition: volumeview.h:87
void setupTransformationFromView()
Point3df initialFOV() const
Definition: volumeview.h:65
virtual bool CanRemove(AObject *)
Definition: volumeview.h:71
int resolutionLevel() const
Definition: volumeview.h:61
virtual void update(const Observable *observable, void *arg)
This class is an Observer of each of the AObject it groups.
float MinT() const
Obsolete, deprecated.
Definition: volumeview.h:82
void setupViewFromTransformation()
const std::vector< int > & targetSize() const
AVolumeView(const std::list< AObject * > &)
float MaxT() const
Obsolete, deprecated.
Definition: volumeview.h:83
carto::rc_ptr< AVolume< T > > view()
Definition: volumeview.h:64
AVolumeView(const std::string &filename)
int selectBestResolutionLevel(const Point3df &vs) const
virtual bool render(PrimList &prim, const ViewState &vs)
rendering (generally 2D or 3D using OpenGL).
virtual bool isTransparent() const
Definition: volumeview.h:81
virtual void setFileName(const std::string &fname)
void setInitialFOV(const Point3df &fov)
void setTargetSize(const std::vector< int > &)
const carto::rc_ptr< AVolume< T > > view() const
Definition: volumeview.h:63
bool Is3DObject()
Can be display in 3D windows.
Definition: volumeview.h:80
it's a list, in fact...
Definition: objectVector.h:212
This class can be subclassed to represent an object that the programmer wants to have observed.
Definition: Observable.h:68
std::list< carto::rc_ptr< GLItem > > PrimList
Definition: Object.h:72
ViewState holds information about how a view wants to see an object.
Definition: viewstate.h:67