added KDE3DResampling Method.

However BoxKDE3D seems to be buggy
This commit is contained in:
toni
2018-08-01 11:54:10 +02:00
parent d912a76246
commit 0bb22b54e9
6 changed files with 53 additions and 46 deletions

View File

@@ -156,8 +156,9 @@ private:
}
}
template<SlicePlane S>
void boxBlur1D(const ImageView3D<T>::ConstLineView<S>& src, ImageView3D<T>::LineView<S>& dst, size_t len, size_t r, T iarr)
template <SlicePlane S>
void boxBlur1D(const typename ImageView3D<T>::template ConstLineView<S>& src, typename ImageView3D<T>::template LineView<S>& dst, size_t len, size_t r, T iarr)
{
size_t li = 0; // left index
size_t ri = r; // right index

View File

@@ -164,6 +164,8 @@ public:
private:
_Point3<size_t> add_simple_bin(T x, T y, T z, T w)
{
Assert::isTrue(w > 0, "Weight needs to be postive.");
size_t bin_x = (size_t)((x - bb.getMin().x) / binSizeX);
size_t bin_y = (size_t)((y - bb.getMin().y) / binSizeY);
size_t bin_z = (size_t)((z - bb.getMin().z) / binSizeZ);

View File

@@ -104,6 +104,21 @@ public:
this->values = tmp;
}
// Returns the value at (x,y). Throws if out of bounds.
const TValue& at(size_t x, size_t y, size_t z) const
{
return values[indexFromCoord(x, y, z)];
}
// Returns the value at (x,y) but falls back to default if out of bounds.
const TValue& get(size_t x, size_t y, size_t z, TValue dflt = 0) const
{
if (x >= width || y >= height || z >= depth)
return dflt;
else
return values[indexFromCoord(x, y, z)];
}
public:
typedef LineView<SlicePlane::XY> LineViewXY;
typedef LineView<SlicePlane::XZ> LineViewXZ;
@@ -205,4 +220,4 @@ template struct ImageView3D<float>;
//template struct ImageView3D<double>;
template struct Image3D<float>;
//template struct Image3D<double>;
//template struct Image3D<double>;