Dear all,
I'm want to create a mask with spherical ROIs in the MNI space using 3dcalc with the script below, where the coordinates of the ROI centers are in $ROIfile, e.g. 1,-23,34,15.
since the ROIs do not overlap and the initial ROI_parcels_MNI+tlrc. is all zeros (ie. 0*MNI template to obtain the same grid) and the value of iROI*step() must be an integer, I expected that the values in the spheres would also be integers. However, I noticed that they have decimals!! Any idea why aren't they integers?
Thanks in advance
Cesar
------------------------------------------------------------------------------------------
3dcalc -a MNI152_T1_2009c+tlrc. -expr '0*a' -prefix ROI_parcels_MNI
iROI=1
for coor in $(cat $ROIfile)
do
IFS=', ' read -a array <<< "$coor"
xcor=$(echo "${array[1]}")
ycor=$(echo "${array[2]}")
zcor=$(echo "${array[3]}")
echo "Computing parcel for ROI ${iROI} with coordinates x=${xcor}, y=${ycor}, z=${zcor}"
#compute spherical mask around this coordinate
rm tempROImask+tlrc.*
3dcalc -LPI -a ROI_parcels_MNI+tlrc. -expr "a+${iROI}*(step($sphereROI-(x-${xcor})*(x-${xcor})-(y-${ycor})*(y-${ycor})-(z-${zcor})*(z-${zcor})))" -prefix tempROImask
rm ROI_parcels_MNI+tlrc.*
3dcalc -a tempROImask+tlrc -expr 'a' -prefix ROI_parcels_MNI
iROI=$(($iROI+1))
done