心理のためのMatlabチュートリアル (SPMユーザに役立つMatlab入門)

SPMを使う方々は必ずMatlabを使いますが、世の中のMatlab入門をうたった書籍は、たいていが工学向けで、SPMを使う人がこれを知っておいたらいいというようなMatlab入門はあまりありません。何かいい手引きがないかと探していたら、Antonia Hamilton女史の書いたMatlab for Psychologists: A Tutorialという手引きを見つけました。ざっと見たところ非常によい手引きと感じたので、Hamilton女史に連絡をとり、日本語訳の許可をいただきました。日本語訳ができましたので、公開します。「心理のため」となっていますが、SPMを使う方々には、とても有用だと思います。
 なお、翻訳にあたり、山口大学の松尾幸治先生に多くのアドバイスをいただきました。この場をお借りして深謝いたします。

心理のためのMatlabチュートリアルをダウンロード

チュートリアルで用いるデータは下からダウンロードしてください。
練習用データ

SPM switcher: Run different versions of SPM in one Matlab

I used to write an article, “Run SPM2, SPM5, and SPM8 concurrently.” Though this is a smart way to run different version of SPM, we need to prepare scripts separately. So I came up with another script, called “SPM switcher”. This script brings up a dialog and you can select the version of SPM you want to run.

  • Make a directory where you want to save scripts. (e.g. C:\Users\foo\Documents\MATLAB\)
  • Add the directory to the path in Matlab. (File -> Set Path -> Add path)
  • put spm_rmpath.m in SPM2 and SPM99 directory.
  • You find this file in SPM5 or SPM8 directory. You can just copy it from SPM5/8 to SPM2/99 directory.

  • save switchspm.m in the directory you prepared.
  • edit switchspm.m and change “spm_path=’C:\spm\'” according to your circumstance.

Typing switchspm in Matlab command window will bring up a dialog below and you can run different version of SPM easily.

switchspm_screenshot

Download switchspm.m (Right click –> Save as)

%switchspm: Run different version of SPM
%This tiny script prompts the dialog which SPM version you want to run.
%Prerequisites
%1. Each version of SPM is supporsed to be located under spm_path.
%2. Please copy spm_rmpath.m from SPM5 or later and put it into SPM99 and
%   SPM2 direcotry. Otherwise, Path removal won't work correctly.
%3. Please change the SPM path according to your environment

%%%Please change the path below according to your environment%%%
spm_path='C:\spm\';
%%%

%The path for each version of SPM
spm99_path=fullfile(spm_path,'spm99');
spm2_path=fullfile(spm_path,'spm2');
spm5_path=fullfile(spm_path,'spm5');
spm8_path=fullfile(spm_path,'spm8');
spm12_path=fullfile(spm_path,'spm12');

str = ['spm99 '; 'spm2  '; 'spm5  '; 'spm8  '; 'spm12'];
spmver = listdlg('PromptString','SPM ver you want to run...',...
                'SelectionMode','single',...
                'ListString',str);

switch spmver
    case 1, %spm99
    % remove spm path
    while true
      try
        spm_rmpath
        catch break;
      end;
    end;
    % add spm99 path
    addpath(spm99_path);
    % run spm99
    spm;
        
    case 2, %spm2
    % remove spm path
    while true
      try
        spm_rmpath
        catch break;
      end;
    end;
    % add spm2 path
    addpath(spm2_path);
    % run spm2
    spm;

    case 3, %spm5
    % remove spm path
    while true
      try
        spm_rmpath
        catch break;
      end;
    end;
    % add spm5 path
    addpath(spm5_path);
    % run spm5
    spm;
        
    case 4 %spm8
    % remove spm path
    while true
      try
        spm_rmpath;
        catch break;
      end;
    end;
    % add spm8 path
    addpath(spm8_path);
    % run spm8
    spm;

    case 5 %spm12
    % remove spm path
    while true
      try
        spm_rmpath;
        catch break;
      end;
    end;
    % add spm12 path
    addpath(spm12_path);
    % run spm12
    spm;
