recon_surf.N4_bias_correct¶
- recon_surf.N4_bias_correct.get_brain_centroid(itk_mask)[source]¶
Get the brain centroid from a binary image.
- Parameters:
- itk_mask
sitk.Image
Binary image to compute the centroid of its labeled region.
- itk_mask
- Returns:
np.ndarray
Brain centroid.
- recon_surf.N4_bias_correct.get_image_mean(image, mask=None)[source]¶
Get the mean of a sitk Image.
- Parameters:
- image
sitk.Image
Image to get mean of.
- mask
sitk.Image
,optional
Optional mask to apply first.
- image
- Returns:
- mean
float
The mean value of the image.
- mean
- recon_surf.N4_bias_correct.get_tal_origin_voxel(tal, image)[source]¶
Get the origin of Talairach space in voxel coordinates.
- Parameters:
- tal
npt.ArrayLike
Talairach transform matrix.
- image
sitk.Image
Image.
- tal
- Returns:
- vox_origin
np.ndarray
Voxel coordinate of Talairach origin.
- vox_origin
- recon_surf.N4_bias_correct.itk_n4_bfcorrection(itk_image, itk_mask=None, shrink=4, levels=4, numiter=50, thres=0.0)[source]¶
Perform the bias field correction.
- Parameters:
- itk_image
sitk.Image
N-dimensional image.
- itk_mask
Optional
[sitk.Image
] Image mask. Defaults to None. Optional.
- shrink
int
Shrink factors. Defaults to 4.
- levels
int
Number of levels for maximum number of iterations. Defaults to 4.
- numiter
int
Maximum number if iterations. Defaults 50.
- thres
float
Convergence threshold. Defaults to 0.0.
- itk_image
- Returns:
itk_bfcorr_image
Bias field corrected image.
- recon_surf.N4_bias_correct.normalize_img(itk_image, itk_mask, source_intensity, target_intensity)[source]¶
Normalize image by source and target intensity values.
- Parameters:
- Returns:
sitk.Image
Rescaled image.
- recon_surf.N4_bias_correct.normalize_wm_aseg(itk_image, itk_mask, itk_aseg, target_wm=110.0, target_bg=3.0)[source]¶
Normalize WM image so the white matter has a mean intensity of target_wm and the background has intensity target_bg.
- Parameters:
- itk_image
sitk.Image
N-dimensional itk image.
- itk_mask
sitk.Image
|None
Image mask.
- itk_aseg
sitk.Image
Aseg-like segmentation image to find WM.
- radius
float
,int
, default=50 Radius of ball around centroid. Defaults to 50.
- centroid
np.ndarray
,optional
Image centroid. Defaults to None.
- target_wm
float
|int
Target white matter intensity. Defaults to 110.
- target_bg
float
|int
Target background intensity Defaults to 3 (1% of 255).
- itk_image
- Returns:
- normed
sitk.Image
Normalized WM image.
- normed
- recon_surf.N4_bias_correct.normalize_wm_mask_ball(itk_image, itk_mask=None, radius=50.0, centroid=None, target_wm=110.0, target_bg=3.0)[source]¶
Normalize WM image by Mask and optionally ball around talairach center.
- Parameters:
- itk_image
sitk.Image
N-dimensional itk image.
- itk_mask
sitk.Image
,optional
Image mask.
- radius
float
,int
, default=50 Radius of ball around centroid. Defaults to 50.
- centroid
np.ndarray
Brain centroid.
- target_wm
float
|int
Target white matter intensity. Defaults to 110.
- target_bg
float
|int
Target background intensity. Defaults to 3 (1% of 255).
- itk_image
- Returns:
- normalized_image
sitk.Image
Normalized WM image.
- normalized_image
- recon_surf.N4_bias_correct.options_parse()[source]¶
Command line option parser.
- Returns:
options
Namespace object holding options.
- recon_surf.N4_bias_correct.read_talairach_xfm(fname)[source]¶
Read Talairach transform.
- Parameters:
- fname
str
Filename to Talairach transform.
- fname
- Returns:
tal
Talairach transform matrix.
- Raises:
ValueError
if the file is of an invalid format.