i need help to create macro to do the following
- Read the original RGB image % depicted in Fig
- Get the Green channel image % depicted in Fig
- Convert the gray channel into binary image, use erode, dilate, and the median filter (with
radius 1);% depicted in Fig.
- Use the Analyzing function to detectthestructuresusing the conditions AR>1.3,
- Get the coordinates of the capsule X2,Y2;% depicted in Fig.
- Convex Hull % depicted in Fig.
- Fit Ellipse. The corpuscle center coordinates (X0, Y0) are detected according to the ellipse
coordinates % depicted in Fig.
- Optimize the functions, clear outside, inverts and fills holes.
- Run the glomerulus detection function to detect the glomerulus (green boundaries) and its
coordinates (X1, Y1);% depicted in Fig.
- Detect the capsule coordinate function which is external boundary of capsule (red –
X_capsule, Y_capsule) and which are boundaries of glomerulus (green);
% depicted in Fig.
- Determine the glomerulus diameter and capsule`s thickness according to external boundary
of capsule (X_capsule, Y_capsule), glomerulus boundaries (X1, Y1) and
corpusculum center (X0, Y0) coordinates.% depicted in Fig.
- Consider A is a point on the corpuscles geometric center,
C is a point on the Bowman’s capsules external perimeter,
Bi and Bj are points on the glomerulus’s perimeter,
- Define T as the capsule’s thickness array,
R as the glomerulus’s radius array.
- Let £ be the total number of points on the Bowman’s capsule external perimeter,
Ξ is the total number of points on the glomerulus’s perimeter.
- Generate initial zero valued arrays for T and R.
- while C<£ and B<Ξ
- for C=1: £ % points on the outer perimeter
- for B=1:Ξ % points on the inner perimeter
Determine the distance 𝐴𝐶 (from point “A” to point “C”)
Determine the distance 𝐴𝐵i (from point “A” to point “Bi”)
Measure the distance 𝐶𝐵i
Calculate the sum of 𝐴𝐵I and 𝐶𝐵i
- if 𝐴𝐵i +𝐶𝐵i>𝐴𝐶
- else if 𝐴𝐵i +𝐶𝐵i = 𝐴𝐶
10.set Bj= Bi %means points A, Bj and C belong to 𝐴𝐶
11.T= T + CBj %means: CBj is added to the wall’s thickness values)
- R= R+ ABj% means: ABj is added to the glomerulus’s radius values)
- end else
- end if
- end for B
- end for C
- end while
Total Bowman’scapsule thickness= mean(T);
Glomerulus’s radius = mean®;
Glomerulus’s diameter=2* glomerulus’s radius