aimsalgo  5.0.5
Neuroimaging image processing
resampler.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 
35 #ifndef AIMS_RESAMPLING_RESAMPLER_H
36 #define AIMS_RESAMPLING_RESAMPLER_H
37 
38 
40 #include <aims/vector/vector.h>
43 
44 namespace aims
45 {
46 
74 template <class T>
75 class Resampler : public virtual carto::RCObject
76 {
77 public:
78 
79  Resampler();
80  virtual ~Resampler() { }
81 
104  void doit( const aims::AffineTransformation3d& transform,
105  carto::Volume<T>& output_data ) const;
106 
139  int dimX, int dimY,
140  int dimZ, const Point3df& voxel_size ) const;
141 
168  virtual void resample( const carto::Volume< T >& input_data,
169  const aims::AffineTransformation3d& transform,
170  const T& background,
171  carto::Volume< T > & output_data,
172  bool verbose = false ) const;
173 
192  void resample( const carto::Volume< T >& input_data,
193  const aims::AffineTransformation3d& transform,
194  const T& background,
195  const Point3df& output_location,
196  T& output_value, int timestep ) const;
197 
215  void
216  resample_inv( const carto::Volume< T > &input_data,
217  const soma::Transformation3d &inverse_transform_to_mm,
218  const T &background, const Point3df &output_location,
219  T &output_value, int timestep ) const;
220 
242  void resample_inv( const carto::Volume< T >& input_data,
243  const soma::Transformation3d& inverse_transform_to_mm,
244  const T& background,
245  carto::Volume< T > & output_data,
246  bool verbose = false ) const;
247 
265  void
267  const soma::Transformation3d &inverse_transform_to_vox,
268  const T &background, const Point3df &output_location,
269  T &output_value, int timestep ) const
270  {
271  updateParameters( input_data, timestep, carto::verbose );
272  return doResample(input_data, inverse_transform_to_vox, background,
273  output_location, output_value, timestep);
274  }
275 
302  virtual void resample_inv_to_vox( const carto::Volume< T >& input_data,
303  const soma::Transformation3d& inverse_transform_to_vox,
304  const T& background,
305  carto::Volume< T > & output_data,
306  bool verbose = false ) const;
307 
309  void setRef( const carto::rc_ptr<carto::Volume<T> >& ref );
310 
312  const carto::rc_ptr<carto::Volume<T> >& ref() const { return _ref; }
313 
315  void setDefaultValue( T val ) { _defval = val; }
316 
318  const T& defaultValue() const { return _defval; };
319 
320 protected:
321 
336  virtual void
337  doResample( const carto::Volume< T > &input_data,
338  const soma::Transformation3d &inverse_transform,
339  const T &background, const Point3df &output_location,
340  T &output_value, int timestep ) const = 0;
341 
349  virtual void updateParameters( const carto::Volume< T > & /*inVolume*/,
350  int /*time*/,
351  bool /*verbose*/ ) const {};
352 
355 };
356 
357 } // namespace aims
358 
359 #endif
virtual void resample(const carto::Volume< T > &input_data, const aims::AffineTransformation3d &transform, const T &background, carto::Volume< T > &output_data, bool verbose=false) const
Resample a volume into an existing output volume.
Definition: resampler_d.h:175
virtual void doResample(const carto::Volume< T > &input_data, const soma::Transformation3d &inverse_transform, const T &background, const Point3df &output_location, T &output_value, int timestep) const =0
Resample a volume at a single location.
void doit(const aims::AffineTransformation3d &transform, carto::Volume< T > &output_data) const
Resample the input volume set with setRef() into an existing volume.
Definition: resampler_d.h:222
void resample_inv_to_vox(const carto::Volume< T > &input_data, const soma::Transformation3d &inverse_transform_to_vox, const T &background, const Point3df &output_location, T &output_value, int timestep) const
Resample a volume at a single location.
Definition: resampler.h:266
virtual void updateParameters(const carto::Volume< T > &, int, bool) const
Method called before doResample() for each time step.
Definition: resampler.h:349
int verbose
virtual ~Resampler()
Definition: resampler.h:80
void setDefaultValue(T val)
Set the background value to be used by the doit() methods.
Definition: resampler.h:315
void resample_inv(const carto::Volume< T > &input_data, const soma::Transformation3d &inverse_transform_to_mm, const T &background, const Point3df &output_location, T &output_value, int timestep) const
Resample a volume at a single location.
Definition: resampler_d.h:151
void setRef(const carto::rc_ptr< carto::Volume< T > > &ref)
Set the input data to be resampled by the doit() methods.
Definition: resampler_d.h:307
carto::rc_ptr< carto::Volume< T > > _ref
Definition: resampler.h:351
Resampling of data from a volume, applying a transformation.
Definition: resampler.h:75
const carto::rc_ptr< carto::Volume< T > > & ref() const
Input data to be resampled by the doit() methods.
Definition: resampler.h:312
const T & defaultValue() const
Background value used by the doit() methods.
Definition: resampler.h:318