Login  Register

Re: Moment of inertia calculations

Posted by Robert Dougherty on Feb 23, 2006; 12:48am
URL: http://imagej.273.s1.nabble.com/Moment-of-inertia-calculations-tp3703568p3703575.html

This macro might be a start.  It uses the center of mass as the axis of
rotation, assumed perpendicular to the image.  (The conversion for a
different axis appears to be to add Md^2 according to the "parallel axis
theorem for moments of inertia," where M is the total mass and d is the
displacement to the new axis.)  The macro presumably needs to be calibrated
to convert pixels into length units and image levels into mass.

Bob

Robert P. Dougherty, Ph.D.
President, OptiNav, Inc.
Phone (425) 467-1118
Fax (425) 467-1119
www.optinav.com
 

// Find the center of mass

     getBoundingRect(x1, y1, width, height);
     xSum = 0;
     ySum = 0;
     sum = 0;
     x2 = x1 + width;
     y2 = y1 + height;    
     for (x=x1; x<x2; x++) {
        for (y=y1; y<y2; y++) {
            v = getPixel(x, y);
            xSum += v*x;
            ySum += v*y;
            sum += v;
          }
     }
     x0 = xSum/sum;
     y0 = ySum/sum;

// Find the moment of inertia about the center of mass

     moment = 0;
     for (x=x1; x<x2; x++) {
         for (y=y1; y<y2; y++) {
             v = getPixel(x, y);
             rSq = (x-x0)*(x-x0) + (y-y0)*(y-y0);
             moment = moment + v*rSq;
         }
     }
     print(x0+" "+y0+" "+moment);




> -----Original Message-----
> From: ImageJ Interest Group [mailto:[hidden email]] On Behalf Of
> Debra K Schneider
> Sent: Wednesday, February 22, 2006 8:18 AM
> To: [hidden email]
> Subject: Moment of inertia calculations
>
> Hi
> I am interested in measuring the moment of inertia of a bone slice.
> Can this be done in ImageJ?
> Thank you
> Debby Schneider