Gradient Vector Flow (to the right) calculated on the volume to the left.
Gradient Vector Flow (GVF) is a feature-preserving diffusion of gradient information. It was originally introduced by Xu and Prince to drive snakes, or active contours, towards edges of interest in image segmentation. But GVF is also used for detection of tubular structures and skeletonization. In this post I present a simple Matlab implementation of GVF for 3D images which I made because I could not find any online. The implementation is a simple extension of Xu and Prince original 2D implementation found at their website.
GVF is the vector field V⃗ (x,y,z)=[u(x,y,z),v(x,y,z),w(x,y,z)] that minimizes the energy function
E=∭μ|∇V⃗ |2+|∇f|2|V⃗ −∇f|2dxdydz where f is the 3D volume itself. This vector field can be found by solving the following Euler equations: μ∇2u−(u−fx)|∇f|2μ∇2v−(v−fy)|∇f|2μ∇2w−(w−fz)|∇f|2=0=0=0 where ∇f=(fx,fy,fz). Solving these equations can be done iteratively with the following Matlab function (GitHub Repository of the code can be found here) 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 | function [u,v,w] = GVF3D(f, mu,