From 071b71fe76c6748e86cbf4150890e0b277ba8ae7 Mon Sep 17 00:00:00 2001
From: Eric Wait <eric@waitphoto.com>
Date: Thu, 14 Dec 2017 14:04:17 -0500
Subject: [PATCH] Added a function to reset the transfer functions

---
 .../+D3d/+UI/+Ctrl/ResetTransferFunctions.m     | 17 +++++++++++++++++
 src/matlab/+D3d/+UI/Controls.m                  |  1 +
 2 files changed, 18 insertions(+)
 create mode 100644 src/matlab/+D3d/+UI/+Ctrl/ResetTransferFunctions.m

diff --git a/src/matlab/+D3d/+UI/+Ctrl/ResetTransferFunctions.m b/src/matlab/+D3d/+UI/+Ctrl/ResetTransferFunctions.m
new file mode 100644
index 0000000..3641351
--- /dev/null
+++ b/src/matlab/+D3d/+UI/+Ctrl/ResetTransferFunctions.m
@@ -0,0 +1,17 @@
+function ResetTransferFunctions()
+        [imageData, colors, channelData] = D3d.UI.Ctrl.GetUserData();
+        
+        for c=1:length(channelData)
+            channelData(c).visible = 1;
+            channelData(c).alphaMod = 1.0;
+            channelData(c).minVal = 0.0;
+            channelData(c).midVal = 0.5;
+            channelData(c).maxVal = 1.0;
+            channelData(c).a = 0.0;
+            channelData(c).b = 1.0;
+            channelData(c).c = 0.0;
+        end
+        
+        D3d.UI.Ctrl.SetUserData(imageData,colors,channelData);
+        D3d.UI.Ctrl.UpdateCurrentState();
+end
\ No newline at end of file
diff --git a/src/matlab/+D3d/+UI/Controls.m b/src/matlab/+D3d/+UI/Controls.m
index 0135fa9..8d8aae8 100644
--- a/src/matlab/+D3d/+UI/Controls.m
+++ b/src/matlab/+D3d/+UI/Controls.m
@@ -357,6 +357,7 @@ end
 % --- Executes on button press in pb_ResetView.
 function pb_ResetView_Callback(hObject, eventdata, handles)
 D3d.Viewer.ResetView();
+D3d.UI.Ctrl.ResetTransferFunctions();
 D3d.Update();
 end
 
-- 
GitLab