DTI-TK new babe

269 views
Skip to first unread message

ping

unread,
Oct 18, 2009, 9:44:07 PM10/18/09
to DTI ToolKit (DTI-TK)
Hi Gary,

Sorry for some beginner's question..

How to input the b-vector and the corresponding b-value files in
order to create the tensor image using DTI-TK ? I have the
concatenated 4-D DTI image from the "dcm2nii" of MRIcro. Thanks.

Ping

Gary

unread,
Oct 19, 2009, 9:41:54 AM10/19/09
to DTI ToolKit (DTI-TK)
Hi Ping,

DTI-TK does not include tensor reconstruction capability, as discussed
here:

http://groups.google.com/group/dtitk/web/What%20DTI-TK%20does%20not%20do

The following page

http://groups.google.com/group/dtitk/web/Interoperability%20with%20major%20DTI%20tools

discusses how to convert the tensor volume reconstructed from tools,
such as FSL, to DTI-TK compatible format.

Gary

Ping-Hong Yeh

unread,
Oct 20, 2009, 6:07:15 PM10/20/09
to dt...@googlegroups.com
Hi Gary,

Refining the template using population affine alignment has failed in
our 1.5T data. The voxel intensity of mean_affine3 image is all
0.001. The mean_rigid3 image seems fine though. Here is what I did

dti_rigid_population mean.nii.gz tensorfilelist.txt EDS 3
dti_affine_population mean_rigid3.nii.gz tensorfilelist.txt EDS 3

The text file contains the names of tensor files, should I use the FA
image instead?

I have also followed the pre-processing steps beforehand.
Thanks for help.

Ping

hui Zhang

unread,
Oct 20, 2009, 6:46:14 PM10/20/09
to dt...@googlegroups.com
Hi Ping,

Unfortunately, initial rigid/affine alignment can fail at times.  When it does, it becomes important to examine your data a bit more carefully.  You need to look at the normalized volumes themselves to help pinpoint where the failures occurred.

This is what I will suggest you do

1) Give me a bit more information about your dataset, i.e., voxel size, dimension, number of gradient directions.  I can help judge if the dataset may work well with DTI-TK.

2) Give me specific steps you've taken to prepare the images for DTI-TK.  In the event that you inadvertently miss a step, I can help catch it for you.

3) Run dti_rigid_population for just one iteration.  if it works for the 1st iteration, it should generally work just fine for additional iteration that further refines the template.

Here the key is to look at the normalized volumes *_aff.nii.gz and see if registrations have done the expected.  If you have access to a Mac OSX machine, you can do this inspection easily and quickly with DTI-TK Quick Look Plugin


If you don't, you can use a similar tool called ImageQuickLook in DTI-TK.  It will generate a png from the input scalar volume.  So you can write a script to dump out all the FA maps from the normalized DTI volumes and convert the FA maps to png's for quick inspection.

4) Run dti_affine_population for just one iteration.  The idea here is the same as 3).

Following these steps, we can figure out where things have gone wrong.  Let me know how it goes.

Gary

Ping-Hong Yeh

unread,
Oct 20, 2009, 7:47:12 PM10/20/09
to dt...@googlegroups.com
Hi Gary,


> Unfortunately, initial rigid/affine alignment can fail at times.  When it
> does, it becomes important to examine your data a bit more carefully.  You
> need to look at the normalized volumes themselves to help pinpoint where the
> failures occurred.
> This is what I will suggest you do
> 1) Give me a bit more information about your dataset, i.e., voxel size,
> dimension, number of gradient directions.  I can help judge if the dataset
> may work well with DTI-TK.

The dimension: 256*256*24, voxel size: 1.09*1.09*6.5 mm^3, 24 gradient
directions plus one b=0

> 2) Give me specific steps you've taken to prepare the images for DTI-TK.  In
> the event that you inadvertently miss a step, I can help catch it for you.

The tensor images were reconstructed originally from the FSL , and I
resampled the data to 256*256*64 with 1*1*2.25 mm^3 in resolution

Here is what I did in the shell


cd $data_dir
subjects=`ls -d *`

for subject in $subjects; do
cd $subject

TVFromEigenSystem -basename ${subject}-ec-bet-dti -type FSL -out
${subject}_tensor.nii.gz

TVTrace -in ${subject}_tensor.nii.gz
TVAnisotropy -in ${subject}_tensor.nii.gz
TVEigs -in ${subject}_tensor.nii.gz
TVLPS -in ${subject}_tensor.nii.gz
#pdrgb ${subject}_tensor.nii.gz 1.0
#ellipsoidImageColOriAniScl ${subject}_tensor.nii.gz 0 255 0 255 11 11 1.0
#ellipsoidImageColOriAniScl ${subject}_tensor.nii.gz 0 255 128 128 0 23 1.0
#masking
TVMask -in ${subject}_tensor.nii.gz -out ${subject}_mtensor.nii.gz
-mask ${subject}_b0-bet_mask.nii.gz
TVNorm -in ${subject}_mtensor.nii.gz
SVStatistics -in ${subject}_mtensor_norm.nii.gz
TVSPD -in ${subject}_mtensor.nii.gz -out ${subject}_spd.nii.gz
VolumeInfo ${subject}_mtensor.nii.gz
TVAdjustVoxelspace -in ${subject}_mtensor.nii.gz -ox 0 -oy 0 -oz 0
cd ..

