0001 function [handles] = vb_check_mni_coregistration(brain_file)
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025 if ~exist('brain_file', 'var')
0026 error('brain_file is required.');
0027 end
0028 if exist(brain_file, 'file') ~= 2
0029 error('Specified brain_file doesn''t exist.');
0030 end
0031
0032
0033
0034
0035 global vbmeg_inst;
0036 mni_template_file = vbmeg_inst.const.FILE_MNI_ICBM152_HDR;
0037 handles = [];
0038
0039
0040 [Vmni, F] = vb_load_cortex(brain_file, 'MNI');
0041 if isempty(Vmni)
0042 vb_disp(...
0043 'Specified Cortical model file doesn''t contain MNI coordinate value', ...
0044 'WARNING');
0045 return;
0046 end
0047
0048
0049 [B, Vdim, Vsize] = vb_load_analyze_to_right(mni_template_file);
0050
0051
0052 Vmni = Vmni * 1e3;
0053 Vspm = vb_mni_mm_to_spm_right(Vmni, mni_template_file);
0054
0055
0056 Vmni2 = vb_spm_right_to_analyze_right(Vspm, Vdim, Vsize);
0057
0058
0059
0060
0061
0062
0063 callback = ['parent = get(gcbo, ''Parent'');', ...
0064 'h_fig = figure;', ...
0065 'new_axes = copyobj(parent, h_fig);', ...
0066 'set(new_axes, ''Position'', [0,0,1,1]);', ...
0067 'h_line = findobj(get(new_axes, ''Children''), ''Type'',''line'');', ...
0068 'set(h_line, ''MarkerSize'', 5);', ...
0069 'set(get(new_axes, ''children''), ''ButtonDownFcn'', '''');'];
0070
0071 [x, y, z] = size(B);
0072
0073 Msize = 1;
0074 Mtype = 'y-';
0075 dz = 5;
0076 xymode = 0;
0077
0078 vb_disp('--- Plotting MNI coordinate value corresponding to a subject brain on MNI template image.');
0079 vb_disp_nonl('Now creating thumbnail of X direction...');
0080
0081 h1 = figure; set(h1, 'Color', 'k', 'NumberTitle', 'off');
0082 set(h1, 'Name', 'MNI value on MNI template image(YZ) - Click to open');
0083 for k=1:1:x
0084 sh = vb_subaxis(ceil(x/15),15,k,'SV', 0, 'SH', 0, 'ML', 0, 'MT', 0, 'MR', 0, 'MB', 0); axis off; hold on;
0085 [strX, strY] = vb_plot_3d_image(B, k, 'x', 0);
0086
0087 vb_plot_vertex(Vmni2, 'x', k, 5, 1, 'y.', 0);
0088 children = get(sh, 'Children');
0089 set(children, 'ButtonDownFcn', callback);
0090 end
0091 vb_disp('Done.');
0092
0093
0094 vb_disp_nonl('Now creating thumbnail of Y direction...');
0095 h2 = figure; set(h2, 'Color', 'k', 'NumberTitle', 'off');
0096 set(h2, 'Name', 'MNI value on MNI template image(XZ) - Click to open');
0097 for k=1:1:y
0098 sh = vb_subaxis(ceil(y/15),15,k,'SV', 0, 'SH', 0, 'ML', 0, 'MT', 0, 'MR', 0, 'MB', 0); axis off; hold on;
0099 [strX, strY] = vb_plot_3d_image(B, k, 'y', 0);
0100 vb_plot_vertex(Vmni2, 'y', k, 5, 1, 'y.', 0);
0101 children = get(sh, 'Children');
0102 set(children, 'ButtonDownFcn', callback);
0103 end
0104 vb_disp('Done.');
0105
0106
0107 vb_disp_nonl('Now creating thumbnail of Z direction...');
0108 h3 = figure; set(h3, 'Color', 'k', 'NumberTitle', 'off');
0109 set(h3, 'Name', 'MNI value on MNI template image(XY) - Click to open');
0110 for k=1:1:z
0111 sh = vb_subaxis(ceil(z/15),15,k,'SV', 0, 'SH', 0, 'ML', 0, 'MT', 0, 'MR', 0, 'MB', 0); axis off; hold on;
0112 [strX, strY] = vb_plot_3d_image(B, k, 'z', 0);
0113 vb_plot_vertex(Vmni2, 'z', k, 5, 1, 'y.', 0);
0114 children = get(sh, 'Children');
0115 set(children, 'ButtonDownFcn', callback);
0116 end
0117 vb_disp('Done.');
0118
0119 handles = [h1; h2; h3];
0120