MRIConvertを使って、DICOM画像をNIFTI画像に変換しようとすると、FSL_NIfTIとNIfTIの2つのオプションがあることに気づきます。
![]()
この違いは何なのでしょうか?
私自身も遭遇しましたし、他の方からも問い合わせがありましたので、簡単に記載しておきます。
MacをYosemiteにアップグレードした際に、FSLが動作しなくなることがあります。
その際には、バタバタする前に、まず、XQuartzを再インストールしてみてください。
それだけで問題が解決することがあります。
本家にも情報がありました。
Note for Yosemite (10.10) users: even if you have previously installed X11, you will need to reinstall it from the XQuartz web page to get FSL to work.
これで、問題解決といって大丈夫そうです。
Nifti file havs two kinds of extensions, hdr/img or nii.
Sometimes hdr/file nifti files can be confusing because the extension is the same as ANALYZE format.
There are some ways to convert hdr/img into nifti.
One is to use fslchfiletype included in FSL. This is the easiest, but it requires FSL.
The other is to use SPM. However, some scripting is needed.
So I wrote tiny scripts for converting hdr/img format into nii format.
If you prefer SPM, use img2nii_spm.m. Save the script into a folder under MATLAB path and type “img2nii_spm” from MATLAB command window.
%%img2nii.m--------------------------------------------
%Script to convert hdr/img files to nii.
%This script uses SPM function, so you need to install SPM5 or later.
%Kiyotaka Nemoto 05-Nov-2014
%select files
f = spm_select(Inf,'img$','Select img files to be converted');
%convert img files to nii
for i=1:size(f,1)
input = deblank(f(i,:));
[pathstr,fname,ext] = fileparts(input);
output = strcat(fname,'.nii');
V=spm_vol(input);
ima=spm_read_vols(V);
V.fname=output;
spm_write_vol(V,ima);
end
If you prefer FSL, use img2nii_fsl.sh. Save the script into a folder, add executable attribute using “chmod 755 img2nii_fsl.sh”.
Wild card can be used for selecting files.
#!/bin/sh #Image file type converter using fslchfiletype #This script converts various image files into NIFTI format (.nii) files. #K. Nemoto 19 Jan 2013 if [ $# -lt 1 ] ; then echo "Please specify the files you want to convert!" echo "Usage: $0 filename" exit 1 fi for file in "$@" ; do if [ -f $file ] ; then fslchfiletype NIFTI $file else echo "$file: No such file" fi done
Download img2nii_spm.m (Right-click and save).
Download img2nii_fsl.sh (Right-click and save).
FSLを開発しているFMRIBグループは、FSL courseのスライドおよびデータセットを公開してくださっています。ここで勉強しているときに、さりげなくシェルスクリプトのチュートリアルもあることが気になっていました。
先日、時間をとってこのチュートリアルを丁寧に見ていったところ、非常に勉強になることが多く、シェルスクリプトの理解が深まりました。FSLユーザーのみならず、脳画像解析でUNIX系のOS(Macも含む)を使う方々にとって有益な情報が多いと思いましたので、日本語にしておきたいと思い、FMRIBのSteve Smith教授の承諾を得て、このチュートリアルを翻訳させていただきました。
オリジナルのサイト自体は、スライド形式になっており、レクチャーと演習部分にわかれています。しかし、翻訳していく段階でこれを完全に模倣するよりは、レクチャーと演習をそれぞれ別の媒体として準備するのも勉強するのには都合がいいかもと考え、それぞれ別のPDFを準備しました。
関心のある方は、以下のリンクからPDFをご覧いただけたらと思います。
FSLViewで画像を表示すると、思ったような向きで表示されないときがあります。
下に例を示します。

ここでは、上にある水平断、冠状断が角度が変になってしまっています。
しかし、よくみると、FSLViewは画像の前後をきちんと認識しています。
画像のまわりにあるアルファベットはそれぞれ
A: anterior
P: posterior
L: left
R: right
I: inferior
S: superior
を意味しますが、正しくなっています。
それでは、「正しく」表示するにはどうしたらよいでしょうか。
続きを読む
*これは相当古いインストラクションです。新たなインストラクションを別に準備しますので、FSL 6.0.6 以降のインストール方法はそちらをご参照ください。
Mac OSXにFSLをインストールする機会がありました。
いくつか工夫が必要だったので、メモします。
(9/Dec/2014: fslinstaller.pyはスーパーユーザーでなくても大丈夫と気づいたので、修正しました。また、Yosemiteの場合についても追記しました。)
(1/Mar/2014: .bash_profileがない場合の対処を追記しました。また、改行コードについての注意も記載しました)
I found that now FSLView is available in Ubuntu 12.04
Below is the screenshot I installed in Lin4Neuro.
Now I do not have any hesitation moving from Ubuntu 10.04 to Ubuntu 12.04 (Actually Xubuntu 12.04)
So from now on I will stop developing Lin4Neuro based on Ubuntu 10.04. I keep working on getting Lin4Neuro based on Xubuntu 12.04 better and better.

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.
Follow the guideline described here.
$ sudo apt-get update
$ 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
This is the thing people often forget. Without this, you can’t run fsl from shell.
. /etc/fsl/fsl.sh
That’s it.
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