done

cd $data_dir

files=`find . -type f -a -name \*mtensor.nii.gz\*`
mkdir $work_dir
#mkdir ../results-dti_tk_group
#cp $files ../results-dti_tk_group
cp $files ${work_dir}

#cd ../results-dti_tk_group
cd ${work_dir}
for mtensorfile in `ls -f *mtensor.nii.gz`; do
echo $mtensorfile >> tensorfilelist.txt
done

#Bootstrap the initial mean "mean_initial.nii.gz".
TVMean -in tensorfilelist.txt -out mean_initial.nii.gz
#upsampling population template to 1*1*2.25
TVResample -in mean_initial.nii.gz -xs 256 -ys 256 -zs 64 -xv 1 -yv 1
-zv 2.25 -out mean.nii.gz
#Rigid Alignment with the initial mean estimate:
dti_rigid_population mean_initial.nii.gz tensorfilelist.txt EDS 3
#Affine Alignment with the final refined mean estimate from rigid alignment


dti_affine_population mean_rigid3.nii.gz tensorfilelist.txt EDS 3

#Deformable Alignment with the final refined meanestimate from affine alignment
TVTrace -in mean_affine3.nii.gz
BinaryThresholdImageFilter mean_affine3_tr.nii.gz mask.nii.gz 0.01 100 1 0
dti_diffeomorphic_population mean_affine3.nii.gz
tensorfilelist_aff.txt mask.nii.gz 0.002


> 3) Run dti_rigid_population for just one iteration.  if it works for the 1st
> iteration, it should generally work just fine for additional iteration that
> further refines the template.
> Here the key is to look at the normalized volumes *_aff.nii.gz and see if
> registrations have done the expected.  If you have access to a Mac OSX
> machine, you can do this inspection easily and quickly with DTI-TK Quick
> Look Plugin
> http://groups.google.com/group/dtitk/web/What%20does%20it%20do%3F
> If you don't, you can use a similar tool called ImageQuickLook in DTI-TK.
>  It will generate a png from the input scalar volume.  So you can write a
> script to dump out all the FA maps from the normalized DTI volumes and
> convert the FA maps to png's for quick inspection.
> 4) Run dti_affine_population for just one iteration.  The idea here is the
> same as 3).
> Following these steps, we can figure out where things have gone wrong.  Let
> me know how it goes.

The dti_rigid_population runs fine, but not dti_affine_population. I
have attached the snapshot of mean_affine0, the mean_affine1 is blank,
I meant all the intensity is 0.001.

Thanks a lot.

Ping

> Gary
>

mean_affine0.png

hui Zhang

unread,
Oct 20, 2009, 8:08:09 PM10/20/09
to dt...@googlegroups.com
Hi Ping,

I think I know what has gone wrong.  You missed a crucial step, makingdiffusivity adjustment.  This is the 3rd preprocessing step.

I confirmed this by looking at the intensity range of the mean_affine0.nii.gz you attached.

In addition, I'd keep the original volumes as they are before bootstrapping the initial mean, i.e., skip the resampling if you did.

Finally, Can you resample the initial mean to the voxel space I recommended?

128x128x64 1.5x1.75x64 mm^3

You won't gain much with 256x256.  It will make things a lot slower for sure because of the images are 4 times bigger.

Gary

Ping-Hong Yeh

unread,
Oct 20, 2009, 8:47:09 PM10/20/09
to dt...@googlegroups.com
Hi Gary,

Thanks for the clarification.
Should I do the factor multiplication after running the
"TVFromEigenSystem" or before, i.e. multiply the factor to the
original tensor file (V1) only or all the eigenvalues and mean
diffusivity images created by FSL?
Also is there a tensor template in MNI standard space available to use
somewhere? Is it appropriate to use the FMRIB58_FA_1mm from the JHU
instead for the tensor coregistration?

Ping

hui Zhang

unread,
Oct 21, 2009, 4:03:36 AM10/21/09
to dt...@googlegroups.com
Hi Ping,

On Wed, Oct 21, 2009 at 1:47 AM, Ping-Hong Yeh <pingh...@gmail.com> wrote:

Hi Gary,

Thanks for the clarification.
Should I do the factor multiplication after running the
"TVFromEigenSystem" or before, i.e. multiply the factor to the
original tensor file (V1) only or all the eigenvalues and mean
diffusivity images created by FSL?

The short answer is to do it after the FSL to NIfTI conversion.  A longer discussion can be found in my earlier exchange with Sid.

 
Also is there a tensor template in MNI standard space available to use
somewhere? Is it appropriate to use the FMRIB58_FA_1mm from the JHU
instead for the tensor coregistration?

DTI-TK uses bootstrapping technique to create the most optimal DTI template from your own data.  In practice, if you have a lot of data, you can randomly select a subset of them, around 10 to get a customized template.

