Input:
  (i) 𝑋 : the current shape
  (ii) 𝑋 : the mean shape
Result:
  (i)   𝑋 : the final shape
begin
   foreach landmarks in 𝑋   do
   Compute 𝑔 ;
𝑋 = 𝑋 ;
 repeat
     foreach landmarks in X do
    foreach points along the normal do
      Compute 𝑔 ;
      Compute 𝐷 = ( 𝑔 𝑔 ) 𝑇 𝑆 𝑔 1 ( 𝑔 𝑔 )
    Find 𝑔 minimizing 𝐷 ;
    Update the landmarks position with the new profile;
    Determine 𝑋 best suited to these landmarks;
 until  Convergence;
𝑋 = 𝑋 ;
Algorithm 3: ASM segmentation procedure.