Oops, forgot to paste in the script. Here you go. You just have to cut and
paste it into a text file and use "chmod a+x" to make it executable.
cheers,
Brian
//-------------------------START BASH SCRIPT TO ADD Scalars and
Vectors---------------------//
#!/bin/sh
#this wont work with binary vtk files, or ones that already have point data.
#first input mesh
fin=$1
#second input label
label=$2
#3rd input is output name
fout=$3
Npoints=`cat $fin | sed -n '5p' | awk '{ print $2 }'`
cp $fin $fout
echo "POINT_DATA $Npoints" >> $fout
echo "SCALARS Scalars float" >>$fout
echo "LOOKUP_TABLE default" >>$fout
count=0;
while [ $count -lt $Npoints ] ; do
echo "${label} " >>$fout
let count+=1
done
echo "VECTORS Vectors float" >>$fout
count=0;
while [ $count -lt $Npoints ] ; do
echo "${label} 0 0 " >>$fout
let count+=1
done
//-------------------------END BASH SCRIPY---------------------//
> Hi Brian,
>
> thanks for your answer. Do you wanted to send the script
> (appendScalarsAndVectors.sh) as an attachment?
>
> thanks, michael
>
> On 9-Jul-09, at 12:49 PM, Brian Patenaude wrote:
>
>> Hi,
>>
>> No, not explicitly. But here's a way to do it. Effectively, fslview
>> in its
>> current state only colours by the "SCALARS" field (however, I believe
>> because of some of the thresholding that's done requires a vectors
>> field
>> as well ) . Here's is a script to add scalars/vectors of to a
>> surfaces.
>>
>> A limitation of fslview is that it will not allow you to alter the
>> min max
>> range separately for different surfaces. It may be easiest to
>> combine the
>> surfaces to visualize into a single vtk file.
>>
>> Example pipeline:
>>
>> #script below , append scalars and vetcors
>> ./appendScalarsAndVectors.sh L_Hipp_bin.vtk 5 L_Hipp_ScVec.vtk
>> ./appendScalarsAndVectors.sh L_Thal_bin.vtk 1 L_Thal_ScVec.vtk
>>
>> ls *ScVec.vtk > meshes.txt
>>
>> run_mesh_utils --doCombineMeshes -m meshes.txt -o
>> L_Hipp_Thal_ScVec.vtk
>>
>> # you can now load L_Hipp_Thal_ScVec.vtk into fslview, untick the show
>> vectors box, and play with the "Vector Range" to change colours.
>>
>> Let me know if you have any problems.
>>
>> Cheers,
>>
>> Brian
>>
>>
>>> Dear Fsl experts,
>>>
>>> is there a way to color a mesh object in 3D fslview? Say, for example
>>> I wanted to show the left Hippocampus blue and the right one red?
>>>
>>> Thanks, Michael
>>>
>>>
>
>
|