Connectome dynamics movie

Connectome dynamics movie

This section explains a method to visualize estimated current sources and connectome dynamics as a movie.


We propose a new approach to map current source activities on connectome based on estimated current source and connectome dynamics. The linear connectome dynamics indicates current source of one node consists of local contribution (from own past), distant contribution (from other structurally connected nodes) and (unspecified) input. In this method, the distant contributions are plotted on connectome time-by-time after extracting distant contributions with large absolute values. It should be noted that this method (how to threshold, threshold value and statistics) is still under investigation.

Sample movie

Face stimulation movie(Please set the quality of the movie to 720p).

Left : Viewing the brain from the right.
Right: Viewing the brain from the downward(Upper side:Forehead, Left side:Right brain)

Tutorial (Linear connectome dynamics estimation)

To create movie from the result of connectome dynamics estimation (See Linear Connectome Dynamics estimation : Two-step method), the following three steps must be processed.

  1. Fiber tracking to obtain the shapes of the fibers.
  2. Create movie file(.avi)

We will explain step-by-step.

Preparing files

Prepare the following data according to the following folder structure.

  • data
    • brain/
      • Subject.brain.mat (VBMEG Cortical model file)
    • dmri/ (Directory obtained by Diffusion MRI analysis)
      • connectivity/
        • connectivity.dmri.mat (VBMEG Diffusion MRI file)
    • dynamics/
      • input_for_movie/
        • a.mat (current for movie)
    • freesurfer/
      • Subject (FreeSurfer Subject directory)

The folder structure and the file name may be changed as necessary. In that case, it is necessary to change all file names of the following process. In this tutorial, we create a working directory called dynamics_movie under the Linux home and use it as an output directory, so please create it as follows.

>> mkdir ~/dynamics_movie

Fiber tracking to obtain the shapes of the fibers

  1. Start MATLAB and add VBMEG path to your MATLAB.

    >> cd $VBMEG

    >> vbmeg;

  2. Open the fiber tracking script for movie creation and set ~/dynamics_movie to output_dir.

    >> edit tutorial_fiber_tracking_for_movie_for_LCD.m


    root = 'data';

    % Load current and linear connectome dynamics model
    load(movie_current_file, 'Z', 'B');


    % Output directory(filename is fixed : Vmni_connect.mat)
    output_dir = '~/dynamics_movie/';

    dmri_fiber_track_prob_specific_pair(parcel_dir, parcel_from_list, parcel_to_list, ...
                   mif_file, mask_file, ...
                   fa_gz_file, fs_brain_gz_file, trans_info_dir, dmri_file, ...
                   output_dir, process_host, Nworker);

  3. Save and run the script.


~/dynamics_movie/Vmni_connect.mat will be created in about several hours(It depends on the number of hosts).

Movie creation

  1. Open tutorial_movie_create and set fiber_tracking_file and output_dir.

    >> edit tutorial_movie_create.m

    % Input files

    fiber_tacking_file = '~/dynamics_movie/Vmni_connect.mat';
    movie_current_file = 'current_for_movie/a.mat';

    % Output files - movie file(.avi)
    output_dir = '~/dynamics_movie';
    movie_right_file = fullfile(output_dir, '/right_view.avi');
    movie_left_file = fullfile(output_dir, '/left_view.avi');
    movie_bottom_file = fullfile(output_dir, '/bottom_view.avi');
    movie_top_file = fullfile(output_dir, '/top_view.avi');
    movie_file = fullfile(output_dir, '/movie.avi');

  2. Save and run the script.

    >> tutorial_movie_create

    right view: ~/dynamics_movie/data/movie/right_view.avi was created.
    bottom view: ~/dynamics_movie/data/movie/bottom_view.avi was created.
    avi file(right view) : ~/dynamics_movie/data/movie/right_view.avi
    avi file(bottom view): ~/dynamics_movie/data/movie/bottom_view.avi
    Started to play video.
    saving video...
    avi file(combined): ~/dynamics_movie/data/movie/movie.avi

    AVI files are output to ~/dynamics_movie/movie.avi.

Tutorial(Fukushima's dynamics estimation)

ここではVBMEGのツールを用いて DiffusionMRI解析とダイナミクス推定の結果(.dbayes.mat)が用意されている時に、その結果を動画化する工程を説明します。



  • /home/cbi/rhayashi/temp/dynamics_movie/data
    • dynamics_estimation/
      • estimation_result.dbayes.mat (ダイナミクス推定結果)
    • dmri/ (Diffusion MRI解析により得られるディレクトリ)
      • connectivity/
        • connectivity.dmri.mat (解剖学的結合)
      • vbmeg/
        • Subject.brain.mat (皮質モデル)



>> mkdir ~/dynamics_movie



  1. MATLABを起動します

    >> /home/cns/matlab/r2013a/bin/matlab

  2. VBMEGにパスを通します

    >> cd $VBMEG

    >> vbmeg;

  3. 動画用ファイバートラッキングスクリプトを開き、output_dirに~/dynamics_movieを指定します

    >> edit tutorial_fiber_tracking_for_movie_for_dbayes.m


    root = '/home/cbi/rhayashi/temp/dynamics_movie/data';

    % Load current & MAR matrix
    output_dir    = '~/dynamics_movie';
    dmri_fiber_track_prob_specific_pair(parcel_dir, parcel_from_list, parcel_to_list, ...

                   mif_file, mask_file, ...
                   fa_gz_file, fs_brain_gz_file, trans_info_dir, dmri_file, ...
                   output_dir, process_host, Nworker);

  4. スクリプトを実行します




  1. チュートリアル関数を開き、dmri_file, output_dirを設定します。estimation_fileにはダイナミクス推定結果ファイル(.dbayes.mat)を指定します

    >> edit tutorial_current_file_create_for_dbayes

    % Input files

    input_dir = '/home/cbi/rhayashi/temp/dynamics_movie/data';
    dmri_file = fullfile(input_dir, 'dmri/connectivity/connectivity.dmri.mat');
    estimation_file = fullfile(input_dir, 'dynamics_estimation/estimation_result.dbayes.mat');

    % output files
    output_dir = '~/dynamics_movie';
    current_file = fullfile(output_dir, '/current.mat');
    predict_param_make_from_dbayes_file(estimation_file, dmri_file, current_file);

  2. スクリプトを実行します

    >> tutorial_current_file_create_for_dbayes



Linear connectome dynamics toolboxと同じです。


  • 動画に表示される時間情報の設定の仕方は?
    • tutorial_movie_create.m 内の変数 Timefromに表示を開始する時間を指定します(-100と書けば、-100msecから始まります)。Tfreqには、電流時系列のサンプリング周波数を指定して下さい。