Dear Mark,
Thank you for prompt response. I really appreciate your help.
Despite your instructions, I couldn't succeed in getting the script to work. It is reading every line of the file, and prints every set of coordinates (=line), but it is only using the first iteration/line as roi. The good news is that the segmentation errors disappeared.
I have also tried to add '1 0 1' behind each coordinate set (=line) while removing it in the fslmaths command, but this doesn't solve the problem.
I would really appreciate your help. More details are below.
Thanks again,
Liza
Script:
****
#!/bin/sh
# change the next three lines to specify the filenames you want, vox_coords.txt should contain three values (space separated) on each line (as a voxel coord)
inim=MNI152_T1_1mm_brain_mask.nii.gz
outim=all_roi_in_one_file.nii.gz
coordfile=vox_coord.txt
#mask file
fslmaths $inim -mul 0 $outim
#n is the intensity, for landmark 1 the intensity is n=5, after, n=previous +10 see loop
n=5
#use : to separate coordinates
cat $coordfile | sed 's/ */:/g'> vox_coord_sep.txt
#remove tabs white spaces
cat vox_coord_sep.txt | sed 's/^ *//' | sed 's/ *$//' >vox_coord_rem.txt
#attempt with while read line
##cat vox_coord_dub.txt |while read line
##do
## c=$(echo "$line" |sed 's/:/ 1 /g')
# # echo $c
## fslmaths $outim -mul 0 -add 1 -roi $c 1 0 1 -mul $n -add $outim $outim
## n=`echo "(( $n + 10 ))" |bc`
##done
# for loop
for coord in $(cat vox_coord_rem.txt)
do
# add 1 between coordinates
c=`echo $coord |sed 's/:/ 1 /g'`
echo $c
echo $n
fslmaths $outim -mul 0 -add 1 -roi $c 1 0 1 -mul $n -add $outim $outim
#change intensity per landmark by + 10
n=`echo "(( $n + 10 ))" |bc`
done
cluster -i $outim -t 0.001
#create sphere
##fslmaths $outim -kernel sphere 3 -dilD $outim
****
vox_coord.txt file looks like this:
16 20 30
-14 17 10
27 -45 5
****
output:
16 1 20 1 30
5
-14 1 17 1 10
15
27 1 -45 1 5
25
Cluster Index Voxels MAX MAX X (vox) MAX Y (vox) MAX Z (vox) COG X (vox) COG Y (vox) COG Z (vox)
1 1 5 16 20 30 16 20 30
|