Since DTI-TK derives optimal alignment of white matter with tensor information, it requires the input images, including the template, to be tensor images, i.e., DTI volumes.  So you can't use FMRIB58_FA_1mm.

Gary

Ping-Hong Yeh

unread,
Oct 29, 2009, 2:56:32 PM10/29/09
to dt...@googlegroups.com
Hi Gary,

I have some questions regarding the warping scalar volumes to the
template and standard space.

First, is mean_diffeomorphic_initial6 the final population template if
I used the following command

"dti_diffeomorphic_population mean_affine3.nii.gz
tensorfilelist_aff.txt mask.nii.gz 0.002"

I then ran "dfRightComposeAffine" and "deformationSymTensor3DVolume"
to map the subject data to the final template by

dfRightComposeAffine -aff ${subject}_mtensor.aff -df
${subject}_mtensor_aff_diffeo.df.nii.gz -out
${subject}_mtensor_combined.df.nii.gz
deformationSymTensor3DVolume -in ${subject}_mtensor.nii.gz -trans
${subject}_mtensor_combined.df.nii.gz -target mean.nii.gz -out
${subject}_mtensor_combined.nii.gz

The tensor in template space seem fine,and it created DTI scalar
measures as well, but the outputs from warping the scalar volumes to
the template screw up
it is what I did

listings="fa lambda1 lambda2 lambda3 linear planar spherical tr"
for listing in $listings; do

deformationScalarVolume -in ${subject}_tensor_${listing}.nii.gz
-trans ${subject}_mtensor_combined.df.nii.gz -target mean.nii.gz -out
${subject}_${listing}_combined.nii.gz

done

they are off the center quite a big


For mapping the population template to the standard space, you
mentioned LONI ICBM-DTI-81 atlas is not suitable, but our data is 1.5T
data, can I still use it?


I did try the following the step and got errors, Here is what I did.

factor=1000
cp $FSLDIR/data/atlases/ICBM_DTI/UCLA_avgTensor/UCLA_avgTensor.nii.gz
${work_dir}/template.nii.gz
TVMultiply -in ${work_dir}/template.nii.gz -mult ${factor} -out
${work_dir}/template.nii.gz
mean=mean_diffeomorphic_initial6
dti_rigid_reg template.nii.gz ${mean}.nii.gz EDS 4 4 4 0.001
dti_affine_reg template.nii.gz ${mean}.nii.gz EDS 4 4 4 0.001 1
dti_diffeomorphic_reg template.nii.gz ${mean}_aff.nii.gz
template_mask.nii.gz 1 6 0.002


I got error in the dti_diffeomorphic_reg

cannot open mean_diffeomorphic_initial6_aff_to_template.5.pwa
converting to the diffeomorphic deformation field: ...
reading the buffer ... ** ERROR (nifti_image_read): failed to find header file f
or 'mean_diffeomorphic_initial6_aff_to_template.5.df.nii.gz'


Thanks for the help.

Ping

hui Zhang

unread,
Oct 29, 2009, 3:23:58 PM10/29/09
to dt...@googlegroups.com
Hi Ping,

This first response will focus on the warping question that you had.

On Thu, Oct 29, 2009 at 6:56 PM, Ping-Hong Yeh <pingh...@gmail.com> wrote:

First, is mean_diffeomorphic_initial6 the final population template if
I used the following command

"dti_diffeomorphic_population mean_affine3.nii.gz
tensorfilelist_aff.txt mask.nii.gz 0.002"

This is correct.
 
I then ran "dfRightComposeAffine" and "deformationSymTensor3DVolume"
to map the subject data to the final template by

dfRightComposeAffine -aff ${subject}_mtensor.aff -df
${subject}_mtensor_aff_diffeo.df.nii.gz -out
${subject}_mtensor_combined.df.nii.gz
deformationSymTensor3DVolume -in ${subject}_mtensor.nii.gz -trans
${subject}_mtensor_combined.df.nii.gz -target mean.nii.gz -out
${subject}_mtensor_combined.nii.gz

The tensor in template space seem fine,and it created DTI scalar
measures as well

As long as you followed the tutorial, I don't expect any issues here.
 
but the outputs from warping the scalar volumes to
the template screw up
it is what I did

listings="fa lambda1 lambda2 lambda3 linear planar spherical tr"
for listing in $listings; do

       deformationScalarVolume -in ${subject}_tensor_${listing}.nii.gz
-trans ${subject}_mtensor_combined.df.nii.gz -target mean.nii.gz -out
${subject}_${listing}_combined.nii.gz

done

they are off the center quite a big

I noticed an interesting difference here.  The tensor volume that you warped are *_mtensor.nii.gz.  The scalar volume are *_tensor_....nii.gz, i.e., without the little "m".  I suspect that there are some difference between these two volumes, such as, origin, dimension, voxel spacing, etc.

If not, there shouldn't be any difference at all.

A side but important note --- in principle, if we accept that we are working tensor fields, it is better to warp the tensor images themselves and then compute the scalar indices of the warped images.  In practice, does it make a lot of difference?  I haven't seen any evidence myself.

Gary
Reply all
Reply to author
Forward
0 new messages