-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathalignvolumedata_exporttransformation.m
60 lines (51 loc) · 1.83 KB
/
alignvolumedata_exporttransformation.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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
function tr = alignvolumedata_exporttransformation(wantprint)
% function tr = alignvolumedata_exporttransformation
%
% return a transformation struct that reflects
% the current state of alignvolumedata.
%
% example:
% (see the example in alignvolumedata.m)
% internal note:
% - <wantprint> is whether to print the transformation.
% if 2, then we omit the line that says 'the following constructs...'
% if [] or not supplied, default to 1.
global AV_GUI AV_TGTSIZE AV_TGTLENGTHS;
% deal with input
if ~exist('wantprint','var') || isempty(wantprint)
wantprint = 1;
end
if isempty(AV_GUI)
warning('no alignvolumedata GUI detected.');
tr = [];
return;
end
% define
handles = guidata(AV_GUI); % <handles> is the current handles info
% find gui's tr
flip = [get(handles.flipx,'Value') get(handles.flipy,'Value') get(handles.flipz,'Value')];
reorder = idx2permutation(get(handles.reorder,'Value'),3);
trans = [handles.txval handles.tyval handles.tzval];
rotorder = idx2permutation(get(handles.rorder,'Value'),3);
rot = [handles.rxval handles.ryval handles.rzval];
matrixsize = AV_TGTSIZE;
matrixfov = AV_TGTSIZE.*AV_TGTLENGTHS;
extrascale = [handles.esxval handles.esyval handles.eszval];
extratrans = [handles.etxval handles.etyval handles.etzval];
extrashear = [handles.ehxval handles.ehyval handles.ehzval];
extrashearflag = [get(handles.ehxf,'Value') get(handles.ehyf,'Value') get(handles.ehzf,'Value')];
trgui = maketransformation(flip,reorder,trans,rotorder,rot,matrixsize,matrixfov,extrascale,extratrans,extrashear,extrashearflag);
% deal with extra if necessary
if isfield(handles.initialtr,'extra') % DEPRECATED
tr = handles.initialtr;
tr.extra = trgui;
else
tr = trgui;
end
% print to command window
if wantprint
if wantprint==1
fprintf(1,'the following constructs the current transformation:\n');
end
printtransformation(tr);
end