4

I have a stack of cortical bone images, high resolution and binarized. How do I go about calculating the mean inner and outer radii for each image? Here is an example of the kind of images I need to process:

payloc91
  • 3,724
  • 1
  • 17
  • 45
my MDB
  • 129
  • 1
  • 2
  • 10
  • I started by calculating the centroid of the white pixels in the x and y directions. I'm thinking I would need that to calculate the distance between the center and the inner and outer perimeters of the bone. – my MDB Feb 09 '15 at 10:25

1 Answers1

3

This could be one approach -

%// Read in image and conert to binary
im = im2bw(imread('http://s9.postimg.org/aew1l7tvz/4_COPY_copy.png'));
figure, imshow(im), title('Original Image')

%// Fill holes giving us the "outer blob"
outer_blob = imfill(im,'holes');
outer_blob = biggest_blob(outer_blob); %// remove noise
figure, imshow(outer_blob), title('Outer Blob')

%// Get the inner filled blob by "removing" the original image from outer blob
inner_blob = outer_blob & ~im;
inner_blob = biggest_blob(inner_blob); %// remove noise
figure, imshow(inner_blob), title('Inner Blob')

%// Find the equivalent/mean inner and outer radii 
inner_dia  = regionprops(inner_blob,'Equivdiameter');
inner_radius = inner_dia.EquivDiameter/2

outer_dia  = regionprops(outer_blob,'Equivdiameter');
outer_radius = outer_dia.EquivDiameter/2

Associated function code -

function out = biggest_blob(BW)

%// Find and labels blobs in the binary image BW
[L, num] = bwlabel(BW, 8); 

%// Count of pixels in each blob, basically this should give the area of each blob
counts = sum(bsxfun(@eq,L(:),1:num)); 

%// Get the label(ind) cooresponding to blob with the maximum area 
%// which would be the biggest blob
[~,ind] = max(counts);

%// Get only the logical mask of the biggest blob by comparing all labels 
%// to the label(ind) of the biggest blob
out = (L==ind);

return;

Code run and debug images -

inner_radius =
  211.4740
outer_radius =
  267.8926

enter image description here

enter image description here

enter image description here

Divakar
  • 218,885
  • 19
  • 262
  • 358