mne_bids.deface_mri#
- mne_bids.deface_mri(image, landmarks, *, offset=-5, theta=15)[source]#
Remove identifying facial detail from an MRI.
This function blacks out MRI voxels anterior to a nearly vertical plane set by the nasion location. Watershed surfaces made using a defaced MRI will also have no identifying facial detail.
- Parameters:
- image
nibabel.spatialimages.SpatialImage Anatomical image as a nibabel object.
- landmarksarray_like
Coordinates (x / y / z) of left pre-auricular, nasion, and right pre-auricular points in MRI (voxel) coordinate space (3x3 list of lists or array with nasion coords in the middle).
- offset
int Controls how close the blackout plane sits to the nasion point in mm (an offset value of 5 will set the blackout plane 5 mm anterior to the nasion, whereas -5 will move the plane posterior to the nasion). Defaults to -5.
- theta
float|int Controls the angle of the blackout plane with respect to vertical (expressed in degrees from 0 to 90). Defaults to 15.
- image
- Returns:
- image
nibabel.spatialimages.SpatialImage Defaced anatomical image as a nibabel object.
- image
- Raises:
TypeErrorIf image input is not an instance of
nibabel.spatialimages.SpatialImage.TypeErrorIf
landmarksare not array-like (list of lists or array).TypeErrorIf
offsetis not an integer.TypeErrorIf
thetais not an int or float.ValueErrorIf
thetais not between 0 and 90 degrees.