Home > vbmeg > demo > tutorial_for_vbmeg2 > advanced > create_movie.m

create_movie

PURPOSE ^

Create movie showing signal flows

SYNOPSIS ^

function create_movie(p)

DESCRIPTION ^

 Create movie showing signal flows

 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 create_movie(p)
0002 % Create movie showing signal flows
0003 %
0004 % Copyright (C) 2011, ATR All Rights Reserved.
0005 % License : New BSD License(see VBMEG_LICENSE.txt)
0006 
0007 % Load samplilng rate
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 % Create movies
0013 time_of_first_sample = time(1)*1000; % Time of the first sample [ms]
0014 view_type = 'LT'; % Left/Top
0015 
0016 for ta=1:length(p.task_list)
0017     % Set input files
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     % Make directory to save movie
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     % Set output files - movie file (.avi)
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     % Create movies
0035     switch view_type
0036         case 'LB'     % Left/Bottom
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'     % Left/Top
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'     % Right/Bottom
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'     % Right/Top
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     % Combine movies
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

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