medpy.features.intensity.hemispheric_difference#

medpy.features.intensity.hemispheric_difference(image, sigma_active=7, sigma_reference=7, cut_plane=0, voxelspacing=None, mask=slice(None, None, None))[source]#

Computes the hemispheric intensity difference between the brain hemispheres of an brain image.

Cuts the image along the middle of the supplied cut-plane. This results in two images, each containing one of the brains hemispheres.

For each of these two, the following steps are applied:

  1. One image is marked as active image

  2. The other hemisphere image is marked as reference image

  3. The reference image is fliped along the cut_plane

  4. A gaussian smoothing is applied to the active image with the supplied sigma

  5. A gaussian smoothing is applied to the reference image with the supplied sigma

  6. The reference image is substracted from the active image, resulting in the difference image for the active hemisphere

Finally, the two resulting difference images are stitched back together, forming a hemispheric difference image of the same size as the original.

Note that the supplied gaussian kernel sizes (sigmas) are sensitive to the images voxel spacing.

If the number of slices along the cut-plane is odd, the central slice is interpolated from the two hemisphere difference images when stitching them back together.

Parameters:
imagearray_like or list/tuple of array_like

A single image or a list/tuple of images (for multi-spectral case).

sigma_activenumber or sequence of numbers

Standard deviation for Gaussian kernel of the active image. The standard deviations of the Gaussian filter are given for each axis as a sequence, or as a single number, in which case it is equal for all axes. Note that the voxel spacing of the image is taken into account, the given values are treated as mm.

sigma_referencenumber or sequence of numbers

Standard deviation for Gaussian kernel of the reference image. The standard deviations of the Gaussian filter are given for each axis as a sequence, or as a single number, in which case it is equal for all axes. Note that the voxel spacing of the image is taken into account, the given values are treated as mm.

cut_planeinteger

he axes along which to cut. This is usually the coronal plane.

voxelspacingsequence of floats

The side-length of each voxel.

maskarray_like

A binary mask for the image.

Returns:
hemispheric_differencendarray

The intensity differences between the locally smoothed hemispheres of the image. The resulting voxel value’s magnitude denotes symmetrical its asymmetry. The direction is revealed by the sign. That means that the resulting image will be symmetric in absolute values, but differ in sign.

Raises:
ArgumentError

If the supplied cut-plane dimension is invalid.