前言
诸如扫描仪中的患者位置,扫描仪本身以及许多未知问题等因素可导致MR图像上的亮度差异。 换句话说,强度值(从黑色到白色)可以在同一组织内变化。 这被称为偏置场。 这是一种低频平滑的不良信号,会破坏MR图像。 偏置场导致MRI机器的磁场中的不均匀性。 如果未校正偏置字段将导致所有成像处理算法(例如,分段(例如,Freesurfer)和分类)输出不正确的结果。 在进行分割或分类之前,需要预处理步骤来校正偏置场的影响。
如下图所示:
安装ANT并添加路径
如果要使用该程序,则需要设置环境变量:
$ export ANTSPATH=/usr/local/antsbin/bin/
$ PATH=${ANTSPATH}:${PATH}
有关N4BiasFieldCorrection函数
要运行该程序,您应该能够键入新的终端窗口以查看可用选项:
$ N4BiasFieldCorrection --help
COMMAND:
N4BiasFieldCorrection
N4 is a variant of the popular N3 (nonparameteric nonuniform normalization)
retrospective bias correction algorithm. Based on the assumption that the
corruption of the low frequency bias field can be modeled as a convolution of
the intensity histogram by a Gaussian, the basic algorithmic protocol is to
iterate between deconvolving the intensity histogram by a Gaussian, remapping
the intensities, and then spatially smoothing this result by a B-spline modeling
of the bias field itself. The modifications from and improvements obtained over
the original N3 algorithm are described in the following paper: N. Tustison et
al., N4ITK: Improved N3 Bias Correction, IEEE Transactions on Medical Imaging,
29(6):1310-1320, June 2010.
OPTIONS:
-d, --image-dimensionality 2/3/4
This option forces the image to be treated as a specified-dimensional image. If
not specified, N4 tries to infer the dimensionality from the input image.
-i, --input-image inputImageFilename
A scalar image is expected as input for bias correction. Since N4 log transforms
the intensities, negative values or values close to zero should be processed
prior to correction.
-x, --mask-image maskImageFilename
If a mask image is specified, the final bias correction is only performed in the
mask region. If a weight image is not specified, only intensity values inside
the masked region are used during the execution of the algorithm. If a weight
image is specified, only the non-zero weights are used in the execution of the
algorithm although the mask region defines where bias correction is performed in
the final output. Otherwise bias correction occurs over the entire image domain.
See also the option description for the weight image.
-w, --weight-image weightImageFilename
The weight image allows the user to perform a relative weighting of specific
voxels during the B-spline fitting. For example, some studies have shown that N3
performed on white matter segmentations improves performance. If one has a
spatial probability map of the white matter, one can use this map to weight the
b-spline fitting towards those voxels which are more probabilistically
classified as white matter. See also the option description for the mask image.
-s, --shrink-factor 1/2/3/4/...
Running N4 on large images can be time consuming. To lessen computation time,
the input image can be resampled. The shrink factor, specified as a single
integer, describes this resampling. Shrink factors <= 4 are commonly used.
-c, --convergence [<numberOfIterations=50x50x50x50>,<convergenceThreshold=0.0>]
Convergence is determined by calculating the coefficient of variation between
subsequent iterations. When this value is less than the specified threshold from
the previous iteration or the maximum number of iterations is exceeded the
program terminates. Multiple resolutions can be specified by using 'x' between
the number of iterations at each resolution, e.g. 100x50x50.
-b, --bspline-fitting [splineDistance,<splineOrder=3>]
[initialMeshResolution,<splineOrder=3>]
These options describe the b-spline fitting parameters. The initial b-spline
mesh at the coarsest resolution is specified either as the number of elements in
each dimension, e.g. 2x2x3 for 3-D images, or it can be specified as a single
scalar parameter which describes the isotropic sizing of the mesh elements. The
latter option is typically preferred. For each subsequent level, the spline
distance decreases in half, or equivalently, the number of mesh elements doubles
Cubic splines (order = 3) are typically used.
-t, --histogram-sharpening [<FWHM=0.15>,<wienerNoise=0.01>,<numberOfHistogramBins=200>]
These options describe the histogram sharpening parameters, i.e. the
deconvolution step parameters described in the original N3 algorithm. The
default values have been shown to work fairly well.
-o, --output correctedImage
[correctedImage,<biasField>]
The output consists of the bias corrected version of the input image.
Optionally, one can also output the estimated bias field.
-h
Print the help menu (short version).
--help
Print the help menu.
<VALUES>: 1
## 偏执矫正
校正偏置字段在计算机上可能是耗时的。 减轻计算机处理时间的一种方法是在同一图像上多次运行程序,从非常粗略开始并更精细地移动:
$ N4BiasFieldCorrection -d 3 -i ~/preprocessing-t1-example/1222_032309/acpc.nii -o ~/preprocessing-t1-example/1222_032309/n4.nii.gz -s 8 -b [200] -c [50x50x50x50,0.000001]
$ N4BiasFieldCorrection -d 3 -i ~/preprocessing-t1-example/1222_032309/n4.nii.gz -o ~/preprocessing-t1-example/1222_032309/n4.nii.gz -s 4 -b [200] -c [50x50x50x50,0.000001]
$ N4BiasFieldCorrection -d 3 -i ~/preprocessing-t1-example/1222_032309/n4.nii.gz -o ~/preprocessing-t1-example/1222_032309/n4.nii.gz -s 2 -b [200] -c [50x50x50x50,0.000001]
Note
这是我使用NIfTI文件转换为压缩NIfTI(.nii.gz)文件的第一步。 展望未来,一些管道并不总是接受NIfTI格式并要求压缩NIfTI(.nii.gz)。 虽然情况并非总是如此,但使用压缩的NIfTI格式已成为解决方案。
案例展示1
使用N4偏置场校正(B)和基于高斯滤波器的方法(C)对原始图像(A)进行不均匀性校正的示例。 底行显示了它们的强度直方图。 白色箭头显示热点的中心。 黑色箭头显示WM信号(左)和GM和福尔马林信号(右)。 请注意,面板(B和C)中的高边界信号是N4算法的已知效果,但是,在进一步图像处理之前,这些边界被移除。