20 #ifndef MIRTK_NearestNeighorInterpolateImageFunction_HXX 21 #define MIRTK_NearestNeighorInterpolateImageFunction_HXX 23 #include "mirtk/NearestNeighborInterpolateImageFunction.h" 25 #include "mirtk/InterpolateImageFunction.hxx" 26 #include "mirtk/Math.h" 37 template <
class TImage>
44 template <
class TImage>
55 template <
class TImage>
67 template <
class TImage>
68 inline typename GenericNearestNeighborInterpolateImageFunction<TImage>::VoxelType
70 ::Get(
double x,
double y,
double z,
double t)
const 77 if (this->Input()->IsInside(i, j, k, l)) {
78 return this->Input()->Get(i, j, k, l);
80 return voxel_cast<VoxelType>(this->DefaultValue());
85 template <
class TImage>
86 inline typename GenericNearestNeighborInterpolateImageFunction<TImage>::VoxelType
95 if (this->Input()->IsInsideForeground(i, j, k, l)) {
96 return this->Input()->Get(i, j, k, l);
98 return voxel_cast<VoxelType>(this->DefaultValue());
103 template <
class TImage>
template <
class TOtherImage>
104 inline typename TOtherImage::VoxelType
106 ::Get(
const TOtherImage *input,
double x,
double y,
double z,
double t)
const 112 template <
class TImage>
template <
class TOtherImage>
113 inline typename TOtherImage::VoxelType
122 if (input->IsForeground(i, j, k, l)) {
123 return input->Get(i, j, k, l);
125 return voxel_cast<VoxelType>(this->DefaultValue());
130 template <
class TImage>
131 inline typename GenericNearestNeighborInterpolateImageFunction<TImage>::VoxelType
135 return Get(this->Input(), x, y, z, t);
139 template <
class TImage>
140 inline typename GenericNearestNeighborInterpolateImageFunction<TImage>::VoxelType
144 if (this->Extrapolator()) {
145 return Get(this->Extrapolator(), x, y, z, t);
147 return Get(x, y, z, t);
152 template <
class TImage>
153 inline typename GenericNearestNeighborInterpolateImageFunction<TImage>::VoxelType
157 return GetWithPadding(this->Input(), x, y, z, t);
161 template <
class TImage>
162 inline typename GenericNearestNeighborInterpolateImageFunction<TImage>::VoxelType
166 if (this->Extrapolator()) {
167 return GetWithPadding(this->Extrapolator(), x, y, z, t);
169 return GetWithPadding(x, y, z, t);
176 #endif // MIRTK_NearestNeighorInterpolateImageFunction_HXX virtual VoxelType GetOutside(double, double, double=0, double=0) const
Evaluate generic image at an arbitrary location (in pixels)
string Get(const ParameterList ¶ms, string name)
Get parameter value from parameters list.
virtual ~GenericNearestNeighborInterpolateImageFunction()
Destructor.
virtual VoxelType GetInside(double, double, double=0, double=0) const
VoxelType Get(double, double, double=0, double=0) const
virtual void BoundingInterval(double, int &, int &) const
GenericNearestNeighborInterpolateImageFunction()
Default constructor.
virtual VoxelType GetWithPaddingInside(double, double, double=0, double=0) const
virtual VoxelType GetWithPaddingOutside(double, double, double=0, double=0) const
MIRTKCU_API int iround(T x)
Round floating-point value and cast to int.
VoxelType GetWithPadding(double, double, double=0, double=0) const