aimsalgo  5.1.2
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 <cartodata/volume/volume.h> // Volume
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 );
83 
86  double at( double x, double y = 0., double z = 0., long t = 0 ) const;
87  Vector derivative( double x, double y = 0., double z = 0., long t = 0 ) const;
88  Matrix nderivative( unsigned n, double x, double y = 0., double z = 0., long t = 0 ) const;
89  // aliases
90  double operator() ( double x, double y = 0., double z = 0., long t = 0 ) const;
91  Vector der( double x, double y = 0., double z = 0., long t = 0 ) const;
92  Matrix der2( double x, double y = 0., double z = 0., long t = 0 ) const;
93  Matrix der3( double x, double y = 0., double z = 0., long t = 0 ) const;
95 
98  double atMm( double x, double y = 0., double z = 0., long t = 0 ) const;
99  Vector derivativeMm( double x, double y = 0., double z = 0., long t = 0 ) const;
100  Matrix nderivativeMm( unsigned n, double x, double y = 0., double z = 0., long t = 0 ) const;
101  // aliases
102  Vector derMm( double x, double y = 0., double z = 0., long t = 0 ) const;
103  Matrix der2Mm( double x, double y = 0., double z = 0., long t = 0 ) const;
104  Matrix der3Mm( double x, double y = 0., double z = 0., long t = 0 ) const;
105  // dimension
106  double getSizeXMm() const;
107  double getSizeYMm() const;
108  double getSizeZMm() const;
110 
114  const carto::PropertySet & header() const;
115  double getSizeX() const;
116  double getSizeY() const;
117  double getSizeZ() const;
118  long getSizeT() const;
120 
123  template <typename T>
124  void setVolume( const carto::Volume<T> & vol, int order = -1 );
125  template <typename T>
126  void setVolume( const carto::VolumeRef<T> & vol, int order = -1 );
128 
131  template <typename T>
132  void setCoeff( const carto::Volume<T> & vol, int order = -1 );
133  template <typename T>
134  void setCoeff( const carto::VolumeRef<T> & vol, int order = -1 );
136 
140  unsigned order() const;
142  bool empty() const;
148  void setFastMode();
153 
159 
160  protected:
161  unsigned _order;
164  };
165 
166 } // namespace aims
167 
168 #endif // AIMS_INTERPOLATION_INTERPOLATEDVOLUME_H
Spline interpolation of volumes with simple accessors to interpolated values.
Matrix der2(double x, double y=0., double z=0., long t=0) const
carto::PropertySet & header()
Header / Dimension.
double getSizeYMm() const
InterpolatedVolume & operator=(const InterpolatedVolume &other)
Assignment by copy (underlying data is fully copied and not shared between the volumes)
Vector derivative(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
double getSizeZMm() const
carto::VolumeRef< double > Matrix
double at(double x, double y=0., double z=0., long t=0) const
Access interpolated values.
double getSizeXMm() const
Matrix der3(double x, double y=0., double z=0., long t=0) const
InterpolatedVolume()
Constructors / Destructors / CopyDefault constructor: allocates no data.
Matrix nderivative(unsigned n, double x, double y=0., double z=0., long t=0) const
Matrix der2Mm(double x, double y=0., double z=0., long t=0) const
unsigned order() const
ParametersInterpolation order.
Matrix der3Mm(double x, double y=0., double z=0., long t=0) const
Vector derivativeMm(double x, double y=0., double z=0., long t=0) const
void setCoeff(const carto::Volume< T > &vol, int order=-1)
Change coefficient volume.
Vector der(double x, double y=0., double z=0., long t=0) const
void setRecursiveMode()
Recursive/Fast/Tabular mode (default is Fast)
const carto::VolumeRef< double > & coefficients() const
void setTabularMode()
Recursive/Fast/Tabular mode (default is Fast)
double getSizeZ() const
virtual ~InterpolatedVolume()
Destructor.
carto::rc_ptr< BSpline > _spline
bool empty() const
Is the volume empty (true if only default constructed)
const carto::PropertySet & header() const
double atMm(double x, double y=0., double z=0., long t=0) const
Access interpolated values in mm.
carto::VolumeRef< double > & coefficients()
Access to coefficients.
carto::VolumeRef< double > _coeff
void setFastMode()
Recursive/Fast/Tabular mode (default is Fast)
void setVolume(const carto::Volume< T > &vol, int order=-1)
Change interpolated volume.
double getSizeY() const
Matrix nderivativeMm(unsigned n, double x, double y=0., double z=0., long t=0) const
InterpolatedVolume(const InterpolatedVolume &other)
Copy constructor (underlying data is fully copied and not shared between the volumes)
double getSizeX() const
Vector derMm(double x, double y=0., double z=0., long t=0) const