Extract gray levels on a given line from a CT

Hello everyone,

I want to build a Gray Level Model (GLM) of a set of CT in order to segment the aorta using active shape modeling (see ref for an example).

To create the GLM I need to extract gray level profiles, i.e., given a segment (initial and end 3d point coordinates or point and direction) I need the gray level intensities from the image voxels along the segment.

Do you know an intelligent and fast way to do it ? The segment information could be stored in a numpy array, for example.

Would Bresenham line work?

If you need interpolation, it is a little bit more complicated. You would define a 3D image, with dimensions Lx1x1, where L is some arbitrarily chosen number (could be the largest dimension in an image, or something proportional to distance and average spacing). Then provide the origin, spacing and orientation for this image so it goes from point 1 to point 2 in 3D space. Finally, use resample filter with identity transform to transfer intensities from the original image. Resample filter accepts a variety of interpolators.

Just added an example “Obtaining an intensity profile along arbitrary segment”. This uses some new functionality from SimpleITK 2.2.0 which will be released shortly (image’s EvaluateAtPhysicalPoint method).

May be relevant.

2 Likes

Thank you both ! The problem is now clearer to me. Also the

seems very promising.

I’m thinking about implementing something that is vectorizable. In this way I don’t have to write a for loop in python like in the example provided.

Scipy comes in my mind for this. I could use a resampling function that accepts arrays instead of single points.

Do you think it is a good idea or does it have something better ?