dividing a circle into six equal parts

8 次查看(过去 30 天)
hello
can you please help me...i have a mask image for the LV (left ventricle) that is two concentric circles,inside these circles ones and outside them zeros...anyway i just wanna divide this circle into six equal parts (each 60 degrees) given the starting point (which i call "the insertion point").... can you please help me
if you need more info just ask me
thank you in advance

采纳的回答

Matt Fig
Matt Fig 2011-5-12
You could write a custom function to do this:
function P = plot_arc(a,b,h,k,r)
% Plot a circular arc as a pie wedge.
% a is start of arc in radians,
% b is end of arc in radians,
% (h,k) is the center of the circle.
% r is the radius.
% Try this: plot_arc(pi/4,3*pi/4,9,-4,3)
% Author: Matt Fig
t = linspace(a,b);
x = r*cos(t) + h;
y = r*sin(t) + k;
x = [x h x(1)];
y = [y k y(1)];
P = fill(x,y,'r');
axis([h-r-1 h+r+1 k-r-1 k+r+1])
axis square;
if ~nargout
clear P
end
Now from the command line:
hold on
for ii = 1:6
P(ii) = plot_arc(pi/3*(ii-1),pi/3*(ii),9,-4,3);
end
If this doesn't do it, consider using the LINE function. For example, replace this line:
P = fill(x,y,'r');
with this:
P = line(x,y);
and possibly delete the calls to the AXIS function.

更多回答(2 个)

Sean de Wolski
Sean de Wolski 2011-5-12
Hmmm. A rambling of one way to do it, given a logical map of a circle:
  • Find the centroid.
  • Pick three angles at 60 degree spacing, Eg: 0:60:120 degrees
  • Translate these to slopes
  • Find appropriate intercepts such that a line with each of those slopes runs through the centroid.
  • Turn these lines to black in your map.
  • Use bwlabel to label the six sextets. Turn the lines back on so that each half of one line (halves defined cut at the centroid) is a number 1-6 adjacent to one of the sextets of the same number.
There are probably better ways but this should work.
  1 个评论
ajith
ajith 2013-8-21
sir i found the centroid using regionprops how to pick three angles at 60 degree spacing.

请先登录,再进行评论。


Walter Roberson
Walter Roberson 2011-5-12
What relationship is the point to have to the divisions ? Is there an implication that the tangent to the inner circle and outer circle should pass through the selected point? If so, then if you subtract the origin of the circle from the selected point and cart2pol() the result, the angle will give you the rotation offset for the 60 degree (Pi/3) divisions. Add it to (0:5)*Pi/3 and pol2cart() once with the inner radius and once with the outer radius to get the (x,y) coordinates of the endpoints of the dividing segments.

类别

Help CenterFile Exchange 中查找有关 Image Segmentation and Analysis 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by