%For creating SplitROIs
clear all;
close all;

atlas_prefix='Paxinos_to_112RM-SL_20121014_nifti_fsl';
!mkdir SplitROIs
index=0:999;
for i=1:length(index)
    %Right hemisphere.
    cmd=sprintf('fslmaths %s.nii.gz -thr %d -uthr %d SplitROIs/%s_index_%d.nii.gz',atlas_prefix,index(i),index(i),atlas_prefix,index(i));
    fprintf('%s\n',cmd);
    unix(cmd);
    %Left hemisphere.
    cmd=sprintf('fslmaths %s.nii.gz -thr %d -uthr %d SplitROIs/%s_index_%d.nii.gz',atlas_prefix,index(i)+1000,index(i)+1000,atlas_prefix,index(i)+1000);
    fprintf('%s\n',cmd);
    unix(cmd);
end