end

SPM5およびSPM8でAC-PCを自動で設定できるスクリプト

この記事は、http://www.nemotos.net/?p=17で紹介したものを日本語に訳しただけのものです。

2008年10月18日に、Carlton Chu氏がSPMのメーリングリストに便利なスクリプトを投稿しました。
メーリングリストでは特に反応はなかったのですが、非常に有用だと思いますので、本ブログで紹介させていただきます。

このスクリプトの目的はいたってシンプルです:AC-PCを自動的にあわせてくれます!

若干時間がかかります(1例に数分かかります)が、何百例もAC-PCをあわせなくてはいけないような状況では、大きな時間の節約になります。
もし関心があったら、次のスクリプトを試してみて下さい。SPM5、SPM8でうまく動きます。

オリジナルの投稿では、若干動作しないバグがありました。そこを修正してあります。

使用方法:添付のファイルをダウンロードし、SPM5かSPM8に置いてください。その後、MATLABのコマンドウィンドウから、”auto_reorient”とタイプしてください。ファイル選択のウィンドウが立ち上がりますので、AC-PCを設定したいファイルを選択して下さい(複数選択できます)。

function auto_reorient(p)
spmDir=which('spm');
spmDir=spmDir(1:end-5);
tmpl=[spmDir 'canonical/avg152T1.nii'];
vg=spm_vol(tmpl);
flags.regtype='rigid';
p=spm_select(inf,'image');
for i=1:size(p,1)
f=strtrim(p(i,:));
spm_smooth(f,'temp.nii',[12 12 12]);
vf=spm_vol('temp.nii');
[M,scal] = spm_affreg(vg,vf,flags);
M3=M(1:3,1:3);
[u s v]=svd(M3);
M3=u*v';
M(1:3,1:3)=M3;
N=nifti(f);
N.mat=M*N.mat;
create(N);
end

auto_reorient.m

FSLのMacOSへのインストール方法(FSL 6.0.5以前)

*これは相当古いインストラクションです。新たなインストラクションを別に準備しますので、FSL 6.0.6 以降のインストール方法はそちらをご参照ください。

Mac OSXにFSLをインストールする機会がありました。
いくつか工夫が必要だったので、メモします。

(9/Dec/2014: fslinstaller.pyはスーパーユーザーでなくても大丈夫と気づいたので、修正しました。また、Yosemiteの場合についても追記しました。)
(1/Mar/2014: .bash_profileがない場合の対処を追記しました。また、改行コードについての注意も記載しました)

続きを読む

SPMをオンラインでアップデートする方法

SPMは定期的にアップデートされています。spm_updateというコマンドをうつと、自分のSPMのバージョンが最新かどうかチェックできます。

>> spm_update
A new version of SPM is available on:
ftp://ftp.fil.ion.ucl.ac.uk/spm/spm8_updates/
(Your version: 4290 - New version: 4667)

これまで、FTPでアップデートをとってきていましたが、ある方に、spm_update(1)とやると、自動で最新ファイルを入手してくれるよと教わりました。

自分が使っているSPMがちょうどアップデートが必要だったのでやってみました。

>> spm_update(1)
A new version of SPM is available on:
ftp://ftp.fil.ion.ucl.ac.uk/spm/spm8_updates/
(Your version: 4290 - New version: 4667)
2781 files have been updated.

確かにアップデートされます。便利ですね。

New Lin4Neuro based on Xubuntu 12.04

I am pleased to announce the new release of Lin4Neuro based on Xubuntu 12.04LTS.
Only 64-bit version is released this time, but I’m working on 32-bit version so hopefully I will be able to release the 32-bit version in the near future.

I chose Xubuntu 12.04 as a base of Lin4Neuro simply because I don’t like Unity. If you look at the screenshot of new Lin4Neuro, you can tell that I made UI as simple as I could.

