Clear Filters
Clear Filters

improfile() through 3D image?

4 views (last 30 days)
Justin Solomon
Justin Solomon on 8 Jul 2012
Hello,
I have a 3D image set (i.e., a stack of CT images), I would like to get a line profile through this 3D image set similar to what improfile() does on a normal 2D image. I can't find anything that does this. Help!
Thanks, Justin

Accepted Answer

Walter Roberson
Walter Roberson on 8 Jul 2012
If you can calculate the coordinates that you want to sample at, then you can use interp3(). But calculating the coordinates might require using something like http://en.wikipedia.org/wiki/Bresenham's_line_algorithm
  1 Comment
Justin Solomon
Justin Solomon on 10 Jul 2012
Thanks for the advice. I was able to find an implementation of Bresenham's line algorithm.
I have a follow up question about interp3().
I've got a 3D image, I, and I've defined a coordinate system (x,y,z) for I. Note that because I'm dealing with images, x actually corresponds to the second dimension (columns) of I,. Further, I have a list of points [Xprof Yprof Zprof] that define a line through the image (i.e., Xprof, Yprof, and Zprof are all vectors of length n where n is the number of points in the line). Now I would like to use interp3() to get values of I along the line defined by [Xprof Yprof Zprof].
I'm worried that I'm mixing up the x and y axis when I call interp3(). Should I do
1. HUs = interp3(y,x,z,I,Yprof,Xprof,Zprof);
or
2. HUs = interp3(x,y,z,I,Xprof,Yprof,Zprof);
Below is the calling sequence for interp3() described in the help menu.
VI = interp3(X,Y,Z,V,XI,YI,ZI)
I don't know if X is associated with the rows or columns of V. Any insight would be helpful.
Thanks, Justin

Sign in to comment.

More Answers (0)

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!