Hi,
I'm including a script below that will let you take the non-zero
F-statistic voxels and create a corresponding volume
in MNI space from them. Use the *Fthresh*.vtk output from
surface_fdr as the input, as this does the thresholding
with FDR to exclude non-significant vertices. You can then
identify interesting coordinates (the intensity encoded at
each voxel is the maximum F-statistic value of all
mesh vertices within that voxel) and then transform
them to other spaces using the img2imgcoord tool.
Alternatively, you can transform the volume (and
use nearest neighbour interpolation) with FLIRT.
Either way it should let you do what you want to do.
You just need to copy and paste the text of the script
into a pure text editor (emacs, nedit, pico, etc) save
the script somewhere, make it executable
(chmod 755 filename) and then run it.
All the best,
Mark
#!/bin/sh
if [ $# -lt 2 ] ; then
echo "Usage: `basename $0` <vtk file> <output image>"
exit 1;
fi
vtk=$1
rim=$FSLDIR/data/standard/MNI152_T1_2mm
outim=$2
line1=`grep -n POINTS $vtk`;
np=`echo $line1 | awk '{ print $2 }'`;
n1=`echo $line1 | sed 's/:.*//'`;
n1=`echo $n1 + 1 | bc`;
n1end=`echo $n1 + $np - 1 | bc`;
n2=`grep -n SCALARS $vtk | sed 's/:.*//'`;
n2=`echo $n2 + 2 | bc`;
n2_end=`echo $n2 + $np -1 | bc`;
sed -n "${n1},${n1end}p" $vtk > FSLTMP1
sed -n "${n2},${n2_end}p" $vtk > FSLTMP2
$FSLDIR/bin/fslmaths $rim -mul 0 $outim
nums=`grep -n [1-9] FSLTMP2 | sed 's/:.*//'`;
n2tot=`echo $nums | wc -w`;
for n in $nums ; do
echo $n : $n2tot
coords=`sed -n "${n}p" FSLTMP1`;
val=`sed -n "${n}p" FSLTMP2`;
roivals=`echo $coords | awk '{ print $1 / 2 + 0.5 " 1 " $2 / 2 + 0.5 " 1 " $3 / 2 + 0.5 " 1 0 1" }'`;
# echo $FSLDIR/bin/fslmaths $rim -mul 0 -add 1 -roi $roivals -add $outim $outim
$FSLDIR/bin/fslmaths $rim -mul 0 -add $val -roi $roivals -max $outim $outim
done
On 24 Jan 2011, at 08:40, Brian Patenaude wrote:
> Hi,
>
> There was actually a mistake in this post, the method below would give you
> the scalars on the mean surface transformed into the native space, rather
> than on the vertices from surfaces output on FIRST surfaces.
>
> Cheers,
>
> Brian
>
>> Because of the vertex correspondance, you can actually just append the
>> scalars to the native space surfaces. Given the available tools, the
>> easiest way to achieve this is to transform the vertex-analysis surface
>> back to native space.
>>
>> for firstflirt_xfm in *_t1_to_mni.mat ; do
>> f=`basename firstflirt_xfm .mat`
>> run_mesh_utils -m vertex_analysis_results.vtk --inverse -t
>> $first_flirt_xfm -o ${f}_to_native.vtk
>> done
>>
>> Where its loop around the transforms to mni space output by first_flirt.
>> If interest there are also ways to output the 'aligned' surfaces that are
>> used in the veretx analysis, so that you can visualize the vertex
>> variation.
>>
>> cheers,
>>
>> Brian
>>
>>
>>
>>
>>> Following a FIRST vertexwise analysis, is there any way to isolate the
>>> significant voxels back in each subject's native space (i.e., similar to
>>> what is done using tbss_deproject)? Maybe converting the mesh to a
>>> volume
>>> while preserving the statistics (if possible), then threshold the
>>> volume,
>>> and then use the inverse of the T1-std registration? Is there a way to
>>> threshold the mesh itself to omit non-significant voxels?
>>>
>>>
>>
>>
>
|