At the same time, I keep working on Lin4Neuro based on Ubuntu 10.04LTS, because FSLView doesn’t work on Ubuntu 12.04… I know some of users like to use FSLView, so I keep working on it.

Other than FSLView, there are some differences between versions.

  • New Lin4Neuro (L4N12.04) includes DSI studio in response to a request by Renaud Nicolas.
  • L4N12.04 doesn’t includ N3 tools. I haven’t been able to install the software yet.

So Now you have three options. From now on I will name the each version as following (I do not change the file name of old versions);

You can download each version from http://www.nemotos.net/lin4neuro/

Hope Lin4Neuro will help you enjoy playing with your images.

VBMの結果を用いて容積を測定する方法

VBMで得られる画像を用いて、灰白質や白質画像の容積を求めることができます。

事前の準備として、以下のことが必要です。

  • get_totals.m
  • Ged Ridgwayが公開している容積算出のためのスクリプトです。http://www0.cs.ucl.ac.uk/staff/g.ridgway/vbm/get_totals.mここから入手できます(右クリックしてリンク先を保存としてください)。これをSPMのディレクトリに保存します。

  • WFU PickAtlas
  • これは、局所容積を求めたい時に便利です。マスク画像を簡単に作成することができます。http://fmri.wfubmc.edu/software/PickAtlasここから入手できます。今回はこのセットアップ方法は説明しませんのであしからず。

続きを読む

How to do Topological FDR

Many ask “how to do Topological FDR” in SPM ML. Below are the posts I found useful.

Originally Guillaume Flandin showed how to do that.
https://www.jiscmail.ac.uk/cgi-bin/webadmin?A2=SPM;44838216.0904

The height threshold you define during the Results procedure is the feature-inducing threshold (used to define local maxima and clusters).
For topological FDR, I would typically choose “none” and a small T-value, for example 3.
The MIP will display all voxels whose T-value is above 3 and the Results table will display all local maxima whose T-value is above 3 (actually, at most 3 local maxima per cluster, more than 8mm apart) and the corresponding FWE p-values and FDR q-values for peaks and clusters.

If you want to threshold the MIP to a particular significance level, go through the Results procedure again and enter the corresponding height and extent thresholds (the 0.05 critical thresholds are indicated at the bottom left of the Results table):
(height) FWEp and FDRp for peak-FWE and -FDR.
(extent) FWEc amd FDRc for cluster-FWE and -FDR.

Jonathan Peele also gave a detail instruction of how to do that. This time he focused more on cluster-thresholded FDR.
https://www.jiscmail.ac.uk/cgi-bin/webadmin?A2=SPM;6f4e0139.1110

> How can I see images with a threshold at the cluster-level instead of the peak level with the graphical user interface?

I’m not aware of a way to set a cluster-level threshold when running results the first time (i.e., “show everything that is cluster-level corrected p < .05").  What I would do is this: 1) Run results using some voxelwise threshold.  This threshold defines your clusters, and it's fine to use an uncorrected threshold (e.g., p< .001, uncorrected). 2) In the results table, for each cluster you will see the cluster extent (i.e. how many voxels) and the cluster-corrected p value.  In SPM8 you will see 2 cluster-corrected p values, one for topological FDR (Chumbley & Friston, 2009), one for random field theory (labeled FWE).  You can then look at the size of those clusters, and figure out the cluster extent  that divides p < .05 from the others.  For example, if a cluster of 300 voxels is p = .10, and a cluster of 400 voxels is p = .04, then you know that any cluster 400 voxels or larger would be p < .05. 3) Re-run the results, selecting the same voxelwise threshold. But now, in the minimum cluster extent, specify the cluster size you just figured out—in the above example, you could specify 400.

4) Now all of the displayed results should be cluster-level corrected.

5) If you want to save this thresholded image for displaying with another program, just click the “save” button, and you can write out a thresholded t map as a nifti file.

In practice this is actually fairly quick to do once you’ve done it a couple of times.

