aimsalgo 6.0.0
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
39#include <cartodata/volume/volume.h>
40#include <aims/vector/vector.h>
42#include <aims/transformation/affinetransformation3d.h>
43
44namespace aims
45{
46
74template <class T>
75class Resampler : public virtual carto::RCObject
76{
77public:
78
79 Resampler();
80 virtual ~Resampler() { }
81
84 void setVerboseStream( std::ostream & stream )
85 { _verbose_stream = &stream; }
86
109 void doit( const aims::AffineTransformation3d& transform,
110 carto::Volume<T>& output_data ) const;
111
144 int dimX, int dimY,
145 int dimZ, const Point3df& voxel_size ) const;
146
173 virtual void resample( const carto::Volume< T >& input_data,
174 const aims::AffineTransformation3d& transform,
175 const T& background,
176 carto::Volume< T > & output_data,
177 bool verbose = false ) const;
178
197 void resample( const carto::Volume< T >& input_data,
198 const aims::AffineTransformation3d& transform,
199 const T& background,
200 const Point3df& output_location,
201 T& output_value, int timestep ) const;
202
220 void
221 resample_inv( const carto::Volume< T > &input_data,
222 const soma::Transformation3d &inverse_transform_to_mm,
223 const T &background, const Point3df &output_location,
224 T &output_value, int timestep ) const;
225
247 void resample_inv( const carto::Volume< T >& input_data,
248 const soma::Transformation3d& inverse_transform_to_mm,
249 const T& background,
250 carto::Volume< T > & output_data,
251 bool verbose = false ) const;
252
270 void
272 const soma::Transformation3d &inverse_transform_to_vox,
273 const T &background, const Point3df &output_location,
274 T &output_value, int timestep ) const
275 {
276 updateParameters( input_data, timestep, carto::verbose );
277 return doResample(input_data, inverse_transform_to_vox, background,
278 output_location, output_value, timestep);
279 }
280
307 virtual void resample_inv_to_vox( const carto::Volume< T >& input_data,
308 const soma::Transformation3d& inverse_transform_to_vox,
309 const T& background,
310 carto::Volume< T > & output_data,
311 bool verbose = false ) const;
312
314 void setRef( const carto::rc_ptr<carto::Volume<T> >& ref );
315
317 const carto::rc_ptr<carto::Volume<T> >& ref() const { return _ref; }
318
320 void setDefaultValue( T val ) { _defval = val; }
321
323 const T& defaultValue() const { return _defval; };
324
325protected:
326
341 virtual void
342 doResample( const carto::Volume< T > &input_data,
343 const soma::Transformation3d &inverse_transform,
344 const T &background, const Point3df &output_location,
345 T &output_value, int timestep ) const = 0;
346
354 virtual void updateParameters( const carto::Volume< T > & /*inVolume*/,
355 int /*time*/,
356 bool /*verbose*/ ) const {};
357
360 std::ostream *_verbose_stream;
361};
362
363} // namespace aims
364
365#endif
virtual void updateParameters(const carto::Volume< T > &, int, bool) const
Method called before doResample() for each time step.
Definition resampler.h:354
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.
const T & defaultValue() const
Background value used by the doit() methods.
Definition resampler.h:323
void setVerboseStream(std::ostream &stream)
write verbose progress information to this stream.
Definition resampler.h:84
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 setRef(const carto::rc_ptr< carto::Volume< T > > &ref)
Set the input data to be resampled by the doit() methods.
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.
void doit(const aims::AffineTransformation3d &transform, carto::Volume< T > &output_data) const
Resample the input volume set with setRef() into an existing volume.
virtual ~Resampler()
Definition resampler.h:80
carto::rc_ptr< carto::Volume< T > > _ref
Definition resampler.h:358
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:271
void setDefaultValue(T val)
Set the background value to be used by the doit() methods.
Definition resampler.h:320
std::ostream * _verbose_stream
Definition resampler.h:360
const carto::rc_ptr< carto::Volume< T > > & ref() const
Input data to be resampled by the doit() methods.
Definition resampler.h:317
int verbose
AimsVector< float, 3 > Point3df