1. 目的
2. コマンド
3. 使用例
3.1. 前準備
3.2. テンソルの推定(コマンド:dwi2tensor
)
3.3. 拡散定量値の算出(コマンド:tensor2metric
)
1. 目的
- MRtrixを用いた拡散テンソルイメージング: DTI
2. コマンド
MRtrixを用いて、拡散テンソルイメージング(DTI)をするには、dwi2tensor
とtensor2metric
コマンドを用いる。
dwi2tensor
は拡散MRI画像からテンソルを推定するコマンドで、tensor2metric
は推定したテンソルから拡散定量値を算出するコマンドである。
dwi2tensor
のヘルプは、次の通り。
クリックして展開
SYNOPSIS Diffusion (kurtosis) tensor estimation USAGE dwi2tensor [ options ] dwi dt dwi the input dwi image. dt the output dt image. DESCRIPTION By default, the diffusion tensor (and optionally its kurtosis) is fitted to the log-signal in two steps: firstly, using weighted least-squares (WLS) with weights based on the empirical signal intensities; secondly, by further iterated weighted least-squares (IWLS) with weights determined by the signal predictions from the previous iteration (by default, 2 iterations will be performed). This behaviour can be altered in two ways: * The -ols option will cause the first fitting step to be performed using ordinary least-squares (OLS); that is, all measurements contribute equally to the fit, instead of the default behaviour of weighting based on the empirical signal intensities. * The -iter option controls the number of iterations of the IWLS prodedure. If this is set to zero, then the output model parameters will be those resulting from the first fitting step only: either WLS by default, or OLS if the -ols option is used in conjunction with -iter 0. The tensor coefficients are stored in the output image as follows: volumes 0-5: D11, D22, D33, D12, D13, D23 If diffusion kurtosis is estimated using the -dkt option, these are stored as follows: volumes 0-2: W1111, W2222, W3333 volumes 3-8: W1112, W1113, W1222, W1333, W2223, W2333 volumes 9-11: W1122, W1133, W2233 volumes 12-14: W1123, W1223, W1233 OPTIONS -ols perform initial fit using an ordinary least-squares (OLS) fit (see Description). -mask image only perform computation within the specified binary brain mask image. -b0 image the output b0 image. -dkt image the output dkt image. -iter integer number of iterative reweightings for IWLS algorithm (default: 2) (see Description). -predicted_signal image the predicted dwi image. DW gradient table import options -grad file Provide the diffusion-weighted gradient scheme used in the acquisition in a text file. This should be supplied as a 4xN text file with each line is in the format [ X Y Z b ], where [ X Y Z ] describe the direction of the applied gradient, and b gives the b-value in units of s/mm^2. If a diffusion gradient scheme is present in the input image header, the data provided with this option will be instead used. -fslgrad bvecs bvals Provide the diffusion-weighted gradient scheme used in the acquisition in FSL bvecs/bvals format files. If a diffusion gradient scheme is present in the input image header, the data provided with this option will be instead used. Standard options -info display information messages. -quiet do not display information messages or progress status; alternatively, this can be achieved by setting the MRTRIX_QUIET environment variable to a non-empty string. -debug display debugging messages. -force force overwrite of output files (caution: using the same file as input and output might cause unexpected behaviour). -nthreads number use this number of threads in multi-threaded applications (set to 0 to disable multi-threading). -config key value (multiple uses permitted) temporarily set the value of an MRtrix config file entry. -help display this information page and exit. -version display version information and exit.
tensor2metric
のヘルプは、次の通り。
クリックして展開
SYNOPSIS Generate maps of tensor-derived parameters USAGE tensor2metric [ options ] tensor tensor the input tensor image. OPTIONS -adc image compute the mean apparent diffusion coefficient (ADC) of the diffusion tensor. (sometimes also referred to as the mean diffusivity (MD)) -fa image compute the fractional anisotropy (FA) of the diffusion tensor. -ad image compute the axial diffusivity (AD) of the diffusion tensor. (equivalent to the principal eigenvalue) -rd image compute the radial diffusivity (RD) of the diffusion tensor. (equivalent to the mean of the two non-principal eigenvalues) -cl image compute the linearity metric of the diffusion tensor. (one of the three Westin shape metrics) -cp image compute the planarity metric of the diffusion tensor. (one of the three Westin shape metrics) -cs image compute the sphericity metric of the diffusion tensor. (one of the three Westin shape metrics) -value image compute the selected eigenvalue(s) of the diffusion tensor. -vector image compute the selected eigenvector(s) of the diffusion tensor. -num sequence specify the desired eigenvalue/eigenvector(s). Note that several eigenvalues can be specified as a number sequence. For example, '1,3' specifies the principal (1) and minor (3) eigenvalues/eigenvectors (default = 1). -modulate choice specify how to modulate the magnitude of the eigenvectors. Valid choices are: none, FA, eigval (default = FA). -mask image only perform computation within the specified binary brain mask image. Standard options -info display information messages. -quiet do not display information messages or progress status; alternatively, this can be achieved by setting the MRTRIX_QUIET environment variable to a non-empty string. -debug display debugging messages. -force force overwrite of output files (caution: using the same file as input and output might cause unexpected behaviour). -nthreads number use this number of threads in multi-threaded applications (set to 0 to disable multi-threading). -config key value (multiple uses permitted) temporarily set the value of an MRtrix config file entry. -help display this information page and exit. -version display version information and exit.
DTI拡散定量値(FA, MD, AD, RD, カラーFA)を計算するための基本的な使い方は、以下の通り。
dwi2tensor <入力画像> <出力画像> tensor2metric -fa <出力画像> -adc <出力画像> -ad <出力画像> -rd <出力画像> -vec <出力画像> tensor.mif
3. 使用例
3.1. 前準備
まず、次のファイルを用意する。
. ├── DWI.nii.gz # 拡散MRI ├── DWI_mask.nii.gz ├── bvals # b-values ├── bvecs # b-vectors └── headers.json # ヘッダー情報の入ったJSONファイル
こちらの記事を参考に、拡散MRI(DWI.nii.gz)とそのMPG軸情報(bvecs, bvals)とヘッダー情報(headers.json)をまとめて、MIF形式(DWI.mif)に変換する。
mrconvert -fslgrad bvecs bvals -json_import headers.json DWI.nii.gz DWI.mif
3.2. テンソルの推定(コマンド:dwi2tensor
)
ファイルの用意ができたら、dwi2tensor
を次のように実行する
dwi2tensor DWI.mif tensor.mif
mrinfo
を使って「tensor.mif」の情報を確認すると、6 volumesのデータであることが分かる。
mrinfo tensor.mif
************************************************
Image name: "tensor.mif"
************************************************
Dimensions: 130 x 130 x 82 x 6
Voxel size: 1.76923 x 1.76923 x 1.8 x 1
Data strides: [ -1 2 3 4 ]
Format: MRtrix
Data type: 32 bit float (little endian)
Intensity scaling: offset = 0, multiplier = 1
Transform: 1 0 0 -109
-0 1 0 -103.7
-0 0 1 -58.57
それぞれのボリュームは、各方向の拡散係数に相当する。
The tensor coefficients are stored in the output image as follows:
volumes 0-5: D11, D22, D33, D12, D13, D23
3.3. 拡散定量値の算出(コマンド:tensor2metric
)
先程推定した、「tensor.mif」を使って拡散定量値を算出する。
tensor2metric -fa FA.mif -adc MD.mif -ad AD.mif -rd RD.mif -vec color_FA.mif tensor.mif
DTIの各拡散定量値画像は、以下。
いつも参考にさせて頂きありがとうございます。解析について詳しくなくて大変恐縮なのですが、MRtrix3でのDTIマップ画像を取得したく、本ページを参考に実行しましたが
mrconvert: [ERROR] can’t split string ”
”
mrconvert: [ERROR] error creating image “DWI.mif”
と表示されました。可能であれば解決策についてお教えいただければ幸いです。
ご多忙な中大変申し訳ありませんが、よろしくお願いたします。
よろしかったら、mrconvert のコマンドをそのままコピペしてもらってよろしいですか?入力画像は input.nii.gz などにしてもらってかまいませんので。
実際のコマンドを見たら想像がつくかなと思います。
早速返信頂きましてありがとうございます。すいませんがよろしくお願いいたします。
mrconvert -fslgrad sample_dti001.bvec sample_dti001.bval -json_import sample_dti001.json sample_edti001.nii.gz DWI.mif
コマンドそのものは悪くなさそうですね。
この場合、少しずつわけたらいいかなと思います。
まずは、
ができるかどうか確認してもらえたらと思います。
その次に
を試していただけますか。
これが問題なくいけたら、jsonファイルの import は必須ではないので、それで進めていいかと思います。
まずは、ここまで確認していただけませんか?
先生、早速ご対応頂き大変感謝しております。先生の通りにコマンドを実行しましたら上手く進むことができました。dwi2tensorやtensor2metricも実行可能でしたありがとうございました。
今回はCL、CP、CSマップの作成を目的にdtifitとfslmathsでλ1-3の計算式を参考に作り、fsleyesで確認したのですが、コントラストやブライトネスを動かしても画像が見えなかったので、MRtrixで確認することにしました。tensor2metric後にmifからniiに変換してfsleyesで見てみましたが同様で、論文で出ているような画像が出来ませんでした。FA、MD、RD、ADは問題ないように思います。今回の内容とは異なり、また具体的な問題点に欠け、大変申し訳ありませんが、もし何かありましたらアドバイスいただけると幸いです。mrconvertの件、誠にありがとうございました。
こちらも実際のコマンドを教えていただけたら、そこに何か課題がないかどうか確認できると思います。