implement 3d sobel operator
I am currently working on inhomogeniety removal from MRI data volume which contains voxels. I want to apply sobel operator on those volumes to find the gradient. I am familiar with 2d sobel mask and the neighbourhood of 2d images.
sobel mask: 1 2 1 0 0 0 开发者_JS百科-1 -2 -1 1 0 -1 2 0 -2 1 0 -1
neighbourhood of(x,y): (x+1,y-1) (x+1,y) (x+1,y+1) (x,y-1) (x,y) (x,y+1) (x-1,y-1) (x-1,y) (x-1,y+1)
Now I want to apply it on 3d. Please suggest me how should I proceed?? Thank you.
Wikipedia has a nice introduction about that : http://en.wikipedia.org/wiki/Sobel_operator
Basically, since the sobel filter is separable, you can apply 1D filters in each of x, y and z directions consecutively. Theses filters are h(x) and h'(x) as given on wikipedia. Doing so will allow you to get the edges in the direction where you applied h'(x).
For example, if you do h(x)*h(y)*h'(z), you'll get the edges in the direction z.
Alternatively (and more expensively), you can compute the whole 3D 3x3x3 kernel and apply the convolution in 3D. The kernel for the z direction is given on wikipedia as well.
Good question! For 3D images you have to use 3 different 3x3x3 sobel operators: 1 for each direction, that is x, y and z. Be aware that in digital image processing the x-coordinate axis points right, y-coordinate downwards, and z-coordinate into the screen! I visualized all three 3D sobel operators to make it more intuitive. Here the sobel filters in X direction, Y direction and Z direction.
Furthermore, if you want to see the equations behind it (basically what your code has to compute) here you go: SobelFilterEquations
精彩评论