MedicalVisualization

## Gradient Calculation

The gradient vector is computed on a discrete grid by finite differences method.

• Gradient vector is written as so called Nabla Operator $\nabla$
• Gradient = partial derivatives of the continuous scalar function $f(x,y,z)$
$\nabla f = (\frac{df}{dx}, \frac{df}{dy}, \frac{df}{dz})^T$
• Discrete derivatives via finite differences method
• forward differences method
• $\frac{df(x)}{ds} \approx \frac{f(x+\Delta s)-f(x)}{\Delta s}$
• backward differences method
• $\frac{df(x)}{ds} \approx \frac{f(x)-f(x-\Delta s)}{\Delta s}$
• central differences methods has better smoothness
• $\frac{df(x)}{ds} \approx \frac{f(x+\Delta s)-f(x-\Delta s)}{2\Delta s}$

Normal $\vec{n} = \nabla f = (\frac{f(x+\Delta s,y,z)-f(x-\Delta s,y,z)}{2\Delta s}, \frac{f(x,y+\Delta s,z)-f(x,y-\Delta s,z)}{2\Delta s}, \frac{f(x,y,z+\Delta s)-f(x,y,z-\Delta s)}{2\Delta s})^T$

• Discrete derivation via central differences on the voxel grid
• $\frac{df(x)}{ds} \approx \frac{f(i+1)-f(i-1)}{2}$
• At the grid boundaries forward resp. backward differences.
• Hint: even better smoothness than $\nabla$ via central differences: Sobel Operator!