38 #ifndef AIMS_LINEAR_INTERPOLATOR 
   39 #define AIMS_LINEAR_INTERPOLATOR 
   75     return isValid( point[ 0 ], point[ 1 ], point[ 2 ] );
 
   83     return do_interpolation( x, y, z );
 
   89     return do_interpolation( point[ 0 ], point[ 1 ], point[ 2 ] );
 
   93                              std::vector<Scalar_t> & v ) 
const 
   96     do_interpolations( x, y, z, v );
 
  100                             std::vector<Scalar_t> &v ) 
const 
  103     do_interpolations( point[ 0 ], point[ 1 ], point[ 2 ], v );
 
  110     return do_interpolation(x, y, z);
 
  115     return do_interpolation( point[ 0 ], point[ 1 ], point[ 2 ] );
 
  119                       std::vector<Scalar_t> &v )
 const 
  121     do_interpolations(x, y, z, v);
 
  125                       std::vector<Scalar_t> &v )
 const 
  127     do_interpolations( point[ 0 ], point[ 1 ], point[ 2 ], v );
 
  138                                   std::vector<Scalar_t> &v ) 
const = 0;
 
  147 template <
typename T>
 
  156 class LinearInterpolatorFactory;
 
  159 template <
typename T>
 
  177                           std::vector<Scalar_t> & ) 
const;
 
  190   int _dimX, _dimY, _dimZ;
 
  191   float _invsizeX, _invsizeY, _invsizeZ;
 
  210 template <
typename T>
 
  245 template <
typename T>
 
  255   std::vector<float> vs( 3, 1. );
 
  259     vs[0] = o->getArrayItem( 0 )->getScalar();
 
  260     vs[1] = o->getArrayItem( 1 )->getScalar();
 
  261     vs[2] = o->getArrayItem( 2 )->getScalar();
 
  268   _invsizeX = float( 1.0 / vs[0] );
 
  270   _invsizeY = float( 1.0 / vs[1] );
 
  272   _invsizeZ = float( 1.0 / vs[2] );
 
  277 template <
typename T>
 
  284 template <
typename T>
 
  290   std::vector<float> vs( 3, 1. );
 
  293     carto::Object o = _image->header().getProperty( 
"voxel_size" );
 
  294     vs[0] = o->getArrayItem( 0 )->getScalar();
 
  295     vs[1] = o->getArrayItem( 1 )->getScalar();
 
  296     vs[2] = o->getArrayItem( 2 )->getScalar();
 
  305   return x >= hx && y >= hy && z >= hz &&
 
  306     x < _dimX * vs[0] + hx &&
 
  307     y < _dimY * vs[1] + hy &&
 
  308     z < _dimZ * vs[2] + hz;
 
  313 template <
typename T>
 
  346 template <
typename T>
 
  352   int x, X, y, Y, z, Z;
 
  354   _interpolationCoefficients(xx, x, X, ax, _dimX, _invsizeX);
 
  355   _interpolationCoefficients(yy, y, Y, ay, _dimY, _invsizeY);
 
  356   _interpolationCoefficients(zz, z, Z, az, _dimZ, _invsizeZ);
 
  361                     linint(_image( x, y, z ), _image( X, y, z ), ax),
 
  362                     linint(_image( x, Y, z ), _image( X, Y, z ), ax), ay),
 
  364                     linint(_image( x, y, Z ), _image( X, y, Z ), ax),
 
  365                     linint(_image( x, Y, Z ), _image( X, Y, Z ), ax), ay), az);
 
  370 template <
typename T>
 
  371 void LinearInterpolator<T>::
 
  375                      std::vector< Interpolator::Scalar_t > &values )
 const 
  377   values.resize( _image->getSizeT() );
 
  378   int x, X, y, Y, z, Z;
 
  380   _interpolationCoefficients(xx, x, X, ax, _dimX, _invsizeX);
 
  381   _interpolationCoefficients(yy, y, Y, ay, _dimY, _invsizeY);
 
  382   _interpolationCoefficients(zz, z, Z, az, _dimZ, _invsizeZ);
 
  384   for( 
int t = 0; t < _image->getSizeT(); ++t ) {
 
  388                     linint(_image( x, y, z, t ), _image( X, y, z, t ), ax),
 
  389                     linint(_image( x, Y, z, t ), _image( X, Y, z, t ), ax),
 
  392                     linint(_image( x, y, Z, t ), _image( X, y, Z, t ), ax),
 
  393                     linint(_image( x, Y, Z, t ), _image( X, Y, Z, t ), ax),
 
  400 template <
typename T>
 
  404   return _image->header();
 
#define __deprecated__(msg)
void values(Coordinate_t x, Coordinate_t y, Coordinate_t z, std::vector< Scalar_t > &v) const
Interpolate to get a series of values from point ( x, y ,z )
void operator()(Coordinate_t x, Coordinate_t y, Coordinate_t z, std::vector< Scalar_t > &v) const __attribute__((__deprecated__("use values() method instead")))
void operator()(const Interpolator::Point_t &point, std::vector< Scalar_t > &v) const __attribute__((__deprecated__("use values() method instead")))
Scalar_t value(Coordinate_t x, Coordinate_t y, Coordinate_t z) const
Interpolate to get a value from point ( x, y ,z ).
virtual bool isValid(Coordinate_t x, Coordinate_t y, Coordinate_t z) const =0
Return true if point ( x, y, z ) can be used for interpolation.
virtual const carto::PropertySet & header() const =0
Return the header of the image.
Scalar_t value(const Interpolator::Point_t &point) const
Interpolate to get a value from point.
void values(const Interpolator::Point_t &point, std::vector< Scalar_t > &v) const
Interpolate to get a series of values from point ( x, y ,z )
bool isValid(const Interpolator::Point_t &point) const
Return true if point can be used for interpolation.
Scalar_t operator()(Coordinate_t x, Coordinate_t y, Coordinate_t z) const __attribute__((__deprecated__("use value() method instead")))
Scalar_t operator()(const Interpolator::Point_t &point) const __attribute__((__deprecated__("use value() method instead")))
virtual ~LinearInterpolator()
LinearInterpolator(const carto::VolumeRef< T > &image)
bool isValid(Coordinate_t x, Coordinate_t y, Coordinate_t z) const
Return true if point ( x, y, z ) can be used for interpolation.
virtual const carto::PropertySet & header() const
Return the header of the image.
bool getProperty(const std::string &, T &) const
const PropertySet & header() const
The class for EcatSino data write operation.
carto::rc_ptr< Interpolator > getLinearInterpolator(const std::string &)