Home > bioelectromagnetism > avw_view_old.m

avw_view_old

PURPOSE ^

AVW_VIEW - Create and navigate ortho views of Analyze file

SYNOPSIS ^

function avw_view(avw),

DESCRIPTION ^

 AVW_VIEW - Create and navigate ortho views of Analyze file

 avw_view(avw)

 avw    -  a struct, created by avw_img_read

 The navigation is by sliders and mouse clicks on the
 images in any of the ortho views.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SUBFUNCTIONS ^

SOURCE CODE ^

0001 function avw_view(avw),
0002 
0003 % AVW_VIEW - Create and navigate ortho views of Analyze file
0004 %
0005 % avw_view(avw)
0006 %
0007 % avw    -  a struct, created by avw_img_read
0008 %
0009 % The navigation is by sliders and mouse clicks on the
0010 % images in any of the ortho views.
0011 %
0012 
0013 % $Revision: 1.1 $ $Date: 2004/11/12 01:30:25 $
0014 
0015 % Licence:  GNU GPL, no express or implied warranties
0016 % History:  06/2002, Darren.Weber@flinders.edu.au
0017 %                    The Analyze format is copyright
0018 %                    (c) Copyright, 1986-1995
0019 %                    Biomedical Imaging Resource, Mayo Foundation
0020 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0021 
0022 
0023 if ~exist('avw','var'),
0024     msg = sprintf('AVW_VIEW: No input avw - see help avw_view\n');
0025     error(msg);
0026 end
0027 
0028 
0029 % GUI General Parameters
0030 GUIwidth  = 150;
0031 GUIheight = 50;
0032 if isfield(avw,'fileprefix'),
0033     if isempty(avw.fileprefix),
0034         name = 'AVW View';
0035     else
0036         format = strcat('%+',sprintf('%d',length(avw.fileprefix)+1),'s');
0037         name = strcat('AVW View - ',sprintf(format,avw.fileprefix));
0038     end
0039 else
0040     name = 'AVW View';
0041 end
0042 
0043 GUI = figure('Name',name,'Tag','AVWVIEW','units','characters',...
0044              'NumberTitle','off',...
0045              'MenuBar','figure','Position',[1 1 GUIwidth GUIheight]);
0046 movegui(GUI,'center');
0047 
0048 AVWVIEW.gui = GUI;
0049 
0050 
0051 Font.FontName   = 'Helvetica';
0052 Font.FontUnits  = 'Pixels';
0053 Font.FontSize   = 12;
0054 Font.FontWeight = 'normal';
0055 Font.FontAngle  = 'normal';
0056 
0057 
0058 shading flat
0059 
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 AVWVIEW.origin = [SagSlice,CorSlice,AxiSlice];             % vol origin
0073 AVWVIEW.scale  = double(avw.hdr.dime.pixdim(2:4)) ./ 1000; % vol scale in meters
0074 
0075 % Initialise some window handles
0076 G.Ha = 0;
0077 G.Hc = 0;
0078 G.Hs = 0;
0079 
0080 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0081 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0082 
0083 % Axial Slice
0084 if xdim > 1 & ydim > 1,
0085     
0086     [x,y] = meshgrid(1:xdim,1:ydim);
0087     Xaxial = x'; clear x;
0088     Yaxial = y'; clear y;
0089     Zaxial = zeros(xdim,ydim);
0090     
0091     G.Aa = subplot('position',[0.05 0.56 0.4 0.4]);
0092     colormap('gray');
0093     Saxial = uint8(squeeze(avw.img(:,:,AxiSlice)));
0094     %G.Ha = surf(Xaxial,Yaxial,Zaxial,Saxial,'EdgeColor','none');
0095     
0096     G.Ha = imagesc([0, xdim],[0, ydim],Saxial);
0097     
0098     
0099     axis square, daspect([1,1,1]);
0100     xlabel('(Left <<) X (>> Right)')
0101     ylabel('Y')
0102     zlabel('Z')
0103     title('Axial')
0104     view([0,90]);
0105     
0106     % This callback navigates with left click
0107     set(G.Ha,'ButtonDownFcn',...
0108         strcat('AVWVIEW = get(gcbf,''Userdata''); ',...
0109         'currentpoint = get(get(AVWVIEW.handles.Ha,''Parent''),''CurrentPoint''); ',...
0110         'SagSlice = round(currentpoint(2,1)); ',...
0111         'CorSlice = round(currentpoint(2,2)); ',...
0112         'AxiSlice = round(str2num(get(AVWVIEW.handles.Taxi,''String''))); ',...
0113         'imgvalue = AVWVIEW.avw.img(SagSlice,CorSlice,AxiSlice); ',...
0114         'set(AVWVIEW.handles.imval,''String'',sprintf(''%8.2f'',imgvalue));',...
0115         'set(AVWVIEW.gui,''UserData'',AVWVIEW);',...
0116         'if ishandle(AVWVIEW.handles.Hs) & AVWVIEW.handles.Hs, ',...
0117         '   Ssag = squeeze(AVWVIEW.avw.img(SagSlice,:,:));',...
0118         '   set(AVWVIEW.handles.Hs,''CData'',Ssag); drawnow;',...
0119         '   set(AVWVIEW.handles.Tsag,''String'',num2str(SagSlice));',...
0120         '   set(AVWVIEW.handles.Ssag,''Value'',SagSlice);',...
0121         '   clear Ssag; ',...
0122         '   set(AVWVIEW.gui,''UserData'',AVWVIEW);',...
0123         'end; ',...
0124         'if ishandle(AVWVIEW.handles.Hc) & AVWVIEW.handles.Hc, ',...
0125         '   Scor = squeeze(AVWVIEW.avw.img(:,CorSlice,:));',...
0126         '   set(AVWVIEW.handles.Hc,''CData'',Scor); drawnow;',...
0127         '   set(AVWVIEW.handles.Tcor,''String'',num2str(CorSlice));',...
0128         '   set(AVWVIEW.handles.Scor,''Value'',CorSlice);',...
0129         '   clear Scor; ',...
0130         '   set(AVWVIEW.gui,''UserData'',AVWVIEW);',...
0131         'end; ',...
0132         'clear currentpoint imgvalue AxiSlice CorSlice SagSlice AVWVIEW;'));
0133     
0134     if zdim > 1,
0135         slider_step(1) = 1/(zdim);
0136         slider_step(2) = 1/(zdim);
0137         G.Saxi = uicontrol('Parent',GUI,'Style','slider','Units','Normalized', Font, ...
0138             'Position',[.45 .56 .03 .40], 'HorizontalAlignment', 'center',...
0139             'BusyAction','queue',...
0140             'Min',1,'Max',zdim,'SliderStep',slider_step,'Value',AxiSlice,...
0141             'Callback',strcat('AVWVIEW = get(gcbf,''Userdata''); ',...
0142             'AxiSlice = round(get(AVWVIEW.handles.Saxi,''Value''));',...
0143             'set(AVWVIEW.handles.Saxi,''Value'',AxiSlice);',...
0144             'Saxi = squeeze(AVWVIEW.avw.img(:,:,AxiSlice));',...
0145             'set(AVWVIEW.handles.Ha,''CData'',Saxi); drawnow;',...
0146             'set(AVWVIEW.handles.Taxi,''String'',num2str(AxiSlice));',...
0147             'CorSlice = round(get(AVWVIEW.handles.Scor,''Value''));',...
0148             'SagSlice = round(get(AVWVIEW.handles.Ssag,''Value''));',...
0149             'imgvalue = AVWVIEW.avw.img(SagSlice,CorSlice,AxiSlice); ',...
0150             'set(AVWVIEW.handles.imval,''String'',sprintf(''%8.2f'',imgvalue));',...
0151             'set(AVWVIEW.gui,''UserData'',AVWVIEW);',...
0152             'clear imgvalue Saxi AxiSlice CorSlice SagSlice AVWVIEW;'));
0153     end
0154     G.Taxi = uicontrol('Parent',GUI,'Style','text','Units','Normalized', Font, ...
0155         'Position',[.45 .51 .03 .05], 'HorizontalAlignment', 'center',...
0156         'BusyAction','queue',...
0157         'String',num2str(AxiSlice));
0158 end
0159 
0160 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0161 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0162 
0163 % Coronal Slice
0164 if xdim > 1 & zdim > 1,
0165     
0166     [x,z] = meshgrid(1:xdim,1:zdim);
0167     Xcor = x'; clear x;
0168     Zcor = z'; clear z;
0169     Ycor = zeros(xdim,zdim);
0170     
0171     subplot('position',[0.55 0.56 0.4 0.4])
0172     colormap('gray');
0173     Scor = squeeze(avw.img(:,CorSlice,:));
0174     
0175     G.Hc = surf(Xcor,Ycor,Zcor,Scor,'EdgeColor','none');
0176     axis square, daspect([1,1,1]);
0177     xlabel('(Left <<) X (>> Right)')
0178     ylabel('Y')
0179     zlabel('Z')
0180     title('Coronal')
0181     view([0,0]);
0182     
0183     % This callback navigates with left click
0184     set(G.Hc,'ButtonDownFcn',...
0185         strcat('AVWVIEW = get(gcbf,''Userdata''); ',...
0186         'currentpoint = get(get(AVWVIEW.handles.Hc,''Parent''),''CurrentPoint''); ',...
0187         'SagSlice = round(currentpoint(2,1)); ',...
0188         'AxiSlice = round(currentpoint(2,3)); ',...
0189         'CorSlice = round(str2num(get(AVWVIEW.handles.Tcor,''String''))); ',...
0190         'imgvalue = AVWVIEW.avw.img(SagSlice,CorSlice,AxiSlice); ',...
0191         'set(AVWVIEW.handles.imval,''String'',sprintf(''%8.2f'',imgvalue));',...
0192         'set(AVWVIEW.gui,''UserData'',AVWVIEW);',...
0193         'if ishandle(AVWVIEW.handles.Hs) & AVWVIEW.handles.Hs, ',...
0194         '   Ssag = squeeze(AVWVIEW.avw.img(SagSlice,:,:));',...
0195         '   set(AVWVIEW.handles.Hs,''CData'',Ssag); drawnow;',...
0196         '   set(AVWVIEW.handles.Tsag,''String'',num2str(SagSlice));',...
0197         '   set(AVWVIEW.handles.Ssag,''Value'',SagSlice);',...
0198         '   clear Ssag; ',...
0199         '   set(AVWVIEW.gui,''UserData'',AVWVIEW);',...
0200         'end; ',...
0201         'if ishandle(AVWVIEW.handles.Ha) & AVWVIEW.handles.Ha, ',...
0202         '   Saxi = squeeze(AVWVIEW.avw.img(:,:,AxiSlice));',...
0203         '   set(AVWVIEW.handles.Ha,''CData'',Saxi); drawnow;',...
0204         '   set(AVWVIEW.handles.Taxi,''String'',num2str(AxiSlice));',...
0205         '   set(AVWVIEW.handles.Saxi,''Value'',AxiSlice);',...
0206         '   clear Saxi; ',...
0207         '   set(AVWVIEW.gui,''UserData'',AVWVIEW);',...
0208         'end; ',...
0209         'clear currentpoint imgvalue AxiSlice CorSlice SagSlice AVWVIEW;'));
0210     
0211     if ydim > 1,
0212         slider_step(1) = 1/(ydim);
0213         slider_step(2) = 1/(ydim);
0214         G.Scor = uicontrol('Parent',GUI,'Style','slider','Units','Normalized', Font, ...
0215             'Position',[.95 .56 .03 .40], 'HorizontalAlignment', 'center',...
0216             'BusyAction','queue',...
0217             'Min',1,'Max',ydim,'SliderStep',slider_step,'Value',CorSlice,...
0218             'Callback',strcat('AVWVIEW = get(gcbf,''Userdata''); ',...
0219             'CorSlice = round(get(AVWVIEW.handles.Scor,''Value''));',...
0220             'set(AVWVIEW.handles.Scor,''Value'',CorSlice);',...
0221             'Scor = squeeze(AVWVIEW.avw.img(:,CorSlice,:));',...
0222             'set(AVWVIEW.handles.Hc,''CData'',Scor); drawnow;',...
0223             'set(AVWVIEW.handles.Tcor,''String'',num2str(CorSlice));',...
0224             'AxiSlice = round(get(AVWVIEW.handles.Saxi,''Value''));',...
0225             'SagSlice = round(get(AVWVIEW.handles.Ssag,''Value''));',...
0226             'imgvalue = AVWVIEW.avw.img(SagSlice,CorSlice,AxiSlice); ',...
0227             'set(AVWVIEW.handles.imval,''String'',sprintf(''%8.2f'',imgvalue));',...
0228             'set(AVWVIEW.gui,''UserData'',AVWVIEW);',...
0229             'clear imgvalue Scor AxiSlice CorSlice SagSlice AVWVIEW;'));
0230     end
0231     G.Tcor = uicontrol('Parent',GUI,'Style','text','Units','Normalized', Font, ...
0232         'Position',[.95 .51 .03 .05], 'HorizontalAlignment', 'center',...
0233         'BusyAction','queue',...
0234         'String',num2str(CorSlice));
0235 end
0236 
0237 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0238 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0239 
0240 % Sagittal Slice
0241 if ydim > 1 & ydim > 1,
0242         
0243     [y,z] = meshgrid(1:ydim,1:zdim);
0244     Ysag = y'; clear y;
0245     Zsag = z'; clear z;
0246     Xsag = zeros(ydim,zdim);
0247     
0248     subplot('position',[0.05 0.06 0.4 0.4])
0249     colormap('gray');
0250     Ssag = squeeze(avw.img(SagSlice,:,:));
0251     
0252     G.Hs = surf(Xsag,Ysag,Zsag,Ssag,'EdgeColor','none');
0253     axis square, daspect([1,1,1]);
0254     xlabel('(Left <<) X (>> Right)')
0255     ylabel('Y')
0256     zlabel('Z')
0257     title('Sagittal')
0258     view([90,0]);
0259     
0260     % This callback navigates with mouse click
0261     set(G.Hs,'ButtonDownFcn',...
0262         strcat('AVWVIEW = get(gcbf,''Userdata''); ',...
0263         'currentpoint = get(get(AVWVIEW.handles.Hs,''Parent''),''CurrentPoint''); ',...
0264         'CorSlice = round(currentpoint(1,2)); ',...
0265         'AxiSlice = round(currentpoint(1,3)); ',...
0266         'SagSlice = round(str2num(get(AVWVIEW.handles.Tsag,''String'')));',...
0267         'imgvalue = AVWVIEW.avw.img(SagSlice,CorSlice,AxiSlice); ',...
0268         'set(AVWVIEW.handles.imval,''String'',sprintf(''%8.2f'',imgvalue));',...
0269         'set(AVWVIEW.gui,''UserData'',AVWVIEW);',...
0270         'if ishandle(AVWVIEW.handles.Hc) & AVWVIEW.handles.Hc, ',...
0271         '   Scor = squeeze(AVWVIEW.avw.img(:,CorSlice,:));',...
0272         '   set(AVWVIEW.handles.Hc,''CData'',Scor); drawnow;',...
0273         '   set(AVWVIEW.handles.Tcor,''String'',num2str(CorSlice));',...
0274         '   set(AVWVIEW.handles.Scor,''Value'',CorSlice);',...
0275         '   clear Scor; ',...
0276         '   set(AVWVIEW.gui,''UserData'',AVWVIEW);',...
0277         'end; ',...
0278         'if ishandle(AVWVIEW.handles.Ha) & AVWVIEW.handles.Ha, ',...
0279         '   Saxi = squeeze(AVWVIEW.avw.img(:,:,AxiSlice));',...
0280         '   set(AVWVIEW.handles.Ha,''CData'',Saxi); drawnow;',...
0281         '   set(AVWVIEW.handles.Taxi,''String'',num2str(AxiSlice));',...
0282         '   set(AVWVIEW.handles.Saxi,''Value'',AxiSlice);',...
0283         '   clear Saxi; ',...
0284         '   set(AVWVIEW.gui,''UserData'',AVWVIEW);',...
0285         'end; ',...
0286         'clear currentpoint imgvalue AxiSlice CorSlice SagSlice AVWVIEW;'));
0287 
0288     
0289     if xdim > 1,
0290         slider_step(1) = 1/(xdim);
0291         slider_step(2) = 1/(xdim);
0292         G.Ssag = uicontrol('Parent',GUI,'Style','slider','Units','Normalized', Font, ...
0293             'Position',[.45 .06 .03 .4], 'HorizontalAlignment', 'center',...
0294             'BusyAction','queue',...
0295             'Min',1,'Max',xdim,'SliderStep',slider_step,'Value',SagSlice,...
0296             'Callback',strcat('AVWVIEW = get(gcbf,''Userdata''); ',...
0297             'SagSlice = round(get(AVWVIEW.handles.Ssag,''Value''));',...
0298             'set(AVWVIEW.handles.Ssag,''Value'',SagSlice);',...
0299             'Ssag = squeeze(AVWVIEW.avw.img(SagSlice,:,:));',...
0300             'set(AVWVIEW.handles.Hs,''CData'',Ssag); drawnow;',...
0301             'set(AVWVIEW.handles.Tsag,''String'',num2str(SagSlice));',...
0302             'AxiSlice = round(get(AVWVIEW.handles.Saxi,''Value''));',...
0303             'CorSlice = round(get(AVWVIEW.handles.Scor,''Value''));',...
0304             'imgvalue = AVWVIEW.avw.img(SagSlice,CorSlice,AxiSlice); ',...
0305             'set(AVWVIEW.handles.imval,''String'',sprintf(''%8.2f'',imgvalue));',...
0306             'set(AVWVIEW.gui,''UserData'',AVWVIEW);',...
0307             'clear imgvalue Ssag AxiSlice CorSlice SagSlice AVWVIEW;'));
0308     end
0309     G.Tsag = uicontrol('Parent',GUI,'Style','text','Units','Normalized', Font, ...
0310         'Position',[.45 .01 .03 .05], 'HorizontalAlignment', 'center',...
0311         'BusyAction','queue',...
0312         'String',num2str(SagSlice));
0313 end
0314 
0315 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0316 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0317 
0318 % Intensity Value at Mouse Click
0319 
0320 G.Timval = uicontrol('Parent',GUI,'Style','text','Units','Normalized', Font, ...
0321     'Position',[.575 .40 .20 .05], 'HorizontalAlignment', 'left',...
0322     'BusyAction','queue',...
0323     'String','Image Intensity');
0324 G.imval = uicontrol('Parent',GUI,'Style','text','Units','Normalized', Font, ...
0325     'Position',[.775 .40 .20 .05], 'HorizontalAlignment', 'right',...
0326     'BusyAction','queue',...
0327     'String','x');
0328 
0329 % Nasion Location
0330 G.Tnasion = uicontrol('Parent',GUI,'Style','pushbutton','Units','Normalized', Font, ...
0331     'Position',[.575 .35 .20 .04], 'HorizontalAlignment', 'left',...
0332     'BusyAction','queue',...
0333     'TooltipString','Update Nasion - should be toward +Y',...
0334     'String','Fiducial: Nasion',...
0335     'Callback',strcat('AVWVIEW = get(gcbf,''Userdata''); ',...
0336             'SagSlice = get(AVWVIEW.handles.Ssag,''Value'');',...
0337             'CorSlice = get(AVWVIEW.handles.Scor,''Value'');',...
0338             'AxiSlice = get(AVWVIEW.handles.Saxi,''Value'');',...
0339             'imgXYZ   = [SagSlice,CorSlice,AxiSlice]; ',...
0340             'imgXYZ = (imgXYZ - AVWVIEW.origin) .* AVWVIEW.scale; ',...
0341             'set(AVWVIEW.handles.nasion,''String'',sprintf(''%6.3f %6.3f %6.3f'',imgXYZ));',...
0342             'AVWVIEW.p.mriFID(1,:) = imgXYZ; ',...
0343             'set(AVWVIEW.gui,''UserData'',AVWVIEW);',...
0344             'clear imgXYZ AxiSlice CorSlice SagSlice AVWVIEW;'));
0345 G.nasion = uicontrol('Parent',GUI,'Style','text','Units','Normalized', Font, ...
0346     'Position',[.775 .35 .20 .04], 'HorizontalAlignment', 'right',...
0347     'BusyAction','queue',...
0348     'TooltipString','In meters, origin at (0,0,0), should be toward +Y',...
0349     'String','x,y,z');
0350 % Right Preauricular Location
0351 G.Trpa = uicontrol('Parent',GUI,'Style','pushbutton','Units','Normalized', Font, ...
0352     'Position',[.575 .30 .20 .04], 'HorizontalAlignment', 'left',...
0353     'BusyAction','queue',...
0354     'TooltipString','Update Right Preauricular - should be toward +X',...
0355     'String','Fiducial: RPA',...
0356     'Callback',strcat('AVWVIEW = get(gcbf,''Userdata''); ',...
0357             'SagSlice = get(AVWVIEW.handles.Ssag,''Value'');',...
0358             'CorSlice = get(AVWVIEW.handles.Scor,''Value'');',...
0359             'AxiSlice = get(AVWVIEW.handles.Saxi,''Value'');',...
0360             'imgXYZ   = [SagSlice,CorSlice,AxiSlice]; ',...
0361             'imgXYZ = (imgXYZ - AVWVIEW.origin) .* AVWVIEW.scale; ',...
0362             'set(AVWVIEW.handles.rpa,''String'',sprintf(''%6.3f %6.3f %6.3f'',imgXYZ));',...
0363             'AVWVIEW.p.mriFID(2,:) = imgXYZ; ',...
0364             'set(AVWVIEW.gui,''UserData'',AVWVIEW);',...
0365             'clear imgXYZ AxiSlice CorSlice SagSlice AVWVIEW;'));
0366 G.rpa = uicontrol('Parent',GUI,'Style','text','Units','Normalized', Font, ...
0367     'Position',[.775 .30 .20 .04], 'HorizontalAlignment', 'right',...
0368     'BusyAction','queue',...
0369     'TooltipString','In meters, origin at (0,0,0), should be toward +X',...
0370     'String','x,y,z');
0371 % Left Preauricular Location
0372 G.Tlpa = uicontrol('Parent',GUI,'Style','pushbutton','Units','Normalized', Font, ...
0373     'Position',[.575 .25 .20 .04], 'HorizontalAlignment', 'left',...
0374     'BusyAction','queue',...
0375     'TooltipString','Update Left Preauricular - should be toward -X',...
0376     'String','Fiducial: LPA',...
0377     'Callback',strcat('AVWVIEW = get(gcbf,''Userdata''); ',...
0378             'SagSlice = get(AVWVIEW.handles.Ssag,''Value'');',...
0379             'CorSlice = get(AVWVIEW.handles.Scor,''Value'');',...
0380             'AxiSlice = get(AVWVIEW.handles.Saxi,''Value'');',...
0381             'imgXYZ   = [SagSlice,CorSlice,AxiSlice]; ',...
0382             'imgXYZ = (imgXYZ - AVWVIEW.origin) .* AVWVIEW.scale; ',...
0383             'set(AVWVIEW.handles.lpa,''String'',sprintf(''%6.3f %6.3f %6.3f'',imgXYZ));',...
0384             'AVWVIEW.p.mriFID(3,:) = imgXYZ; ',...
0385             'set(AVWVIEW.gui,''UserData'',AVWVIEW);',...
0386             'clear imgXYZ AxiSlice CorSlice SagSlice AVWVIEW;'));
0387 G.lpa = uicontrol('Parent',GUI,'Style','text','Units','Normalized', Font, ...
0388     'Position',[.775 .25 .20 .04], 'HorizontalAlignment', 'right',...
0389     'BusyAction','queue',...
0390     'TooltipString','In meters, origin at (0,0,0), should be toward -X',...
0391     'String','x,y,z');
0392 
0393 
0394 
0395 
0396 
0397 
0398 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0399 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0400 
0401 Font.FontWeight = 'bold';
0402 
0403 % OK: Return the avw!
0404 G.Bhdr = uicontrol('Parent',GUI,'Style','pushbutton','Units','Normalized', Font, ...
0405     'Position',[.8 .01 .08 .04],...
0406     'String','HDR','BusyAction','queue',...
0407     'TooltipString','Save the hdr parameters.',...
0408     'BackgroundColor',[0.0 0.0 0.5],...
0409     'ForegroundColor',[1 1 1], 'HorizontalAlignment', 'center',...
0410     'Callback',strcat('AVWVIEW = get(gcbf,''Userdata''); ',...
0411         'avw_view_hdr(AVWVIEW.avw);',...
0412         'clear AVWVIEW;'));
0413 
0414 % Cancel
0415 G.Bquit = uicontrol('Parent',GUI,'Style','pushbutton','Units','Normalized', Font, ...
0416     'Position',[.9 .01 .08 .04],...
0417     'String','RETURN','BusyAction','queue',...
0418     'BackgroundColor',[0.75 0.0 0.0],...
0419     'ForegroundColor', [1 1 1], 'HorizontalAlignment', 'center',...
0420     'Callback',strcat('AVWVIEW = get(gcbf,''Userdata''); ',...
0421         'if isfield(AVWVIEW,''p''), ',...
0422         '  if isfield(AVWVIEW.p,''mriFID''), ',...
0423         '    if exist(''p'',''var''), ',...
0424         '      p.mriFID = AVWVIEW.p.mriFID; ',...
0425         '    else, ',...
0426         '      mriFID = AVWVIEW.p.mriFID;',...
0427         '    end; ',...
0428         '  end; ',...
0429         'end; ',...
0430         'clear AVWVIEW; close gcbf;'));
0431 
0432 % Update the gui_struct handles for this gui
0433 AVWVIEW.avw = avw;
0434 AVWVIEW.handles = G;
0435 set(AVWVIEW.gui,'Userdata',AVWVIEW);
0436 set(AVWVIEW.gui,'HandleVisibility','callback');
0437 
0438 return
0439 
0440 
0441 function slice_img(avw),
0442 
0443     figure
0444     xslice = 128;
0445     slice = squeeze( avw.img(xslice,:,:) );
0446     imagesc(slice); axis image; colormap('gray')
0447     figure
0448     yslice = 128;
0449     slice = squeeze( avw.img(:,yslice,:) );
0450     imagesc(slice); axis image; colormap('gray')
0451     figure
0452     zslice = 128;
0453     slice = squeeze( avw.img(:,:,zslice) );
0454     imagesc(slice); axis image; colormap('gray')
0455 
0456 return

Generated on Mon 15-Aug-2005 15:36:19 by m2html © 2003