aimsalgo  5.0.5
Neuroimaging image processing
interpolatedvolume.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 #ifndef AIMS_INTERPOLATION_INTERPOLATEDVOLUME_H
34 #define AIMS_INTERPOLATION_INTERPOLATEDVOLUME_H
35 
36 //--- aims -------------------------------------------------------------------
37 #include <aims/data/data.h> // AimsData
38 #include <aims/math/bspline.h> // aims::TabulBSpline
39 #include <aims/vector/vector.h> // Point*
40 //--- cartodata --------------------------------------------------------------
41 #include <cartodata/volume/volume.h> // carto::VolumeRef
42 //--- cartobase --------------------------------------------------------------
43 #include <cartobase/smart/rcptr.h> // carto::rc_ptr
44 //----------------------------------------------------------------------------
45 
46 namespace aims {
47 
48  //==========================================================================
49  //
50  // CONTINUOUS VOLUME
51  //
52  //==========================================================================
56  {
57  public:
59  typedef Point3dd Vector;
61 
69  template <typename T>
70  InterpolatedVolume( const carto::Volume<T> & vol, unsigned order = 3 );
72  template <typename T>
73  InterpolatedVolume( const carto::VolumeRef<T> & vol, unsigned order = 3 );
75  template <typename T>
76  InterpolatedVolume( const AimsData<T> & vol, unsigned order = 3 );
79  InterpolatedVolume( const InterpolatedVolume & other );
81  virtual ~InterpolatedVolume();
86 
89  double at( double x, double y = 0., double z = 0., long t = 0 ) const;
90  Vector derivative( double x, double y = 0., double z = 0., long t = 0 ) const;
91  Matrix nderivative( unsigned n, double x, double y = 0., double z = 0., long t = 0 ) const;
92  // aliases
93  double operator() ( double x, double y = 0., double z = 0., long t = 0 ) const;
94  Vector der( double x, double y = 0., double z = 0., long t = 0 ) const;
95  Matrix der2( double x, double y = 0., double z = 0., long t = 0 ) const;
96  Matrix der3( double x, double y = 0., double z = 0., long t = 0 ) const;
98 
101  double atMm( double x, double y = 0., double z = 0., long t = 0 ) const;
102  Vector derivativeMm( double x, double y = 0., double z = 0., long t = 0 ) const;
103  Matrix nderivativeMm( unsigned n, double x, double y = 0., double z = 0., long t = 0 ) const;
104  // aliases
105  Vector derMm( double x, double y = 0., double z = 0., long t = 0 ) const;
106  Matrix der2Mm( double x, double y = 0., double z = 0., long t = 0 ) const;
107  Matrix der3Mm( double x, double y = 0., double z = 0., long t = 0 ) const;
108  // dimension
109  double getSizeXMm() const;
110  double getSizeYMm() const;
111  double getSizeZMm() const;
113 
117  const carto::PropertySet & header() const;
118  double getSizeX() const;
119  double getSizeY() const;
120  double getSizeZ() const;
121  long getSizeT() const;
123 
126  template <typename T>
127  void setVolume( const carto::Volume<T> & vol, int order = -1 );
128  template <typename T>
129  void setVolume( const carto::VolumeRef<T> & vol, int order = -1 );
130  template <typename T>
131  void setVolume( const AimsData<T> & vol, int order = -1 );
133 
136  template <typename T>
137  void setCoeff( const carto::Volume<T> & vol, int order = -1 );
138  template <typename T>
139  void setCoeff( const carto::VolumeRef<T> & vol, int order = -1 );
140  template <typename T>
141  void setCoeff( const AimsData<T> & vol, int order = -1 );
143 
147  unsigned order() const;
149  bool empty() const;
152  void setRecursiveMode();
155  void setFastMode();
158  void setTabularMode();
160 
164  const carto::VolumeRef<double> & coefficients() const;
166 
167  protected:
168  unsigned _order;
171  };
172 
173 } // namespace aims
174 
175 #endif // AIMS_INTERPOLATION_INTERPOLATEDVOLUME_H
carto::rc_ptr< BSpline > _spline
double getSizeZ() const
Spline interpolation of volumes with simple accessors to interpolated values.
void setVolume(const carto::Volume< T > &vol, int order=-1)
Change interpolated volume.
Matrix der3(double x, double y=0., double z=0., long t=0) const
double atMm(double x, double y=0., double z=0., long t=0) const
Access interpolated values in mm.
double getSizeZMm() const
void setCoeff(const carto::Volume< T > &vol, int order=-1)
Change coefficient volume.
carto::VolumeRef< double > Matrix
double at(double x, double y=0., double z=0., long t=0) const
Access interpolated values.
carto::VolumeRef< double > & coefficients()
Access to coefficients.
void setRecursiveMode()
Recursive/Fast/Tabular mode (default is Fast)
Matrix der2(double x, double y=0., double z=0., long t=0) const
bool empty() const
Is the volume empty (true if only default constructed)
double getSizeY() const
InterpolatedVolume()
Constructors / Destructors / CopyDefault constructor: allocates no data.
Vector der(double x, double y=0., double z=0., long t=0) const
carto::PropertySet & header()
Header / Dimension.
Matrix nderivative(unsigned n, double x, double y=0., double z=0., long t=0) const
double getSizeXMm() const
Vector derivativeMm(double x, double y=0., double z=0., long t=0) const
double getSizeYMm() const
Matrix der2Mm(double x, double y=0., double z=0., long t=0) const
carto::VolumeRef< double > _coeff
void setFastMode()
Recursive/Fast/Tabular mode (default is Fast)
Vector derMm(double x, double y=0., double z=0., long t=0) const
double operator()(double x, double y=0., double z=0., long t=0) const
Matrix nderivativeMm(unsigned n, double x, double y=0., double z=0., long t=0) const
void setTabularMode()
Recursive/Fast/Tabular mode (default is Fast)
Vector derivative(double x, double y=0., double z=0., long t=0) const
InterpolatedVolume & operator=(const InterpolatedVolume &other)
Assignment by copy (underlying data is fully copied and not shared between the volumes) ...
unsigned order() const
ParametersInterpolation order.
Matrix der3Mm(double x, double y=0., double z=0., long t=0) const
virtual ~InterpolatedVolume()
Destructor.
double getSizeX() const