35 #ifndef AIMS_RESAMPLING_NEARESTNEIGHBORRESAMPLER_D_H
36 #define AIMS_RESAMPLING_NEARESTNEIGHBORRESAMPLER_D_H
51 const T &outBackground,
53 T &outValue,
int t )
const
58 doResample(inVolume, inLocation, outBackground, outValue, t);
65 const T &outBackground,
66 T &outValue,
int t )
const
68 float xf = round(inLocation[0]);
69 float yf = round(inLocation[1]);
70 float zf = round(inLocation[2]);
72 std::vector<int> dims = inVolume.
getSize();
76 if ( ( xf >= 0 ) && ( xf < dims[0] ) &&
77 ( yf >= 0 ) && ( yf < dims[1] ) &&
78 ( zf >= 0 ) && ( zf < dims[2] ) )
80 int x =
static_cast<int>(xf);
81 int y =
static_cast<int>(yf);
82 int z =
static_cast<int>(zf);
83 outValue = inVolume.
at( x, y, z, t );
87 outValue = outBackground;
Volume resampler using nearest-neighbour interpolation.
std::vector< int > getSize() const
const T & at(long x, long y=0, long z=0, long t=0) const