aimsalgo 6.0.0
Neuroimaging image processing
splinepyramid.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 AIMS_PYRAMID_SPLINEPYRAMID_H
35#define AIMS_PYRAMID_SPLINEPYRAMID_H
36
37//--- aims -------------------------------------------------------------------
39#include <aims/vector/vector.h>
40//--- cartodata --------------------------------------------------------------
41#include <cartodata/volume/volume.h>
42//--- std --------------------------------------------------------------------
43#include <vector>
44//----------------------------------------------------------------------------
45
46namespace aims {
47
48 //==========================================================================
49 //
50 // SPLINE PYRAMID
51 //
52 //==========================================================================
53
56 {
57 public:
58 //------------------------------------------------------------------------
60 //------------------------------------------------------------------------
65
66 //------------------------------------------------------------------------
68 //------------------------------------------------------------------------
70 SplinePyramid( const std::vector<InterpolatedVolume> & pyramid
71 = std::vector<InterpolatedVolume>() );
72 template <typename T>
73 SplinePyramid( const std::vector<carto::VolumeRef<T> > & pyramid,
74 unsigned order = 3,
75 bool is_coeff = false );
76 SplinePyramid( const SplinePyramid & other );
80
81 //------------------------------------------------------------------------
83 //------------------------------------------------------------------------
85 const std::vector<InterpolatedVolume> & pyramid() const;
86 void setPyramid( const std::vector<InterpolatedVolume> & pyramid );
88
89 //------------------------------------------------------------------------
91 //------------------------------------------------------------------------
93 InterpolatedVolume & operator[] ( unsigned level );
94 const InterpolatedVolume & operator[] ( unsigned level ) const;
95 int nlevel() const;
97
98 //------------------------------------------------------------------------
100 //------------------------------------------------------------------------
102 double getSizeXMm() const;
103 double getSizeYMm() const;
104 double getSizeZMm() const;
105 carto::PropertySet & header( unsigned level = 0 );
106 const carto::PropertySet & header( unsigned level = 0 ) const;
108
109 protected:
110 std::vector<InterpolatedVolume> _pyramid;
111 };
112
113
114 //==========================================================================
115 //
116 // SPLINE PYRAMID BUILDER
117 //
118 //==========================================================================
119
124 {
125 public:
126 //------------------------------------------------------------------------
128 //------------------------------------------------------------------------
130 SplinePyramidBuilder( unsigned factor = 2, unsigned spline_order = 3 );
131 SplinePyramidBuilder( const Point4du & factor, unsigned spline_order = 3 );
132 SplinePyramidBuilder( const std::vector<Point4du> & factor, unsigned spline_order = 3 );
134 virtual ~SplinePyramidBuilder();
137
138 //------------------------------------------------------------------------
140 //------------------------------------------------------------------------
142 unsigned order() const;
143 const std::vector<bool> & directions() const;
144 const std::vector<Point4du> & factor() const;
145 void setOrder( unsigned n );
146 void setFactor( unsigned r );
147 void setFactor( const Point4du & r );
148 void setFactor( const std::vector<Point4du> & r );
149 void setDirections( const std::vector<bool> & dir );
150 void setDirections( bool dirx, bool diry, bool dirz, bool dirt );
151 void setVerbose( int verbose = 1 );
152 void setQuiet();
154
155 //------------------------------------------------------------------------
157 //------------------------------------------------------------------------
159 template <typename T>
160 SplinePyramid execute( const carto::VolumeRef<T> & vol, bool is_coeff = false ) const;
162
163 protected:
164 unsigned _order;
165 std::vector<Point4du> _factor;
166 std::vector<bool> _dir;
168
169 //------------------------------------------------------------------------
170 // Helpers
171 //------------------------------------------------------------------------
172 std::vector<Point4du> computeFactors( const std::vector<int> & size ) const;
173 };
174
175 //--------------------------------------------------------------------------
177 //--------------------------------------------------------------------------
178 template <typename T>
180 unsigned order, unsigned factor = 2 )
181 {
182 SplinePyramidBuilder builder( factor, order );
183 return builder.execute( vol );
184 }
185
186 template <typename T>
188 unsigned order, const Point4du & factor )
189 {
190 SplinePyramidBuilder builder( factor, order );
191 return builder.execute( vol );
192 }
193 template <typename T>
195 unsigned order,
196 const std::vector<Point4du> & factor )
197 {
198 SplinePyramidBuilder builder( factor, order );
199 return builder.execute( vol );
200 }
201
202 template <typename T>
204 unsigned factor = 2 )
205 {
206 SplinePyramidBuilder builder( factor, 3 );
207 return builder.execute( vol );
208 }
209
210 template <typename T>
212 const Point4du & factor )
213 {
214 SplinePyramidBuilder builder( factor, 3 );
215 return builder.execute( vol );
216 }
217
218 template <typename T>
220 const std::vector<Point4du> & factor )
221 {
222 SplinePyramidBuilder builder( factor, 3 );
223 return builder.execute( vol );
224 }
225
226} // namespace aims
227
228#endif // AIMS_PYRAMID_SPLINEPYRAMID_H
Spline interpolation of volumes with simple accessors to interpolated values.
carto::VolumeRef< double > Matrix
The method follows that of Under, Aldroubi & Eden, "The L2 Polynomial Spline Pyramid" in IEEE Transac...
void setDirections(const std::vector< bool > &dir)
SplinePyramidBuilder(unsigned factor=2, unsigned spline_order=3)
Constructors / Destructors / Copy.
unsigned order() const
Parameters.
const std::vector< bool > & directions() const
std::vector< bool > _dir
void setVerbose(int verbose=1)
SplinePyramid execute(const carto::VolumeRef< T > &vol, bool is_coeff=false) const
Execution.
std::vector< Point4du > computeFactors(const std::vector< int > &size) const
Execution.
std::vector< Point4du > _factor
const std::vector< Point4du > & factor() const
SplinePyramidBuilder & operator=(const SplinePyramidBuilder &other)
Pyramid of Interpolated Volumes.
double getSizeYMm() const
const std::vector< InterpolatedVolume > & pyramid() const
Change pyramid.
const carto::PropertySet & header(unsigned level=0) const
InterpolatedVolume & operator[](unsigned level)
Level accessor.
SplinePyramid & operator=(const SplinePyramid &other)
InterpolatedVolume::Matrix Matrix
SplinePyramid(const std::vector< InterpolatedVolume > &pyramid=std::vector< InterpolatedVolume >())
Constructors / Destructors / Copy.
std::vector< InterpolatedVolume > _pyramid
SplinePyramid(const SplinePyramid &other)
void setPyramid(const std::vector< InterpolatedVolume > &pyramid)
double getSizeZMm() const
double getSizeXMm() const
Dimensions.
carto::PropertySet & header(unsigned level=0)
int nlevel() const
InterpolatedVolume::Vector Vector
InterpolatedVolume types.
SplinePyramid buildSplinePyramid(const carto::VolumeRef< T > &vol, unsigned order, unsigned factor=2)
FUNCTORS.
SplinePyramid cubicSplinePyramid(const carto::VolumeRef< T > &vol, unsigned factor=2)
AimsVector< uint32_t, 4 > Point4du