I’m doing diffusion analysis and I need to use a specific atlas (eg. atlas.nii.gz) - it’s in FSL’s MNI space, 2mm, but it doesn’t split the left and right hemisphere. I will need to separate the left and right, and reorganize the integer values (to make it double). I assume I could use fslmaths commads but I’m not sure how to do it. Does anyone have any ideas?
I want to modify the atlas (let’s say, separate it to left and right hemisphere and rearrange it to new label numbers), instead of extracting a certain region from the atlas. Thanks for replying though!
Please allow me to complete my answer, it is one way to create a new atlas by selecting a number of rois and give them other numbers before putting them together, but there must be more clever ways:
This is a bash script using FSL functions.
Let’s say the labels for your right hemisphere are ranging from 1 to 10:
mkdir my_new_rois/
#extract the roi from a specific range
for roi_number in {1..10}
do fslmaths atlas.nii.gz -thr $roi_number -uthr $roi_number atlas_roi${roi_number}.nii.gz -odt double
done
#change the label number for a specific roi
for roi_number in {1..10}
do new_roi_number=$(expr 500 + $roi_number)
echo "new roi number is: $new_roi_number"
fslmaths atlas_roi${roi_number}.nii.gz -div $roi_number -mul $new_roi_number my_new_rois/atlas_roi${new_roi_number}.nii.gz -odt double
done
#merge all the rois with new numbers
list_add=
i=
for roi in $list_rois
do i=$(expr $i + 1 )
if [ $i = 1 ]
then list_add=$roi
else list_add="$list_add -add $roi"
fi
done
fslmaths $list_add my_new_atlas.nii.gz
The atlas I use doesn’t separate the left and right hemisphere. The values are the same. However, replace your step one to my script can perfectly solve my problem.