Home > vbmeg > functions > tool_box > dynamics_movie > movie > movie_top_view_create.m

movie_top_view_create

PURPOSE ^

Create movie file. The view point is top side of cortex.

SYNOPSIS ^

function movie_top_view_create(fiber_tracking_file,current_file, movie_file, Timefrom, Tfreq)

DESCRIPTION ^

 Create movie file. The view point is top side of cortex.
    F
 L     R :  Front, Back, Left, Right
    B  

 [Input]
      fiber_tracking_file : [input file]  fiber tracking result file.
             current_file : [input file]  MAR dynamics file.
               movie_file : [output file] output movie file.(empty : no output)
                 Timefrom : [optional]    Time starts from (ms).
                    Tfreq : [optional]    time frequency(Hz) : default:1000


 [History]
    2014-11-10 Masa-aki Sato  Created as a test_ar_cylinder.m
    2015-12-07 rhayashi       Rename, fine-tuning and added all arguments.
    2017-12-12 Yusuke Takeda  Modified details

 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 movie_top_view_create(fiber_tracking_file, ...
0002     current_file, movie_file, Timefrom, Tfreq)
0003 % Create movie file. The view point is top side of cortex.
0004 %    F
0005 % L     R :  Front, Back, Left, Right
0006 %    B
0007 %
0008 % [Input]
0009 %      fiber_tracking_file : [input file]  fiber tracking result file.
0010 %             current_file : [input file]  MAR dynamics file.
0011 %               movie_file : [output file] output movie file.(empty : no output)
0012 %                 Timefrom : [optional]    Time starts from (ms).
0013 %                    Tfreq : [optional]    time frequency(Hz) : default:1000
0014 %
0015 %
0016 % [History]
0017 %    2014-11-10 Masa-aki Sato  Created as a test_ar_cylinder.m
0018 %    2015-12-07 rhayashi       Rename, fine-tuning and added all arguments.
0019 %    2017-12-12 Yusuke Takeda  Modified details
0020 %
0021 % Copyright (C) 2011, ATR All Rights Reserved.
0022 % License : New BSD License(see VBMEG_LICENSE.txt)
0023 
0024 %
0025 % --- Previous check
0026 %
0027 if exist(fiber_tracking_file, 'file') ~= 2
0028     error('fiber_tracking_file not found.');
0029 end
0030 if exist(current_file, 'file') ~= 2
0031     error('current_file not found.');
0032 end
0033 if ~exist('movie_file', 'var')
0034     movie_file = [];
0035 elseif ~isempty(movie_file)
0036     [p_, f_, e_] = fileparts(movie_file);
0037     if exist(p_, 'dir') ~= 7
0038         mkdir(p_);
0039     end
0040 end
0041 
0042 if ~exist('Timefrom', 'var')
0043     Timefrom = 0;     % [ms]
0044 end
0045 if ~exist('Tfreq', 'var')
0046     Tfreq = 1000; % [Hz]
0047 end
0048 
0049 %
0050 % --- Main Procedure
0051 %
0052 
0053 %------- Plot parameter
0054 plot_para.conn_file = fiber_tracking_file;
0055 plot_para.curr_file = current_file;
0056 
0057 %--- figure parameter
0058 plot_para.fig_unit = 'pixels';
0059 plot_para.fig_pos  = [200, 200, 768, 720];
0060 
0061 %--- brain surface
0062 plot_para.faceclr = [0.8 0.7 0.6];
0063 plot_para.faceclr0 = [1 1 1];% face color of brain
0064 plot_para.alpha = [0.1 0.1 0.01];% alpha value of brain
0065 
0066 %--- face surface
0067 plot_para.face_on    = 1; % =1:plot face
0068 plot_para.alpha_face = 0.5; % Initial alpha value of face
0069 plot_para.face_file  = which('Subject.face.mat');
0070 plot_para.zoom_factor= 1.3; % zoom factor when a face disappears
0071 
0072 %--- area surface
0073 plot_para.alpha_area = [0.8 0.08 0.01]; % alpha value of area
0074 plot_para.cbox = 0;                     % show area color update dialog
0075 
0076 %--- view angle
0077 plot_para.angle = [0 90];% initial view angle
0078 plot_para.dang = [0 0];% increment of view angle in one step
0079 plot_para.Ntime = 0;% number of times for rotation
0080 
0081 %--- ROI area surface
0082 plot_para.roi = 0; %=1: show ROI surface
0083 
0084 % Time length & speed
0085 plot_para.Tfreq   = Tfreq;
0086 plot_para.Timefrom= Timefrom;  % time (ms) starts from (for display)
0087 plot_para.Tstay   = 100; % time length (sample) for first non-rotate state
0088 plot_para.Tstop   = 600; % time point (sample) of stop rotation.
0089 
0090 %--- connection line
0091 plot_para.Nskip = 1;% skip number for connections selection
0092 plot_para.Nstep = 1;% skip number along path (neighbor distance= Nstep*0.2mm)
0093 %plot_para.Ndivide = 50;% number of division of connection line
0094 %plot_para.Nperiod = 100;% time window length
0095 
0096 %--- activity transition movie
0097 plot_para.pmove   = 1;%=1: show activity transition movie
0098 plot_para.pause1  = 0.01;% pause time(sec)
0099 plot_para.pause2  = 0.05;%           (sec)
0100 
0101 plot_para.dN    = 10;% number of cylinder points
0102 plot_para.dr    = 0.3;% radius of cylinder [mm]
0103 %plot_para.sigma = 0.1;% input noise sd
0104 plot_para.omega = 0.5;% oscillation speed of dynamics [no dynamics file case]
0105 
0106 plot_para.show_max = 1; % max value for caxis
0107 plot_para.abs_mode = 1;%=1: show absolute value of activity
0108 plot_para.max_norm = 1;%=1: normalize activity by max value for each vertex
0109 plot_para.wmulti  = 0; %=1: multiply MAR weight
0110 plot_para.vertex_show = 2;% =1: show vertex activity
0111 plot_para.Msize   = 10; % marker size
0112 plot_para.th_show = 0.8; % threshold to show vertex activity
0113 
0114 %--- message box for stop rotation
0115 plot_para.mbox = 0;
0116 plot_para.video = 0;
0117 if ~isempty(movie_file)
0118     plot_para.video = 1;
0119     plot_para.video_dir = p_;
0120 end
0121 
0122 % color map for connection line
0123 color_parm.Nlevel  = 64; % gradation color level
0124 color_parm.Nwidth  = 13; % active color region length
0125 color_parm.Ncycle  = 20; % cycle length
0126 color_parm.Nrepeat = 5;  % repeat number of active cycle
0127 color_parm.Nback   = 21;  % repeat number of background cycle
0128 color_parm.mode = 'gradation'; % color map mode ('gradation','jet','hot')
0129 
0130 %----- colormap for connection
0131 color_parm.active_color = 'white'; % color name for active state
0132 color_parm.rest_color   = 'navyblue';  % color name for rest state
0133 color_parm.back_color   = 'blue';      % color name for background
0134 
0135 %---> Set colormap
0136 %C1  = cmap_move(color_parm);
0137 C1 = cmap_move2(color_parm);
0138 %colorbar; colormap(C1);
0139 
0140 %----- colormap for vertex
0141 color_parm.active_color = 'yellow';      % color name for active state
0142 color_parm.rest_color   = 'orange';      % color name for rest state
0143 color_parm.back_color   = 'bottlegreen'; % color name for background
0144 %---> Set colormap
0145 C2 = cmap_move2(color_parm);
0146 
0147 %----- set colormap
0148 plot_para.cmap  = C1;
0149 plot_para.cmap2 = C2;
0150 
0151 %----- Load Connection data
0152 connection = load_connection_from_vmni_connect_file(plot_para.conn_file);
0153 
0154 %----- Create movie
0155 close all;
0156 [hfig, Q, id] = plot_cylinder_prepare(connection, plot_para);
0157 set(gca, 'Position', [0.1300    0.2300    0.7750    0.8150]);
0158 %    colorbar;
0159 plot_cylinder_anime(plot_para, hfig, Q, id);
0160 
0161 if plot_para.video
0162     [success, message] = movefile(fullfile(p_, 'cylinder.avi'), movie_file);
0163     if success
0164         disp(['top view: ' movie_file ' was created.']);
0165     else
0166         error(message);
0167     end
0168 end

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