1

I'm doing image processing with scipy.ndimage. Given a ring-shaped object, I'd like to generate a "profile" around its circumference. The profile could be something like thickness measurements at various point around the ring, or the mean signal along the ring's "thickness."

It seems to me that I could use ndimage.mean if I could first get a good labels image.

If my ring looks like this,

 A = array([[0, 0, 0, 0, 1, 0, 0, 0, 0, 0],
            [0, 0, 1, 1, 1, 1, 1, 1, 0, 0],
            [0, 0, 1, 1, 1, 1, 1, 1, 0, 0],
            [0, 0, 1, 1, 0, 0, 1, 1, 0, 0],
            [0, 0, 1, 1, 0, 0, 1, 1, 0, 0],
            [0, 0, 1, 1, 0, 0, 1, 1, 0, 0],
            [0, 0, 1, 1, 0, 0, 1, 1, 1, 0],
            [0, 0, 1, 1, 0, 0, 1, 1, 0, 0],
            [0, 0, 1, 1, 1, 1, 1, 1, 0, 0],
            [0, 0, 0, 0, 1, 0, 0, 0, 0, 0]])

I could get the "profile of means" with numpy.mean( A, labels ) where labels is.

array([[0,  0,  0,  0,  2,  0,  0,  0,  0,  0],
       [0,  0,  1,  1,  2,  3,  4,  4,  0,  0],
       [0,  0,  1,  1,  2,  3,  4,  5,  0,  0],
       [0,  0, 16, 16,  0,  0,  5,  5,  0,  0],
       [0,  0, 15, 15,  0,  0,  6,  6,  0,  0],
       [0,  0, 14, 14,  0,  0,  7,  7,  0,  0],
       [0,  0, 13, 13,  0,  0,  8,  8,  8,  0],
       [0,  0, 13, 12,  0,  0,  9,  9,  0,  0],
       [0,  0, 12, 12, 11, 10,  9,  9,  0,  0],
       [0,  0,  0,  0, 11,  0,  0,  0,  0,  0]])

I bet there's some interpolation stuff that will go overlooked with this, but it's all I can come up with on my own.

Is there a way to generate my proposed labels image? Is there a better approach for generating my profiles?

Saullo G. P. Castro
  • 56,802
  • 26
  • 179
  • 234
ajwood
  • 18,227
  • 15
  • 61
  • 104

1 Answers1

1

A standard probability distribution on a circle (or sphere) is the Von-Mises Fisher distribution.

Scipy supports this distribution: http://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.vonmises.html

So you should be able to use the fit function to find maximum-likelihood parameters for your data.

user1149913
  • 4,463
  • 1
  • 23
  • 28
  • I'm sorry, I don't understand. Could you elaborate? – ajwood Sep 21 '12 at 17:35
  • If you have a set of discrete counts at different angles along the ring, then you can fit a von-mises distribution given these measurements. The fitted distribution will then give you the probability that a unit of thickness is present at a particular angle. – user1149913 Sep 21 '12 at 17:42