2skullstrip_T12brainmask.m
1DCM2T1.shでできたT1.mgzからbrainmask.mgzを作る:skullを外す
ファイルはscriptからダウンロードするのがよいと思われる
使い方
1. 黄色の部分を適切に変更
2. 1-2までをコピペして走らせる。ウィンドウが立ち上がるのでnasion, LPA, RPAを指定する。
ちょっとヘルプが出てくるのでよく読む。
たぶん通常のMRIと同じで画面の左が右耳。終わったらqを押して終了させる。
3. 残りの部分をコピペして走らせる。
brainmask.mgzがあるのを確認
%% fieldtrip jou de dicom wo yomikonde skull wo nozoku,
%% sono ato .mgz file de hozonsuru
%% kono ato bash de freesurfer wo ugokasu (createAseg.sh)
%% settings
%working directory
sWorkDir='/misc/raid1/hogehoge/mri';%T1.mgzを置いているディレクトリ
cd(sWorkDir);
%omajinai
ft_defaults;
%%1. read T1.mgz file
mri=ft_read_mri('T1.mgz');
%% 2. Preprocessing of the anatomical MRI: realign to CTF
%You can check the coordinate system of the mri, using the following function:
cfgRlgn = [];
cfgRlgn.method = 'interactive';
mri_ctf = ft_volumerealign(cfgRlgn, mri);
%!! kokomade (2made)de ittan tomeru: GUI no shori ga aru
% matlab no window no setsumei wo yoku yonde n(nasion),l(lpa),r(rpa) no mark wo tsukeru
%% 3. Preprocessing of the anatomical MRI: segmentation
% segmentation of the mri
cfgSeg = [];
cfgSeg.coordsys = 'ctf';
cfgSeg.output = {'skullstrip' 'brain'};
seg = ft_volumesegment(cfgSeg, mri_ctf);
% ensure that the skull-stripped anatomy is expressed in the same coordinate system as the anatomy
seg.transform=mri.transform;
% save both the original anatomy, and the masked anatomy in a freesurfer compatible format
cfgVl = [];
cfgVl.filename = 'brainmask';
cfgVl.filetype = 'mgz';
cfgVl.parameter = 'anatomy';
ft_volumewrite(cfgVl, seg);
%brainmask.mgzがあることを確認
%%kokomade dekitara bash kara 3recon_all_rest.shを走らせる