Note the difference between these two. Two-step approach is the same, but Guillaume’s way deals with peak and cluster threshold and Jonathan’s way deals with cluster threshold.

Voxel-wise FDR and Topological FDR

In SPM8, voxel-wise FDR was hidden and Topological FDR was introduced. What is Topological FDR? I find some useful notes from SPM8 Release Notes and a post by Tom Nichols to SPM-ML. I quote these two.

SPM8 Release Notes

Topological False Discovery Rate (FDR)

FDR control is an alternative to the more conservative “family-wise error” control for multiple comparisons. Historically, SPM has aimed to control FDR on voxels (the
expected fraction of false-positive/total-positive decisions made about individual voxels in an image). This is now superseded by FDR control of topological properties of the signal (i.e. control of properties that pertain to the spatial organization of activations – e.g. height and extent – and are not reducible to individual voxels). SPM is now able to identify significantly voluminous blobs according to a decision procedure that controls spatial-extent FDR. Thus, on average, the fraction of blobs falsely deemed to have significant spatial extent is controlled beneath say 5/100 = .05 or 1/100 = .01. More recent work is examining FDR control over local maxima.

A post to SPM-ML by Tom Nichols

In SPM8 FDR topological inference was introduced, and voxel-wise FDR inference hidden. Topological inference means inference on peaks and clusters; voxel-wise inference is based on every individual voxel in the image (instead of spatial features of the image). Thus “Topological FDR” means inference on clusters based on cluster size (or local peaks based on peak height), controlling the fraction of false positive clusters among all clusters (or false positive peaks among all peaks) on average, over many experiments.

While topological FDR results may be easier to interpret, in my experience it is is generally not very sensitivity and yields similar results to FWE-corrected inferences.

If you would like to use voxel-wise FDR in SPM8, edit spm_defaults, changing “topoFDR” line to read
defaults.stats.topoFDR = 0;
(quit and re-start SPM to take effect).

References
Chumbley, J., Worsley, K., Flandin, G., & Friston, K. (2010). Topological FDR for neuroimaging. NeuroImage, 49(4), 3057-64. doi: 10.1016/j.neuroimage.2009.10.090.

Chumbley, J. R., & Friston, K. J. (2009). False discovery rate revisited: FDR and topological inference using Gaussian random fields. Neuroimage, 44(1), 62–70. doi: 10.1016/j.neuroimage.2008.05.021.

Files generated in VBM statistics

When you do VBM analysis, you see many files are generated in your stats directory. Suppose you are doing a two sample t-test. You see files like below.

  • beta_0001
  • beta_0002
  • con_0001
  • mask
  • ResMS
  • RPV
  • spmT_001

Ged Ridgway made a clear explanation of these files in NITRC discussion forum. http://www.nitrc.org/forum/message.php?msg_id=6483
It is important to know what these files are, so I quote his post with some modification.

  • beta
  • The estimated linear model parameters at each voxel. In a two-sample design, these are just the two group mean images. beta_0001 is a mean image of group A, and beta_0002 is a mean image of group B.

  • con
  • The contrasts of the parameters. If one makes a contrast of [-1 1], the con_0001 will simply be beta_0002 – beta_0001

  • mask
  • A binary image indicating which voxels were considered in the analysis. If this mask is too small, you may miss the region you are interested in. If too big, it is less likely to survive multiple comparison. So it is worth checking the mask image before you draw some conclusion from your analysis.

  • ResMS
  • The estimated variance (residual mean squares), from which the above-mentioned standard error is derived.
    In more detail, the standard error is proportional to the square root of ResMS and a term that relates to the design matrix X and contrast c as sqrt(c’*pinv(X’*X)*c), which (in two sample t-test) roughly reflects the fact that the standard error is inversely proportional to the number of subjects one has.

  • RPV
  • The resels-per-voxel image related to the smoothness (roughness)
    estimate needed for random field theory.

  • spmT
  • The t-statistic maps formed by dividing the contrast image by its estimated standard error.

