0001 function create_movie(p)
0002
0003
0004
0005
0006
0007
0008 ta = 1;
0009 input_file = fullfile(p.proj_root, p.dynamics_dirname, p.input_for_movie_dirname, [p.task_list{ta} '.mat']);
0010 load(input_file, 'sampling_rate', 'time')
0011
0012
0013 time_of_first_sample = time(1)*1000;
0014 view_type = 'LT';
0015
0016 for ta=1:length(p.task_list)
0017
0018 input_file = fullfile(p.proj_root, p.dynamics_dirname, p.input_for_movie_dirname, [p.task_list{ta} '.mat']);
0019 fiber_tracking_file = fullfile(p.proj_root, p.dynamics_dirname, p.fiber_track_dirname, p.task_list{ta}, 'Vmni_connect.mat');
0020
0021
0022 save_dir = fullfile(p.proj_root, p.dynamics_dirname, p.movie_dirname, p.task_list{ta});
0023 if ~exist(save_dir, 'dir')
0024 mkdir(save_dir)
0025 end
0026
0027
0028 movie_right_file = fullfile(save_dir, 'right_view.avi');
0029 movie_left_file = fullfile(save_dir, 'left_view.avi');
0030 movie_bottom_file = fullfile(save_dir, 'bottom_view.avi');
0031 movie_top_file = fullfile(save_dir, 'top_view.avi');
0032 movie_file = fullfile(save_dir, 'movie.avi');
0033
0034
0035 switch view_type
0036 case 'LB'
0037 movie_left_view_create(fiber_tracking_file, input_file, movie_left_file, time_of_first_sample, sampling_rate);
0038 movie_bottom_view_create(fiber_tracking_file, input_file, movie_bottom_file, time_of_first_sample, sampling_rate);
0039 left_side_file = movie_left_file;
0040 right_side_file = movie_bottom_file;
0041 left_is_left = false;
0042 case 'LT'
0043 movie_left_view_create(fiber_tracking_file, input_file, movie_left_file, time_of_first_sample, sampling_rate);
0044 movie_top_view_create(fiber_tracking_file, input_file, movie_top_file, time_of_first_sample, sampling_rate);
0045 left_side_file = movie_left_file;
0046 right_side_file = movie_top_file;
0047 left_is_left = true;
0048 case 'RB'
0049 movie_right_view_create(fiber_tracking_file, input_file, movie_right_file, time_of_first_sample, sampling_rate);
0050 movie_bottom_view_create(fiber_tracking_file, input_file, movie_bottom_file, time_of_first_sample, sampling_rate);
0051 left_side_file = movie_right_file;
0052 right_side_file = movie_bottom_file;
0053 left_is_left = false;
0054 case 'RT'
0055 movie_right_view_create(fiber_tracking_file, input_file, movie_right_file, time_of_first_sample, sampling_rate);
0056 movie_top_view_create(fiber_tracking_file, input_file, movie_top_file, time_of_first_sample, sampling_rate);
0057 left_side_file = movie_right_file;
0058 right_side_file = movie_top_file;
0059 left_is_left = true;
0060 otherwise
0061 error('Unknown view type is specified.');
0062 end
0063
0064
0065 title_str = p.task_list{ta};
0066 movie_combine(left_side_file, right_side_file, movie_file, title_str, left_is_left);
0067 end