-
Notifications
You must be signed in to change notification settings - Fork 98
/
ea_defaultview.m
39 lines (35 loc) · 1.3 KB
/
ea_defaultview.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
function [] = ea_defaultview(varargin)
% saves and sets default view preferences
% there must be Electrode-Scene figure
%
% ea_defaultview() saves current view as default view
%
% ea_defaultview(v,togglestates) sets view and togglesates
H = findall(0,'type','figure');
resultfig = H(~cellfun(@isempty,strfind({H(:).Name},{'Electrode-Scene'})));
resultfig = resultfig(1); % take the first if there are many.
togglestates = getappdata(resultfig,'togglestates');
set(0,'CurrentFigure',resultfig);
if nargin == 0
% save current view and togglesates
ea_setprefs('view',ea_view)
ea_setprefs('togglestates',getappdata(resultfig,'togglestates'))
elseif nargin == 2
% set preferences specified in vararg in
% togglestates
togglestates.xyzmm = varargin{2}.xyzmm;
togglestates.xyztoggles = varargin{2}.xyztoggles;
togglestates.xyztransparencies = varargin{2}.xyztransparencies;
togglestates.refreshview = 1;
ea_anatomyslices(resultfig,togglestates,struct,[]);
% camera view
ea_view(varargin{1});
% update togglestates
setappdata(resultfig,'togglestates',togglestates);
% update anatomy control
close(getappdata(resultfig,'awin'));
options = getappdata(resultfig,'options');
awin = ea_anatomycontrol(resultfig,options);
setappdata(resultfig,'awin',awin);
end
end