Neurodebianのミラーサイト

このブログでも今までに紹介し、そしてLin4Neuroでも採用させていただいてきたNeurodebianですが、開発者のYarsolav Halchenkoといろいろやりとりした結果、日本でミラーサイトを立ち上げました。最近はファイルサイズの大きなものもありますので、日本からの場合、このミラーサイトを使っていただいたら、ダウンロード時間を短縮できる可能性があります。

方法を簡単に説明します。

まず、http://neuro.debian.netにいきます。

トップページにある、”How to use this repository”を見ます。

そこに、下図にあるような感じでDebianかUbuntuのリリースとダウンロードサイトを選ぶドロップダウンメニューが出てきます。

そこに出てくる2行を端末にコピペします。Ubuntu 12.04の場合は以下の2行になります。

wget -O- http://neuro.debian.net/lists/precise.jp | sudo tee etc/apt/sources.list.d/neurodebian.sources.list
sudo apt-key adv --recv-keys --keyserver pgp.mit.edu 2649A5A9

その後、apt-get updateと、apt-get upgradeを行い、さらにapt-get installで必要なソフトをインストールします。

それだけで設定はおしまいです。便利ですよね。

いろいろな画像解析関連ソフトが簡単にいれられますので、どうぞ利用してみてください。
日本語版Lin4Neuroでもこの日本のミラーサイトがデフォルトになっています。

How to install FSL on Ubuntu (up to 5.0.9)

N.B.: This is the old post. If you want to install the latest FSL (5.0.10 and later), you need to use fslinstaller.py.

If you use Debian or Ubuntu, you can install FSL easily using neurodebian repository.
Below is what you need to install FSL.

  1. Add the neurodebian repository
  2. Follow the guideline described here.

  3. update the sources.list
  4.         $ sudo apt-get update
            
  5. install FSL (and related packages)
  6.         $ sudo apt-get install fsl fsl-doc fslview fslview-doc fsl-atlases fsl-possum-data fsl-first-data fsl-feeds dicomnifti libvtk5-dev vtk-examples vtk-doc
            
  7. Add the following line to .bashrc
  8. This is the thing people often forget. Without this, you can’t run fsl from shell.

             . /etc/fsl/fsl.sh
             

    That’s it.

Voxel-counting script

Sometimes we just want to count the number of voxels whose values are more than zero.
My friend showed me a script which can do that easily. SPM functions are used, so you need to install SPM first.

%%%%%countvx.m
%a script which counts voxels whose values are more than zero.
file = spm_select;
vol = spm_vol(file);
img = spm_read_vols(vol);
sum(img(:)>0)

If you change the value of the last line from 0 to 0.1, you will count the number of voxels whose values are more than 0.1.

共変量⊂Covariateではあるが、共変量=Covariateではない

SPMを使っていると、Covariateという単語がよく出てきます。
Covariateを日本語に訳すと、「共変量」となりますが、SPMでのCovariateはもうちょっと広い気がしていました。
Matthew BrettのIntroduction to SPM statisticsを翻訳したものに対し、他の先生方からご指摘をいただき、改めて検討してみました。

Wikipedia英語版では、covariateについて以下のように説明されています。

In statistics, a covariate is a variable that is possibly predictive of the outcome under study. A covariate may be of direct interest or it may be a confounding or interacting variable.

ここで、covariateは結果を予測する変数であり、直接関心のある変数のこともあれば、そうでないこともあると書かれています。日本語の「共変量」の意味するところは、後者のことだけを指しますので、英語のcovariateの方が広義ということになります。

Wikipediaに戻ります。

The alternative terms explanatory variable , independent variable , or predictor, are used in a regression analysis . In econometrics , the term “control variable” is usually used instead of “covariate”.

上記で述べたように、covariateは説明変数、独立変数、予測因子とも表現されると書かれています。

さらに、以下のようにも述べられています。

