From b37c53f04df06e3777421ba1f8f6893f852cd2ad Mon Sep 17 00:00:00 2001
From: Jean-Yves TINEVEZ <jean-yves.tinevez@pasteur.fr>
Date: Fri, 3 Jul 2020 16:37:51 +0200
Subject: [PATCH] Plot the 3 euler angles.

---
 RunExample.m | 50 +++++++++++++++++++++++++++++++++++++++++---------
 1 file changed, 41 insertions(+), 9 deletions(-)

diff --git a/RunExample.m b/RunExample.m
index f3c5897..e317d9b 100755
--- a/RunExample.m
+++ b/RunExample.m
@@ -166,12 +166,26 @@ end
 
 %% Plot the segmentation.
 
-figure
+close all
+
+figure( 'Position', [ 1204 20 600 1000 ] )
 % imshow( ~I, [ 0 2 ], ...
 %     'Border', 'tight', ...
 %     'XData', [ 1 size( I, 2 ) ] * pixel_size, ... 
 %     'YData', [ 1 size( I, 1 ) ] * pixel_size )
+
+ax1 = subplot( 3, 1, 1 );
+hold on
+axis equal
+
+ax2 = subplot( 3, 1, 2 );
 hold on
+axis equal
+
+ax3 = subplot( 3, 1, 3 );
+hold on
+axis equal
+
 
 % plot( junction_graph, ...
 %     'XData', junction_graph.Nodes.Centroid(:,1), ...
@@ -189,17 +203,35 @@ for i = 1 : n_objects
     o = objects( i );
     P = o.boundary;
     
-%     err = o.perimeter / o.uncorr.perimeter - 1;
-    err = abs( o.euler_angles( 2 ) );
+    %     err = o.perimeter / o.uncorr.perimeter - 1;
+    
+    alpha = rad2deg( o.euler_angles( 1 ) );
+    beta = rad2deg(o.euler_angles( 2 ) );
+    gamma = rad2deg(o.euler_angles( 3 ) );
     
-    patch( P(:,1), P(:,2), P(:,3), err, ...
+    if alpha < 0
+        alpha = 180 + alpha;
+    end
+    
+    if beta > 90
+        beta = 180 - beta;
+    end
+    
+    patch( ax1, P(:,1), P(:,2), P(:,3), alpha, ...
+        'LineWidth', 2 );
+    patch( ax2, P(:,1), P(:,2), P(:,3), beta, ...
         'LineWidth', 2 );
-    text( o.center(1), o.center(2), o.center(3) + 0.5, num2str( o.id ), ...
-        'HorizontalAlignment', 'center', ...
-        'VerticalAlignment', 'middle' )
+    patch( ax3, P(:,1), P(:,2), P(:,3), gamma, ...
+        'LineWidth', 2 );
+%     text( ax1,  o.center(1), o.center(2), o.center(3) + 0.5, num2str( o.id ), ...
+%         'HorizontalAlignment', 'center', ...
+%         'VerticalAlignment', 'middle' )
     
 end
 
-axis equal
-colorbar
+colormap( ax1, 'hsv' )
+colorbar(ax1)
+colorbar(ax2)
+colormap( ax3, 'hsv' )
+colorbar(ax3)
 
-- 
GitLab