# 3d CT segmentation

It's my first attempt at 3D analysis. I am trying to segment a 3D CT data.

My case study is very simple: trying to segment circular objects in my data.

Do you have any suggestions on how to achieve the 3 steps:
1. First of all I would like to visualize my data in 3D
2. Then segment by value, e.g. all voxels whose value is between 800 and 1200 and visualize it
3. Than find shape properties in 3D

The way I visualize the data now is :

id = find ( D < 1200 & D > 800);
[ x , y , z ] = ind2sub( id , size(D) ) ;
plot3(x,y,z,'.')


Do you have suggestions for a better way?

I heard about the isosurface functions but don't know how to use it for this.

Thanks.

Mathematica 9 features completely integrated Image3D objects. Visualization is cool and snappy (as expected), and many segmentation functions accept 3D images (Binarize, ChanVeseBinarize, ClusteringComponents, MorphologicalComponents, etc.).

As for measuring properties, ComponentMeasurements would be the function to go to; but as of version 9 it does not accept 3D images. So while waiting for the future version, you are on your own with your point 3. It's not always complicated, for example below I compute the centroid of the segmented shapes:

1. Create a fake volume with noise of intensity comprised between .1 and .5, add two solid 3D balls to it, and rescale all the values to range from 0 to 1:

data = Rescale[ RandomReal[{.1, .5}, {200, 100, 100}] + Join[DiskMatrix[10, {100, 100, 100}], DiskMatrix[20, {100, 100, 100}]]];

2. Construct a 3D image (which can be manipulated, whose color transfer function can be interactively edited, etc.), and segment it by looking for voxel values between .5 and 1:

image3d = Image3D[data]; segmented = Binarize[image3d, {.5, 1}];

3. Compute the morphological connected components from the binary 3D image:

components = MorphologicalComponents[segmented];

4. Compute the centroid of each shape by averaging the voxel positions for each shape:

Table[ p = N@Position[components, i]; Mean[p], {i, 1, Max[components]} ]