0001 function avw_view3(avw,FV),
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023 if ~exist('avw','var'),
0024 msg = sprintf('AVW_VIEW3: No input avw - see help avw_view\n');
0025 error(msg);
0026 end
0027 if ~exist('FV','var'),
0028 FV.vertices = [];
0029 end
0030
0031
0032
0033 GUIwidth = 150;
0034 GUIheight = 50;
0035
0036 name = 'AVW View 3D';
0037 if isfield(avw,'fileprefix'),
0038 if ~isempty(avw.fileprefix),
0039 format = strcat('%+',sprintf('%d',length(avw.fileprefix)+1),'s');
0040 name = strcat('AVW View 3D - ',sprintf(format,avw.fileprefix));
0041 end
0042 end
0043
0044 GUI = figure('Name',name,'Tag','AVWVIEW3','units','characters',...
0045 'NumberTitle','off',...
0046 'MenuBar','figure','Position',[1 1 GUIwidth GUIheight]);
0047 movegui(GUI,'center');
0048
0049 AVWVIEW3.gui = GUI;
0050
0051
0052 Font.FontName = 'Helvetica';
0053 Font.FontUnits = 'Pixels';
0054 Font.FontSize = 12;
0055 Font.FontWeight = 'normal';
0056 Font.FontAngle = 'normal';
0057
0058
0059 shading flat
0060
0061 xdim = size(avw.img,1);
0062 ydim = size(avw.img,2);
0063 zdim = size(avw.img,3);
0064
0065 SagSlice = 1;
0066 CorSlice = 1;
0067 AxiSlice = 1;
0068 if xdim > 1, SagSlice = floor(xdim/2); end
0069 if ydim > 1, CorSlice = floor(ydim/2); end
0070 if zdim > 1, AxiSlice = floor(zdim/2); end
0071
0072
0073
0074
0075
0076
0077
0078
0079
0080
0081 G.H = slice(avw.img,SagSlice,CorSlice,AxiSlice,'nearest');
0082 set(G.H,'edgecolor','none','facealpha',.7);
0083 axis tight, daspect([1,1,1]);
0084 colormap('gray');
0085 xlabel('Coronal')
0086 ylabel('Sagittal')
0087 zlabel('Axial')
0088 view(3)
0089
0090
0091
0092
0093 if ~isempty(FV.vertices),
0094 hold on;
0095
0096
0097
0098
0099 FV.vertices = Rz(FV.vertices,-90,'degrees');
0100
0101 FV.vertices(:,1) = FV.vertices(:,1) + SagSlice;
0102 FV.vertices(:,2) = FV.vertices(:,2) + CorSlice;
0103 FV.vertices(:,3) = FV.vertices(:,3) + AxiSlice;
0104
0105 FV.vertices(:,1) = FV.vertices(:,1) - (SagSlice - CorSlice);
0106 FV.vertices(:,2) = FV.vertices(:,2) - (CorSlice - SagSlice);
0107
0108
0109 patch('vertices',FV.vertices,'faces',FV.faces,...
0110 'FaceColor',[0.0 0.0 0.2],'Edgecolor','none',...
0111 'FaceAlpha',0.5);
0112 end
0113
0114 rotate3d;
0115
0116
0117
0118
0119
0120
0121
0122
0123
0124
0125
0126
0127
0128
0129
0130
0131
0132
0133
0134
0135
0136
0137 Font.FontWeight = 'bold';
0138
0139
0140 G.Bhdr = uicontrol('Parent',GUI,'Style','pushbutton','Units','Normalized', Font, ...
0141 'Position',[.8 .95 .08 .04],...
0142 'String','HDR','BusyAction','queue',...
0143 'TooltipString','View the hdr parameters.',...
0144 'BackgroundColor',[0.0 0.0 0.5],...
0145 'ForegroundColor',[1 1 1], 'HorizontalAlignment', 'center',...
0146 'Callback',strcat('AVWVIEW3 = get(gcbf,''Userdata''); ',...
0147 'avw_view_hdr(AVWVIEW3.avw);',...
0148 'clear AVWVIEW3;'));
0149
0150
0151 G.Bquit = uicontrol('Parent',GUI,'Style','pushbutton','Units','Normalized', Font, ...
0152 'Position',[.9 .95 .08 .04],...
0153 'String','CLOSE','BusyAction','queue',...
0154 'BackgroundColor',[0.75 0.0 0.0],...
0155 'ForegroundColor', [1 1 1], 'HorizontalAlignment', 'center',...
0156 'Callback','close gcbf;');
0157
0158
0159
0160 AVWVIEW3.avw = avw;
0161 AVWVIEW3.FV = FV;
0162 AVWVIEW3.handles = G;
0163 set(AVWVIEW3.gui,'Userdata',AVWVIEW3);
0164
0165
0166 return
0167