For T1-weighted images that have been processed with DARTEL, I am trying to map an MNI-space atlas sampled at 1.5 mm isotropic into native space.
The recipe is simple enough:
1. every T1 has an inverse warp file computed with Segment:
/path/to/T1.nii
/path/to/iy_T1.nii
2. The yi files are stored in a text file visit1_iy_files.txt
[iys] = textread ([pwd filesep 'visit1_iy_files.txt'])
3. For every yi file, copy the atlas to its directory and warp it
atlas=[ pwd filesep 'SPM12_TMP_90_AAL.nii' ];
for ( iy = 1:length(iys) )
% copy atlas
atlas_scan_name=strrep(iys{iy},'.nii','_atlas.nii');
link_output=evalc(['!ln -vfs ' atlas ' ' atlas_scan_name]);
% set warp parameters
temp_line = ['matlabbatch{1}.spm.spatial.normalise.write.subj(', num2str(iy),').def = {','''',iys{iy},'''','};'];
fprintf(batch_fid, '%s\n', temp_line);
% select atlas as the file to be warped
temp_line = ['matlabbatch{1}.spm.spatial.normalise.write.subj(', num2str(iy),').resample = {','''',atlas_scan_name,'''','};'];
fprintf(batch_fid, '%s\n', temp_line);
end
4. Run the batch file (batch_fid) which consists of pairs of lines
%%matlabbatch{1}.spm.spatial.normalise.write.subj(42).def = {'/path/to/iy_T1.nii'};
%%matlabbatch{1}.spm.spatial.normalise.write.subj(42).resample = {'/path/to/iy_T1_atlas.nii'};
...etc
5. Run the batch
<call batch_fid file to fill matlabbatch>
spm_jobman('run',matlabbatch)
Then the resulting files '/path/to/wiy_T1_atlas.nii' have dimensions 1,2,3 of 79, 95 and 79 and voxels alre 2x2x2 cm. Very different from the original atlas.
Is this because the 'reference' space needs to be set somehow?
Is it possible to do this with already-computed warp files?
bw
Alle Meije
|