From Ohm

# 3D Texture Interpolation (Nearest-Neighbour)

A volume is given with the dimensions $w, h, d$ (in voxels). The voxel value of the i-th column, j-th row and k-th slice is given by V(i,j,k). This equals the (i+w(j+kh))-th element in the linear memory layout.

Then the data value at normalized texture coordinate $(s,t,r)\in[0,1]$ is determined via Nearest-Neighbour Interpolation of voxels $V(i,j,k)$ at the index:

$\displaystyle{ i=\lfloor s\cdot(w-1)+\frac12\rfloor }$
$\displaystyle{ j=\lfloor t\cdot(h-1)+\frac12\rfloor }$
$\displaystyle{ k=\lfloor r\cdot(d-1)+\frac12\rfloor }$

The scalar function is therefore:

$\displaystyle{ f(s,t,r) = }$
$\displaystyle{ V(\lfloor s\cdot(w-1)+\frac12\rfloor, }$
$\displaystyle{ \lfloor t\cdot(h-1)+\frac12\rfloor, }$
$\displaystyle{ \lfloor r\cdot(d-1)+\frac12\rfloor) }$

Retrieved from http://schorsch.efi.fh-nuernberg.de/roettger/index.php/MedicalVisualization/3DTextureInterpolationNearestNeigbour

Page last modified on March 30, 2017, at 11:40 PM