In a more specific usage, a covariate is a secondary variable that can affect the relationship between the dependent variable and other independent variables of primary interest.

ここで、「より狭義の意味では、covariateは従属変数と最も関心のある独立変数との関係に影響を与える二次的な変数である」となっています。これがまさに日本語に訳されるところの「共変量」ということになります。

つまり、covariateには、広義のcovariateと狭義のcovariateがあり、狭義のcovariateは日本語で言うところの共変量を指し、広義のcovariateは、回帰分析における説明変数のような変数も入ってくるわけです。

ということで、タイトルになるわけですが、SPMにおいては、共変量⊂Covariateではあるが、共変量=Covariateではないということに注意が必要です。
説明をするときには気をつける必要がありますね。

Freesurferのインストール Step by Step

注意:このポストは古いものです。より、新しいガイドは下記から見れます。
以下をご参照ください。

http://www.nemotos.net/?p=1012

以前、Freesurferのインストールを手伝ったことがあったのですが、そのときの文章が出てきたので、以下に記載しておきます。
ちなみに英語でのFreesurferをLinuxにインストールするときの具体的な方法は、
http://surfer.nmr.mgh.harvard.edu/fswiki/LinuxInstall
に書いてあります。以下は英語を読むのがつらい方のためとでもとっておいてください。

まず、ルートになります。

その後、ダウンロードしてきたファイルを/usr/localにうつします。
安全のためにコピーすることにしましょうか。
落としてきたディレクトリから、以下のコマンドをうってください。

# cp freesurfer-Linux-xxxxx-full.tar.gz /usr/local

となりますね。xxxxは落としてきたバージョンによって変わります。まぁ、基本的に
補完機能を使って、freeまでタイプして後はTabを押せば終わりですけどね。
そしたら、次に/usr/localに移ります。

# cd /usr/local/

そこで、ファイルを解凍します。

# tar -xvf freesurfer-Linux-xxxxx-full.tar.gz

これで、ディレクトリ構造を保ったまま解凍してくれます。
この後、FREESURFER_HOMEは、常に/usr/local/freesurfer
となります。
その後、ライセンスファイルを作成する必要があります。
ダウンロードする前にRegistrationをしますが、登録時のメールアドレスにメールが送られてきます。
その内容をコピーします。
Freesurferのホームディレクトリに移動します。
(とりあえず絶対パスを書いておきます。)

# cd /usr/local/freesurfer

GNOME環境で、初心者ならば、geditなんてエディタがとっかかりやすいかもしれません。

# gedit .license

そうすると、GUI環境でのエディタが立上りますので、そこにメールの内容をコピーして保存します。
これでライセンスファイルが作成されます。
ここまでできたらルートを抜けてください。

# exit

その後、ホームディレクトリに戻ってください。

$ cd

linuxはcd
とだけ打つと勝手にホームに戻ってきてくれます。僕はこれが好きですね。
その後、今度はシェルが立ち上がったときに常にfreesurferが動く設定にします。
今のLinuxのベースのシェルはたいていbashだと思います。freesurferのページにはtcshがいいと書いてありますが、別にbashで問題ないと思いますし、現に私はbashで使用しています。
エディタで.bashrcを立ち上げます。

$ gedit .bashrc

このファイルの文末に以下の2行をコピペしてください。

export FREESURFER_HOME=/usr/local/freesurfer
source $FREESURFER_HOME/SetUpFreeSurfer.sh

そして保存してください。
これでfreesurferのインストールは終わりです。
で、実際に動くかどうかのテストですが、
シェルを立ち上げていただくと、私の場合、以下のようなメッセージが出てきます。(私のは64bit環境です)

——– freesurfer-Linux-centos4_x86_64-stable-pub-v4.5.0 ——–
Setting up environment for FreeSurfer/FS-FAST (and FSL)
FREESURFER_HOME /usr/local/freesurfer
FSFAST_HOME /usr/local/freesurfer/fsfast
FSF_OUTPUT_FORMAT nii
SUBJECTS_DIR /usr/local/freesurfer/subjects
MNI_DIR /usr/local/freesurfer/mni
hogehoge@hogehoge:~>

