Home > vbmeg > functions > plotfunc > check_model > vb_check_mni_coregistration.m

vb_check_mni_coregistration

PURPOSE ^

Check tool for MNI coordinate value corresponding to personal brain.

SYNOPSIS ^

function [handles] = vb_check_mni_coregistration(brain_file)

DESCRIPTION ^

 Check tool for MNI coordinate value corresponding to personal brain.
 Three thumbnail figures will be created(X,Y,Z direction) and
 MNI coordinate value corresponding to personal brain are plotted 
 on slices of ICBM152 MRI.
 [Usage]
   vb_check_mni_coregistration(brain_file);
 [Input]
    brain_file : Cortical model file(.brain.mat).
 [Output]
       handles : figure handles.
 [Note]
   currently, vb_plot_cross_section is not used in this function
   because it takes much time to create figure.
 [History]
   2013-01-24 rhayashi Initial version.

 Copyright (C) 2011, ATR All Rights Reserved.
 License : New BSD License(see VBMEG_LICENSE.txt)

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [handles] = vb_check_mni_coregistration(brain_file)
0002 % Check tool for MNI coordinate value corresponding to personal brain.
0003 % Three thumbnail figures will be created(X,Y,Z direction) and
0004 % MNI coordinate value corresponding to personal brain are plotted
0005 % on slices of ICBM152 MRI.
0006 % [Usage]
0007 %   vb_check_mni_coregistration(brain_file);
0008 % [Input]
0009 %    brain_file : Cortical model file(.brain.mat).
0010 % [Output]
0011 %       handles : figure handles.
0012 % [Note]
0013 %   currently, vb_plot_cross_section is not used in this function
0014 %   because it takes much time to create figure.
0015 % [History]
0016 %   2013-01-24 rhayashi Initial version.
0017 %
0018 % Copyright (C) 2011, ATR All Rights Reserved.
0019 % License : New BSD License(see VBMEG_LICENSE.txt)
0020 
0021 
0022 %
0023 % --- Previous check
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 % --- Main Procedure
0034 %
0035 global vbmeg_inst;
0036 mni_template_file = vbmeg_inst.const.FILE_MNI_ICBM152_HDR;
0037 handles = [];
0038 
0039 % Load MNI coordinate value
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 % MNI template file
0049 [B, Vdim, Vsize] = vb_load_analyze_to_right(mni_template_file);
0050 
0051 % Convert MNI->SPM
0052 Vmni = Vmni * 1e3; % m -> mm
0053 Vspm = vb_mni_mm_to_spm_right(Vmni, mni_template_file);
0054 
0055 % Convert SPM->RAS voxel
0056 Vmni2 = vb_spm_right_to_analyze_right(Vspm, Vdim, Vsize);
0057 
0058 %
0059 % --- Create Thumbnails
0060 %
0061 
0062 % Callback for click on thumbnail.
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 % plot parameters
0073 Msize   = 1;            % marker size
0074 Mtype   = 'y-';         % marker type
0075 dz      = 5;            % search radius for intersection triangle
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 % Xslice
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 %    vb_plot_cross_section(Vmni2, F.F3, k, 'x', dz, Msize, Mtype, xymode);
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 % Yslice
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 % Zslice
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

Generated on Mon 22-May-2023 06:53:56 by m2html © 2005