【FSL/MRtrix】 NIfTIヘッダーの確認


1. 目的
2. FSLを用いる場合
2.1. コマンド
2.2. 使用例
3. MRtrixを用いる場合
3.1. コマンド
3.2. 使用例


1. 目的

  • NIfTIヘッダーの確認

2. FSLを用いる場合

2.1. コマンド

FSLfslhdを用いる。

fslhdのヘルプは次の通り。

Usage: fslhd [-x] <input>
       -x : instead print an XML-style NIFTI header

基本的な使い方は、以下の通り。

fslhd <入力画像(NIfTI)>

2.2. 使用例

拡散MRI画像(DWI.nii.gz)のNIfTIヘッダーをみてみる。

fslhd DWI.nii.gz 

以下の情報が、出力される。
Out:

    filename	DWI.nii.gz 

    sizeof_hdr	348
    data_type	INT16
    dim0		4
    dim1		130
    dim2		130
    dim3		82
    dim4		129
    dim5		1
    dim6		1
    dim7		1
    vox_units	mm
    time_units	s
    datatype	4
    nbyper		2
    bitpix		16
    pixdim0		-1.000000
    pixdim1		1.769231
    pixdim2		1.769231
    pixdim3		1.800000
    pixdim4		4.900000
    pixdim5		1.000000
    pixdim6		0.294996
    pixdim7		73966.875000
    vox_offset	352
    cal_max		0.000000
    cal_min		0.000000
    scl_slope	1.000000
    scl_inter	0.000000
    phase_dim	0
    freq_dim	0
    slice_dim	3
    slice_name	alternating_increasing_2
    slice_code	5
    slice_start	0
    slice_end	81
    slice_duration	0.000000
    toffset		0.000000
    intent		Unknown
    intent_code	0
    intent_name	
    intent_p1	0.000000
    intent_p2	0.000000
    intent_p3	0.000000
    qform_name	Scanner Anat
    qform_code	1
    qto_xyz:1	-1.769231 0.000000 -0.000000 119.242340 
    qto_xyz:2	0.000000 1.769231 -0.000000 -103.683487 
    qto_xyz:3	0.000000 0.000000 1.800000 -58.573616 
    qto_xyz:4	0.000000 0.000000 0.000000 1.000000 
    qform_xorient	Right-to-Left
    qform_yorient	Posterior-to-Anterior
    qform_zorient	Inferior-to-Superior
    sform_name	Scanner Anat
    sform_code	1
    sto_xyz:1	-1.769231 0.000000 0.000000 119.242340 
    sto_xyz:2	0.000000 1.769231 0.000000 -103.683487 
    sto_xyz:3	0.000000 0.000000 1.800000 -58.573616 
    sto_xyz:4	0.000000 0.000000 0.000000 1.000000 
    sform_xorient	Right-to-Left
    sform_yorient	Posterior-to-Anterior
    sform_zorient	Inferior-to-Superior
    file_type	NIFTI-1+
    file_code	1
    descrip		TE=70;sec=73966.8750;phaseDir=+;dwell=0.295
    aux_file	

dim?は各次元でのマトリックスサイズを示しており、以下の情報から入力した拡散MRI画像(DWI.nii.gz)は、130 x 130の画像でスライス枚数が82、この画像が129ボリュームで構成される画像、であることが分かる。

    dim1		130
    dim2		130
    dim3		82
    dim4		129

pixdim?はボクセルサイズ(mm)を示しており、この場合、1.769231x 1.769231x 1.800000であることが分かる。

    pixdim1		1.769231
    pixdim2		1.769231
    pixdim3		1.800000

また、sform_?orientは各軸(x/y/z)とMRI画像の向きの対応関係を示している。以下の場合、x軸は左右、y軸は前後、z軸は上下に対応していることが分かる。

画像の向きの詳細については、こちらを参考にするとよい。

    sform_xorient	Right-to-Left
    sform_yorient	Posterior-to-Anterior
    sform_zorient	Inferior-to-Superior

3. MRtrixを用いる場合

3.1. コマンド

MRtrixmrinfoを用いる。

mrinfoのヘルプは、次の通り。

     mrinfo: part of the MRtrix3 package

SYNOPSIS

     Display image header information, or extract specific information from the
     header

USAGE

     mrinfo [ options ] image [ image ... ]

        image        the input image(s).


