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.
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).