Home > bioelectromagnetism > avw_view_v5.m

avw_view_v5

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.
 Fiducial points can be selected, which are returned
 into mriFID or p.mriFID in the base workspace.  These
 points are given in meters, with an origin translated 
 from the center of the MRI volume to (0,0,0).  +X is
 right, +Y is anterior, +Z is superior, the default RAS
 orientation of Analyze MRI files.

 See also, AVW_IMG_READ

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 % Fiducial points can be selected, which are returned
0012 % into mriFID or p.mriFID in the base workspace.  These
0013 % points are given in meters, with an origin translated
0014 % from the center of the MRI volume to (0,0,0).  +X is
0015 % right, +Y is anterior, +Z is superior, the default RAS
0016 % orientation of Analyze MRI files.
0017 %
0018 % See also, AVW_IMG_READ
0019 %
0020 
0021 % Licence:  GNU GPL, no express or implied warranties
0022 % History:  06/2002, Darren.Weber@flinders.edu.au
0023 %           10/2002, Darren.Weber@flinders.edu.au
0024 %                    added fiducial point determination
0025 %                    changed plots from surf to imagesc commands
0026 %                    added handling of datatype for avw.img
0027 %                    altered daspect to use avw.hdr.dime.pixdim
0028 %                    altered color scheme
0029 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0030 
0031 ver = version;
0032 ver = str2num(ver(1));  % check for matlab version!
0033 if ver < 6,
0034   msg = sprintf('...sorry, GUI will not work with matlab version < 6.\n');
0035   error(msg);
0036 end
0037 
0038 if ~exist('avw','var'),
0039     msg = sprintf('...no input avw - see help avw_view\n');
0040     error(msg);
0041 end
0042 
0043 % determine the datatype of avw.img
0044 switch double(avw.hdr.dime.bitpix),
0045 case 1,
0046     fprintf('...converting avw.img to uint8\n');
0047     avw.img = uint8(avw.img);
0048 case 8,
0049     fprintf('...converting avw.img to uint8\n');
0050     avw.img = uint8(avw.img);
0051 case 16,
0052     fprintf('...converting avw.img to uint16\n');
0053     avw.img = uint16(avw.img);
0054 case {32,64},
0055     % make sure it is double, not single
0056     avw.img = double(avw.img);
0057 otherwise,
0058     % do nothing, leave it as is
0059 end
0060 
0061 
0062 % GUI General Parameters
0063 GUIwidth  = 150;
0064 GUIheight = 50;
0065 if isfield(avw,'fileprefix'),
0066     if isempty(avw.fileprefix),
0067         name = 'AVW View';
0068     else
0069         format = strcat('%+',sprintf('%d',length(avw.fileprefix)+1),'s');
0070         name = strcat('AVW View - ',sprintf(format,avw.fileprefix));
0071     end
0072 else
0073     name = 'AVW View';
0074 end
0075 
0076 GUI = figure('Name',name,'Tag','AVWVIEW','units','characters',...
0077              'NumberTitle','off','color',[0 0 0],...
0078              'MenuBar','figure','Position',[1 1 GUIwidth GUIheight]);
0079 movegui(GUI,'center');
0080 
0081 AVWVIEW.gui = GUI;
0082 
0083 
0084 Font.FontName   = 'Helvetica';
0085 Font.FontUnits  = 'Pixels';
0086 Font.FontSize   = 12;
0087 Font.FontWeight = 'normal';
0088 Font.FontAngle  = 'normal';
0089 
0090 
0091 shading flat
0092 
0093 
0094 xdim = size(avw.img,1);
0095 ydim = size(avw.img,2);
0096 zdim = size(avw.img,3);
0097 
0098 SagSlice = 1;
0099 CorSlice = 1;
0100 AxiSlice = 1;
0101 if xdim > 1, SagSlice = floor(xdim/2); end
0102 if ydim > 1, CorSlice = floor(ydim/2); end
0103 if zdim > 1, AxiSlice = floor(zdim/2); end
0104 
0105 AVWVIEW.origin  = [SagSlice,CorSlice,AxiSlice];             % vol origin
0106 
0107 pixdim = double(avw.hdr.dime.pixdim(2:4));
0108 
0109 AVWVIEW.scale   = pixdim ./ 1000; % vol scale in meters
0110 AVWVIEW.daspect = pixdim ./ max(pixdim);
0111 
0112 % Initialise some window handles
0113 G.Ha = 0;
0114 G.Hc = 0;
0115 G.Hs = 0;
0116 
0117 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0118 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0119 
0120 % Axial Slice
0121 if xdim > 1 & ydim > 1,
0122 
0123 G.Aa = subplot('position',[0.05 0.56 0.4 0.4]);
0124 colormap('gray');
0125     
0126 Saxial = squeeze(avw.img(:,:,AxiSlice));
0127     G.Ha = imagesc([0,xdim],[0,ydim],Saxial');
0128     set(gca,'YDir','normal','YColor',[1 1 1],'XColor',[1 1 1])
0129     
0130     daspect(AVWVIEW.daspect([2 1 3]));
0131     
0132     xlabel('(Left <<) X (>> Right)')
0133 ylabel('Y')
0134 title('Axial')
0135 
0136 % This callback navigates with left click
0137 set(G.Ha,'ButtonDownFcn',...
0138         strcat('AVWVIEW = get(gcbf,''Userdata''); ',...
0139         'currentpoint = get(get(AVWVIEW.handles.Ha,''Parent''),''CurrentPoint''); ',...
0140         'SagSlice = round(currentpoint(2,1)); ',...
0141         'CorSlice = round(currentpoint(2,2)); ',...
0142         'AxiSlice = round(str2num(get(AVWVIEW.handles.Taxi,''String''))); ',...
0143         'imgvalue = double(AVWVIEW.avw.img(SagSlice,CorSlice,AxiSlice)); ',...
0144         'set(AVWVIEW.handles.imval,''String'',sprintf(''%8.2f'',imgvalue));',...
0145         'set(AVWVIEW.gui,''UserData'',AVWVIEW);',...
0146         'if ishandle(AVWVIEW.handles.Hs) & AVWVIEW.handles.Hs, ',...
0147         '   Ssag = squeeze(AVWVIEW.avw.img(SagSlice,:,:));',...
0148         '   set(AVWVIEW.handles.Hs,''CData'',Ssag''); ',...
0149         '   set(AVWVIEW.handles.Tsag,''String'',num2str(SagSlice));',...
0150         '   set(AVWVIEW.handles.Ssag,''Value'',SagSlice);',...
0151         '   clear Ssag; ',...
0152         '   set(AVWVIEW.gui,''UserData'',AVWVIEW);',...
0153         'end; ',...
0154         'if ishandle(AVWVIEW.handles.Hc) & AVWVIEW.handles.Hc, ',...
0155         '   Scor = squeeze(AVWVIEW.avw.img(:,CorSlice,:));',...
0156         '   set(AVWVIEW.handles.Hc,''CData'',Scor''); ',...
0157         '   set(AVWVIEW.handles.Tcor,''String'',num2str(CorSlice));',...
0158         '   set(AVWVIEW.handles.Scor,''Value'',CorSlice);',...
0159         '   clear Scor; ',...
0160         '   set(AVWVIEW.gui,''UserData'',AVWVIEW);',...
0161         'end; ',...
0162         'clear currentpoint imgvalue AxiSlice CorSlice SagSlice AVWVIEW;'));
0163     
0164     if zdim > 1,
0165 slider_step(1) = 1/(zdim);
0166 slider_step(2) = 1/(zdim);
0167 G.Saxi = uicontrol('Parent',GUI,'Style','slider','Units','Normalized', Font, ...
0168             'Position',[.45 .56 .03 .40], 'HorizontalAlignment', 'center',...
0169             'BusyAction','queue',...
0170             'Min',1,'Max',zdim,'SliderStep',slider_step,'Value',AxiSlice,...
0171             'Callback',strcat('AVWVIEW = get(gcbf,''Userdata''); ',...
0172             'AxiSlice = round(get(AVWVIEW.handles.Saxi,''Value''));',...
0173             'set(AVWVIEW.handles.Saxi,''Value'',AxiSlice);',...
0174             'Saxi = squeeze(AVWVIEW.avw.img(:,:,AxiSlice));',...
0175             'set(AVWVIEW.handles.Ha,''CData'',Saxi''); ',...
0176             'set(AVWVIEW.handles.Taxi,''String'',num2str(AxiSlice));',...
0177             'CorSlice = round(get(AVWVIEW.handles.Scor,''Value''));',...
0178             'SagSlice = round(get(AVWVIEW.handles.Ssag,''Value''));',...
0179             'imgvalue = double(AVWVIEW.avw.img(SagSlice,CorSlice,AxiSlice)); ',...
0180             'set(AVWVIEW.handles.imval,''String'',sprintf(''%8.2f'',imgvalue));',...
0181             'set(AVWVIEW.gui,''UserData'',AVWVIEW);',...
0182             'clear imgvalue Saxi AxiSlice CorSlice SagSlice AVWVIEW;'));
0183     end
0184 G.Taxi = uicontrol('Parent',GUI,'Style','text','Units','Normalized', Font, ...
0185         'Position',[.45 .51 .03 .05], 'HorizontalAlignment', 'center',...
0186         'BusyAction','queue',...
0187         'String',num2str(AxiSlice));
0188 end
0189 
0190 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0191 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0192 
0193 % Coronal Slice
0194 if xdim > 1 & zdim > 1,
0195 
0196 subplot('position',[0.55 0.56 0.4 0.4])
0197 colormap('gray');
0198     
0199 Scor = squeeze(avw.img(:,CorSlice,:));
0200     G.Hc = imagesc([0,xdim],[0,zdim],Scor');
0201     set(gca,'YDir','normal','YColor',[1 1 1],'XColor',[1 1 1])
0202     
0203     daspect(AVWVIEW.daspect([3 1 2]));
0204 
0205     xlabel('(Left <<) X (>> Right)')
0206 ylabel('Z')
0207 title('Coronal')
0208 
0209 % This callback navigates with left click
0210 set(G.Hc,'ButtonDownFcn',...
0211         strcat('AVWVIEW = get(gcbf,''Userdata''); ',...
0212         'currentpoint = get(get(AVWVIEW.handles.Hc,''Parent''),''CurrentPoint''); ',...
0213         'SagSlice = round(currentpoint(2,1)); ',...
0214         'AxiSlice = round(currentpoint(2,2)); ',...
0215         'CorSlice = round(str2num(get(AVWVIEW.handles.Tcor,''String''))); ',...
0216         'imgvalue = double(AVWVIEW.avw.img(SagSlice,CorSlice,AxiSlice)); ',...
0217         'set(AVWVIEW.handles.imval,''String'',sprintf(''%8.2f'',imgvalue));',...
0218         'set(AVWVIEW.gui,''UserData'',AVWVIEW);',...
0219         'if ishandle(AVWVIEW.handles.Hs) & AVWVIEW.handles.Hs, ',...
0220         '   Ssag = squeeze(AVWVIEW.avw.img(SagSlice,:,:));',...
0221         '   set(AVWVIEW.handles.Hs,''CData'',Ssag''); ',...
0222         '   set(AVWVIEW.handles.Tsag,''String'',num2str(SagSlice));',...
0223         '   set(AVWVIEW.handles.Ssag,''Value'',SagSlice);',...
0224         '   clear Ssag; ',...
0225         '   set(AVWVIEW.gui,''UserData'',AVWVIEW);',...
0226         'end; ',...
0227         'if ishandle(AVWVIEW.handles.Ha) & AVWVIEW.handles.Ha, ',...
0228         '   Saxi = squeeze(AVWVIEW.avw.img(:,:,AxiSlice));',...
0229         '   set(AVWVIEW.handles.Ha,''CData'',Saxi''); ',...
0230         '   set(AVWVIEW.handles.Taxi,''String'',num2str(AxiSlice));',...
0231         '   set(AVWVIEW.handles.Saxi,''Value'',AxiSlice);',...
0232         '   clear Saxi; ',...
0233         '   set(AVWVIEW.gui,''UserData'',AVWVIEW);',...
0234         'end; ',...
0235         'clear currentpoint imgvalue AxiSlice CorSlice SagSlice AVWVIEW;'));
0236     
0237     if ydim > 1,
0238         slider_step(1) = 1/(ydim);
0239 slider_step(2) = 1/(ydim);
0240 G.Scor = uicontrol('Parent',GUI,'Style','slider','Units','Normalized', Font, ...
0241             'Position',[.95 .56 .03 .40], 'HorizontalAlignment', 'center',...
0242             'BusyAction','queue',...
0243             'Min',1,'Max',ydim,'SliderStep',slider_step,'Value',CorSlice,...
0244             'Callback',strcat('AVWVIEW = get(gcbf,''Userdata''); ',...
0245             'CorSlice = round(get(AVWVIEW.handles.Scor,''Value''));',...
0246             'set(AVWVIEW.handles.Scor,''Value'',CorSlice);',...
0247             'Scor = squeeze(AVWVIEW.avw.img(:,CorSlice,:));',...
0248             'set(AVWVIEW.handles.Hc,''CData'',Scor); drawnow;',...
0249             'set(AVWVIEW.handles.Tcor,''String'',num2str(CorSlice));',...
0250             'AxiSlice = round(get(AVWVIEW.handles.Saxi,''Value''));',...
0251             'SagSlice = round(get(AVWVIEW.handles.Ssag,''Value''));',...
0252             'imgvalue = double(AVWVIEW.avw.img(SagSlice,CorSlice,AxiSlice)); ',...
0253             'set(AVWVIEW.handles.imval,''String'',sprintf(''%8.2f'',imgvalue));',...
0254             'set(AVWVIEW.gui,''UserData'',AVWVIEW);',...
0255             'clear imgvalue Scor AxiSlice CorSlice SagSlice AVWVIEW;'));
0256     end
0257 G.Tcor = uicontrol('Parent',GUI,'Style','text','Units','Normalized', Font, ...
0258         'Position',[.95 .51 .03 .05], 'HorizontalAlignment', 'center',...
0259         'BusyAction','queue',...
0260         'String',num2str(CorSlice));
0261 end
0262 
0263 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0264 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0265 
0266 % Sagittal Slice
0267 if ydim > 1 & ydim > 1,
0268 
0269 [y,z] = meshgrid(1:ydim,1:zdim);
0270 Ysag = y'; clear y;
0271 Zsag = z'; clear z;
0272 Xsag = zeros(ydim,zdim);
0273 
0274 subplot('position',[0.05 0.06 0.4 0.4])
0275 colormap('gray');
0276     
0277 Ssag = squeeze(avw.img(SagSlice,:,:));
0278     G.Hs = imagesc([0,ydim],[0,zdim],Ssag');
0279     set(gca,'YDir','normal','YColor',[1 1 1],'XColor',[1 1 1])
0280     
0281     daspect(AVWVIEW.daspect([3 2 1]));
0282     
0283     xlabel('Y')
0284 ylabel('Z')
0285 title('Sagittal')
0286 
0287 % This callback navigates with mouse click
0288 set(G.Hs,'ButtonDownFcn',...
0289         strcat('AVWVIEW = get(gcbf,''Userdata''); ',...
0290         'currentpoint = get(get(AVWVIEW.handles.Hs,''Parent''),''CurrentPoint''); ',...
0291         'CorSlice = round(currentpoint(1,1)); ',...
0292         'AxiSlice = round(currentpoint(1,2)); ',...
0293         'SagSlice = round(str2num(get(AVWVIEW.handles.Tsag,''String'')));',...
0294         'imgvalue = double(AVWVIEW.avw.img(SagSlice,CorSlice,AxiSlice)); ',...
0295         'set(AVWVIEW.handles.imval,''String'',sprintf(''%8.2f'',imgvalue));',...
0296         'set(AVWVIEW.gui,''UserData'',AVWVIEW);',...
0297         'if ishandle(AVWVIEW.handles.Hc) & AVWVIEW.handles.Hc, ',...
0298         '   Scor = squeeze(AVWVIEW.avw.img(:,CorSlice,:));',...
0299         '   set(AVWVIEW.handles.Hc,''CData'',Scor''); ',...
0300         '   set(AVWVIEW.handles.Tcor,''String'',num2str(CorSlice));',...
0301         '   set(AVWVIEW.handles.Scor,''Value'',CorSlice);',...
0302         '   clear Scor; ',...
0303         '   set(AVWVIEW.gui,''UserData'',AVWVIEW);',...
0304         'end; ',...
0305         'if ishandle(AVWVIEW.handles.Ha) & AVWVIEW.handles.Ha, ',...
0306         '   Saxi = squeeze(AVWVIEW.avw.img(:,:,AxiSlice));',...
0307         '   set(AVWVIEW.handles.Ha,''CData'',Saxi''); ',...
0308         '   set(AVWVIEW.handles.Taxi,''String'',num2str(AxiSlice));',...
0309         '   set(AVWVIEW.handles.Saxi,''Value'',AxiSlice);',...
0310         '   clear Saxi; ',...
0311         '   set(AVWVIEW.gui,''UserData'',AVWVIEW);',...
0312         'end; ',...
0313         'clear currentpoint imgvalue AxiSlice CorSlice SagSlice AVWVIEW;'));
0314 
0315     
0316     if xdim > 1,
0317 slider_step(1) = 1/(xdim);
0318 slider_step(2) = 1/(xdim);
0319 G.Ssag = uicontrol('Parent',GUI,'Style','slider','Units','Normalized', Font, ...
0320             'Position',[.45 .06 .03 .4], 'HorizontalAlignment', 'center',...
0321             'BusyAction','queue',...
0322             'Min',1,'Max',xdim,'SliderStep',slider_step,'Value',SagSlice,...
0323             'Callback',strcat('AVWVIEW = get(gcbf,''Userdata''); ',...
0324             'SagSlice = round(get(AVWVIEW.handles.Ssag,''Value''));',...
0325             'set(AVWVIEW.handles.Ssag,''Value'',SagSlice);',...
0326             'Ssag = squeeze(AVWVIEW.avw.img(SagSlice,:,:));',...
0327             'set(AVWVIEW.handles.Hs,''CData'',Ssag); drawnow;',...
0328             'set(AVWVIEW.handles.Tsag,''String'',num2str(SagSlice));',...
0329             'AxiSlice = round(get(AVWVIEW.handles.Saxi,''Value''));',...
0330             'CorSlice = round(get(AVWVIEW.handles.Scor,''Value''));',...
0331             'imgvalue = double(AVWVIEW.avw.img(SagSlice,CorSlice,AxiSlice)); ',...
0332             'set(AVWVIEW.handles.imval,''String'',sprintf(''%8.2f'',imgvalue));',...
0333             'set(AVWVIEW.gui,''UserData'',AVWVIEW);',...
0334             'clear imgvalue Ssag AxiSlice CorSlice SagSlice AVWVIEW;'));
0335     end
0336 G.Tsag = uicontrol('Parent',GUI,'Style','text','Units','Normalized', Font, ...
0337         'Position',[.45 .01 .03 .05], 'HorizontalAlignment', 'center',...
0338         'BusyAction','queue',...
0339         'String',num2str(SagSlice));
0340 end
0341 
0342 
0343 
0344 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0345 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0346 
0347 % Intensity Value at Mouse Click
0348 
0349 G.Timval = uicontrol('Parent',GUI,'Style','text','Units','Normalized', Font, ...
0350     'Position',[.575 .40 .20 .05], 'HorizontalAlignment', 'left',...
0351     'BackgroundColor', [0 0 0],...
0352     'ForegroundColor', [1 1 1],...
0353     'BusyAction','queue',...
0354     'String','Image Intensity');
0355 G.imval = uicontrol('Parent',GUI,'Style','text','Units','Normalized', Font, ...
0356     'Position',[.775 .40 .20 .05], 'HorizontalAlignment', 'right',...
0357     'BackgroundColor', [0 0 0],...
0358     'ForegroundColor', [1 1 1],...
0359     'BusyAction','queue',...
0360     'String','x');
0361 
0362 % Nasion Location
0363 G.Tnasion = uicontrol('Parent',GUI,'Style','pushbutton','Units','Normalized', Font, ...
0364     'Position',[.575 .35 .20 .04], 'HorizontalAlignment', 'left',...
0365     'BackgroundColor', [.3 .3 .3],...
0366     'ForegroundColor', [1 1 1],...
0367     'BusyAction','queue',...
0368     'TooltipString','Update Nasion - should be toward +Y',...
0369     'String','Fiducial: Nasion',...
0370     'Callback',strcat('AVWVIEW = get(gcbf,''Userdata''); ',...
0371             'SagSlice = get(AVWVIEW.handles.Ssag,''Value'');',...
0372             'CorSlice = get(AVWVIEW.handles.Scor,''Value'');',...
0373             'AxiSlice = get(AVWVIEW.handles.Saxi,''Value'');',...
0374             'imgXYZ   = [SagSlice,CorSlice,AxiSlice]; ',...
0375             'imgXYZ = (imgXYZ - AVWVIEW.origin) .* AVWVIEW.scale; ',...
0376             'set(AVWVIEW.handles.nasion,''String'',sprintf(''%6.3f %6.3f %6.3f'',imgXYZ));',...
0377             'AVWVIEW.p.mriFID(1,:) = imgXYZ; ',...
0378             'set(AVWVIEW.gui,''UserData'',AVWVIEW);',...
0379             'clear imgXYZ AxiSlice CorSlice SagSlice AVWVIEW;'));
0380 G.nasion = uicontrol('Parent',GUI,'Style','text','Units','Normalized', Font, ...
0381     'Position',[.775 .35 .20 .04], 'HorizontalAlignment', 'right',...
0382     'BackgroundColor', [0 0 0],...
0383     'ForegroundColor', [1 1 1],...
0384     'BusyAction','queue',...
0385     'TooltipString','In meters, origin at (0,0,0), should be toward +Y',...
0386     'String','x,y,z');
0387 
0388 % Right Preauricular Location
0389 G.Trpa = uicontrol('Parent',GUI,'Style','pushbutton','Units','Normalized', Font, ...
0390     'Position',[.575 .30 .20 .04], 'HorizontalAlignment', 'left',...
0391     'BackgroundColor', [.3 .3 .3],...
0392     'ForegroundColor', [1 1 1],...
0393     'BusyAction','queue',...
0394     'TooltipString','Update Right Preauricular - should be toward +X',...
0395     'String','Fiducial: RPA',...
0396     'Callback',strcat('AVWVIEW = get(gcbf,''Userdata''); ',...
0397             'SagSlice = get(AVWVIEW.handles.Ssag,''Value'');',...
0398             'CorSlice = get(AVWVIEW.handles.Scor,''Value'');',...
0399             'AxiSlice = get(AVWVIEW.handles.Saxi,''Value'');',...
0400             'imgXYZ   = [SagSlice,CorSlice,AxiSlice]; ',...
0401             'imgXYZ = (imgXYZ - AVWVIEW.origin) .* AVWVIEW.scale; ',...
0402             'set(AVWVIEW.handles.rpa,''String'',sprintf(''%6.3f %6.3f %6.3f'',imgXYZ));',...
0403             'AVWVIEW.p.mriFID(2,:) = imgXYZ; ',...
0404             'set(AVWVIEW.gui,''UserData'',AVWVIEW);',...
0405             'clear imgXYZ AxiSlice CorSlice SagSlice AVWVIEW;'));
0406 G.rpa = uicontrol('Parent',GUI,'Style','text','Units','Normalized', Font, ...
0407     'Position',[.775 .30 .20 .04], 'HorizontalAlignment', 'right',...
0408     'BackgroundColor', [0 0 0],...
0409     'ForegroundColor', [1 1 1],...
0410     'BusyAction','queue',...
0411     'TooltipString','In meters, origin at (0,0,0), should be toward +X',...
0412     'String','x,y,z');
0413 
0414 % Left Preauricular Location
0415 G.Tlpa = uicontrol('Parent',GUI,'Style','pushbutton','Units','Normalized', Font, ...
0416     'Position',[.575 .25 .20 .04], 'HorizontalAlignment', 'left',...
0417     'BackgroundColor', [.3 .3 .3],...
0418     'ForegroundColor', [1 1 1],...
0419     'BusyAction','queue',...
0420     'TooltipString','Update Left Preauricular - should be toward -X',...
0421     'String','Fiducial: LPA',...
0422     'Callback',strcat('AVWVIEW = get(gcbf,''Userdata''); ',...
0423             'SagSlice = get(AVWVIEW.handles.Ssag,''Value'');',...
0424             'CorSlice = get(AVWVIEW.handles.Scor,''Value'');',...
0425             'AxiSlice = get(AVWVIEW.handles.Saxi,''Value'');',...
0426             'imgXYZ   = [SagSlice,CorSlice,AxiSlice]; ',...
0427             'imgXYZ = (imgXYZ - AVWVIEW.origin) .* AVWVIEW.scale; ',...
0428             'set(AVWVIEW.handles.lpa,''String'',sprintf(''%6.3f %6.3f %6.3f'',imgXYZ));',...
0429             'AVWVIEW.p.mriFID(3,:) = imgXYZ; ',...
0430             'set(AVWVIEW.gui,''UserData'',AVWVIEW);',...
0431             'clear imgXYZ AxiSlice CorSlice SagSlice AVWVIEW;'));
0432 G.lpa = uicontrol('Parent',GUI,'Style','text','Units','Normalized', Font, ...
0433     'Position',[.775 .25 .20 .04], 'HorizontalAlignment', 'right',...
0434     'BackgroundColor', [0 0 0],...
0435     'ForegroundColor', [1 1 1],...
0436     'BusyAction','queue',...
0437     'TooltipString','In meters, origin at (0,0,0), should be toward -X',...
0438     'String','x,y,z');
0439 
0440 
0441 
0442 
0443 
0444 
0445 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0446 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0447 
0448 Font.FontWeight = 'bold';
0449 
0450 % OK: Return the avw!
0451 G.Bhdr = uicontrol('Parent',GUI,'Style','pushbutton','Units','Normalized', Font, ...
0452     'Position',[.8 .01 .08 .04],...
0453     'String','HDR','BusyAction','queue',...
0454     'TooltipString','Save the hdr parameters.',...
0455     'BackgroundColor',[0.0 0.0 0.5],...
0456     'ForegroundColor',[1 1 1], 'HorizontalAlignment', 'center',...
0457     'Callback',strcat('AVWVIEW = get(gcbf,''Userdata''); ',...
0458         'avw_view_hdr(AVWVIEW.avw);',...
0459         'clear AVWVIEW;'));
0460 
0461 % Cancel
0462 G.Bquit = uicontrol('Parent',GUI,'Style','pushbutton','Units','Normalized', Font, ...
0463     'Position',[.9 .01 .08 .04],...
0464     'String','RETURN','BusyAction','queue',...
0465     'BackgroundColor',[0.75 0.0 0.0],...
0466     'ForegroundColor', [1 1 1], 'HorizontalAlignment', 'center',...
0467     'Callback',strcat('AVWVIEW = get(gcbf,''Userdata''); ',...
0468         'if isfield(AVWVIEW,''p''), ',...
0469         '  if isfield(AVWVIEW.p,''mriFID''), ',...
0470         '    if exist(''p'',''var''), ',...
0471         '      p.mriFID = AVWVIEW.p.mriFID; ',...
0472         '    else, ',...
0473         '      mriFID = AVWVIEW.p.mriFID;',...
0474         '    end; ',...
0475         '  end; ',...
0476         'end; ',...
0477         'clear AVWVIEW; close gcbf;'));
0478 
0479 % Update the gui_struct handles for this gui
0480 AVWVIEW.avw = avw;
0481 AVWVIEW.handles = G;
0482 set(AVWVIEW.gui,'Userdata',AVWVIEW);
0483 set(AVWVIEW.gui,'HandleVisibility','callback');
0484 
0485 return
0486 
0487 
0488 function slice_img(avw),
0489 
0490     figure
0491     xslice = 128;
0492     slice = squeeze( avw.img(xslice,:,:) );
0493     imagesc(slice); axis image; colormap('gray')
0494     figure
0495     yslice = 128;
0496     slice = squeeze( avw.img(:,yslice,:) );
0497     imagesc(slice); axis image; colormap('gray')
0498     figure
0499     zslice = 128;
0500     slice = squeeze( avw.img(:,:,zslice) );
0501     imagesc(slice); axis image; colormap('gray')
0502 
0503 return

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