DESCRIPTION

     By default, all information contained in each image header will be printed
     to the console in a reader-friendly format.

     Alternatively, command-line options may be used to extract specific
     details from the header(s); these are printed to the console in a format
     more appropriate for scripting purposes or piping to file. If multiple
     options and/or images are provided, the requested header fields will be
     printed in the order in which they appear in the help page, with all
     requested details from each input image in sequence printed before the
     next image is processed.

     The command can also write the diffusion gradient table from a single
     input image to file; either in the MRtrix or FSL format (bvecs/bvals file
     pair; includes appropriate diffusion gradient vector reorientation)

     The -dwgrad, -export_* and -shell_* options provide (information about)
     the diffusion weighting gradient table after it has been processed by the
     MRtrix3 back-end (vectors normalised, b-values scaled by the square of the
     vector norm, depending on the -bvalue_scaling option). To see the raw
     gradient table information as stored in the image header, i.e. without
     MRtrix3 back-end processing, use "-property dw_scheme".

     The -bvalue_scaling option controls an aspect of the import of diffusion
     gradient tables. When the input diffusion-weighting direction vectors have
     norms that differ substantially from unity, the b-values will be scaled by
     the square of their corresponding vector norm (this is how multi-shell
     acquisitions are frequently achieved on scanner platforms). However in
     some rare instances, the b-values may be correct, despite the vectors not
     being of unit norm (or conversely, the b-values may need to be rescaled
     even though the vectors are close to unit norm). This option allows the
     user to control this operation and override MRrtix3's automatic detection.

OPTIONS

  -all
     print all properties, rather than the first and last 2 of each.

  -name
     print the file system path of the image

  -format
     image file format

  -ndim
     number of image dimensions

  -size
     image size along each axis

  -spacing
     voxel spacing along each image dimension

  -datatype
     data type used for image data storage

  -strides
     data strides i.e. order and direction of axes data layout

  -offset
     image intensity offset

  -multiplier
     image intensity multiplier

  -transform
     the transformation from image coordinates [mm] to scanner / real world
     coordinates [mm]

Options for exporting image header fields

  -property key  (multiple uses permitted)
     any text properties embedded in the image header under the specified key
     (use 'all' to list all keys found)

  -json_keyval file
     export header key/value entries to a JSON file

  -json_all file
     export all header contents to a JSON file

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.

  -bvalue_scaling mode
     enable or disable scaling of diffusion b-values by the square of the
     corresponding DW gradient norm (see Desciption). Valid choices are yes/no,
     true/false, 0/1 (default: automatic).

DW gradient table export options

  -export_grad_mrtrix path
     export the diffusion-weighted gradient table to file in MRtrix format

  -export_grad_fsl bvecs_path bvals_path
     export the diffusion-weighted gradient table to files in FSL (bvecs /
     bvals) format

  -dwgrad
     the diffusion-weighting gradient table, as interpreted by MRtrix3

  -shell_bvalues
     list the average b-value of each shell

  -shell_sizes
     list the number of volumes in each shell

  -shell_indices
     list the image volumes attributed to each b-value shell

Options for exporting phase-encode tables

  -export_pe_table file
     export phase-encoding table to file

  -export_pe_eddy config indices
     export phase-encoding information to an EDDY-style config / index file
     pair

  -petable
     print the phase encoding table

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.

基本的な使い方は、次の通り。

mrinfo <入力画像(NIfTI)>

3.2. 使用例

拡散MRI画像(DWI.nii.gz)のNIfTIヘッダーをみてみる。

mrinfo DWI.nii.gz 

以下の情報が出力される。
Out:

    ************************************************
    Image name:          "DWI.nii.gz"
    ************************************************
      Dimensions:        130 x 130 x 82 x 129
      Voxel size:        1.76923 x 1.76923 x 1.8 x 4.9
      Data strides:      [ -1 2 3 4 ]
      Format:            NIfTI-1.1 (GZip compressed)
      Data type:         signed 16 bit integer (little endian)
      Intensity scaling: offset = 0, multiplier = 1
      Transform:                    1           0           0        -109
                                   -0           1           0      -103.7
                                   -0           0           1      -58.57
      comments:          TE=70;sec=73966.8750;phaseDir=+;dwell=0.295

以上の情報から、次のことが分かる。

  • マトリックスサイズ (タグ:Dimensions):130 x 130
  • スライス枚数 (タグ:Dimensions):82
  • ボリューム数 (タグ:Dimensions):129
  • ボクセルサイズ (タグ:Voxel size):1.76923 x 1.76923 x 1.8

Print Friendly, PDF & Email

コメントを残す

このサイトはスパムを低減するために Akismet を使っています。コメントデータの処理方法の詳細はこちらをご覧ください