MATLAB Answers


CT #s corresponding to spatial coordinates

Asked by Bibek
on 27 Dec 2011

I have a CT image data(transverse slices),CT of 512*512*30. I know how to find CT # for any slice k corresponding to ith row and jth column, CT#=CT(i,j,k).I now trace a ray,starting from source point(0,0,100) then goes through CT image data and finally strikes to detector point(say 10,25,-50). Spatial coordinates for source and detector points are determined with isocenter taken at (0,0,0).Using linspace I can find spatial coordinates(i.e.,x,y,z)of points between source point and detector point. So, I have,say 105 intermediate points and I know their x,y,z coordinates.Say, 15 points lie outside of CT image data( air) before passing through it and another 15 points also lie outside of CT image data( air) after exiting through it. For remaining 75 points(assuming a ray goes through each slice), how can I assign CT # to each points(with their known spatial coordinates). Basically it means how can I get CT#=CT(x,y,z,15)for a point in 15th slice with its spatial coordinates x,y,z. I tried with, c = improfile(I,xi,yi,n)but got error message when tried to extend it, c = improfile(I,xi,yi,zi,n). Any help will be appreciated. Thanks!!


on 27 Dec 2011

And what is CT#?

Image Analyst
on 28 Dec 2011

Those are the digital numbers the Computed Tomography unit gives, called Hounsfield Units:

Bibek, how did my suggestion work out for you?

on 28 Dec 2011

In matlab help I found the code, VI = interp3(X,Y,Z,V,XI,YI,ZI). So, in my case V=CT, it is of size 512*512*30,X=x_coordinates, Y=y_coordinates and Z=z_coordinates. All these X,Y,Z are matrices I created myself and are also of size 512*512*30. Since I am trying to find CT # corresponding to a point with x,y,z coordinates(1.5,25,15), I kept XI=1.5,YI=25,ZI=15. But I got a error message:

??? Error using ==> interp3 at 138
X, Y and Z must be matrices produced by MESHGRID. Use
TriScatteredInterp instead
of INTERP3 for scattered data.

In my case I create x,y,z coordinates as

x_Coordinates=repmat(X9,[512,1,75]);% first row corresponds to 712 z-coordinates(all zeros) for 1st image and so on
for i=1:75;

Since I don't know anything about meshgrid, I am not sure I will be able to create x,y,z coordinates like above using meshgrid.

When I tried with TriScatteredInterp I got this error message:

??? Error using ==> TriScatteredInterp
Incorrect number of arguments for TriScatteredInterp.

I don't know where I did a mistake. Probably I was wrong in defining X,Y,Z and XI,YI,ZI. Any help will be appreciated.



No products are associated with this question.

1 Answer

Answer by Image Analyst
on 27 Dec 2011

Why not just use trilinear interpolation? I don't think there's a built-in function for it, but it would be easy enough to program up yourself.


Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi test

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

MATLAB Academy

New to MATLAB?

Learn MATLAB today!