こんな感じでしょうか。

A study of FSLUTILS: a script to convert image files into NIFTI format

FSL has a set of many useful command-line utilities. One of the utilities is “fslchfiletype” which can change the file type of an image (e.g. from ANALYZE to NIFTI).

Using this utility, I wrote a very tiny script with which one can convert many types of image files into NIFTI format. This is very effective if you have many ANALYZE format files and want to convert them into NIFTI format in one shot.

#!/bin/sh
#Image file type converter using fslchfiletype
#This script converts image files into NIFTI format files.
for f in $*
do
  fslchfiletype NIFTI $f
done

Download image2nii.sh

A study of SPM script: Data type converter

I’m learning how to make a script for SPM.
Below is a simple script which converts the data type of the image file.
It should work for both SPM8 and SPM5.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Data type converter
%Convert the data type (uint8, int16, int32, float32, float64)
%Usage
%Change the value at line 26(options.dtype) to the datatype you want.
%Kiyotaka Nemoto 2 Jan 2010
P = spm_select(Inf,’image’,'Select Files to be converted’);
for i=1:size(P,1)
ref = deblank(P(i,:));
[pth,nam,ext] = spm_fileparts(ref);
odir = pth;
cvt = ['d' nam '.nii'];
matlabbatch{1}.spm.util.imcalc.input = {ref};
matlabbatch{1}.spm.util.imcalc.output = cvt;
matlabbatch{1}.spm.util.imcalc.outdir = {odir};
matlabbatch{1}.spm.util.imcalc.expression = ‘i1′;
matlabbatch{1}.spm.util.imcalc.options.dmtx = 0;
matlabbatch{1}.spm.util.imcalc.options.mask = 0;
matlabbatch{1}.spm.util.imcalc.options.interp = 1;
matlabbatch{1}.spm.util.imcalc.options.dtype = 4;
% uint8=2; int16=4; int32=8; float32=16; float64=64
spm_jobman(‘run’,matlabbatch);
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

Download datatypeconv.m

Installing N3 (mni-n3) on Ubuntu 10.04 (Lucid Lynx) 64bit

Note: This article is pretty old. Now you can install MINC toolkit more easily. Please see the instruction in http://www.bic.mni.mcgill.ca/ServicesSoftware/ServicesSoftwareMincToolKit. (24 Oct 2014)

We have few resources how to install N3 on Ubuntu. I could successfully install N3 (aka mni-n3) on Ubuntu 10.04. I write down what I did.

NB: This is only for 64bit Ubuntu 10.04. They don’t maintain 32bit binary for minc.
The following commands must be executed with root privileges (use sudo) except for the last one.

  1. Add the repository for minc-related software to your /etc/apt/sources.list.
  2. You can do this by adding the following line to the /etc/apt/sources.list.

    #MINC software
    deb http://packages.bic.mni.mcgill.ca/ubuntu-lucid/ ./

    Note: You have to include “./” at the end of the line.

  3. Refresh repository
  4. $ sudo apt-get update

  5. Install N3
  6. Through many trials and errors, I found out that we have to specify the following 4 packages; minc, minc-tools, n3, and libmni-perllib-perl to have n3 work properly. Of course you can install other packages such as mni-autoreg, register, display, or mincblob. (However, I haven’t fully tested about these packages.)

    $ sudo apt-get install libmni-perllib-perl minc minc-tools n3

    Note: Ignore the Warning: “The following packages cannot be authenticated!” and press Y when asked: “Install these packages without verification [y/N]?”

  7. Configure the path
  8. Add the phrase “export PATH=/usr/local/bic/bin:$PATH” in your .bashrc file (located in your home directory). You don’t have to be root doing this.

Now you are ready to use N3 on your Ubuntu 10.04!