PREDICT.imagefeatures package

Submodules

PREDICT.imagefeatures.coliage_features module

PREDICT.imagefeatures.coliage_features.get_coliage_features(image, mask)

Compute coliage features, based on:

Prasanna et al. 2016, Co-occurrence of Local Anisotropic Gradient Orientations (CoLlAGe): A new radiomics descriptor, Nature Scientific Reports.

PREDICT.imagefeatures.contour_functions module

PREDICT.imagefeatures.contour_functions.cmp(a, b)

Built in in python 2, but defined for python 3

PREDICT.imagefeatures.contour_functions.convex_hull(contour)

Returns points on convex hull for contour, uses Graham Scan

PREDICT.imagefeatures.contour_functions.convex_hull_points(points)

Returns points on convex hull of an array of points in CCW order. Uses Graham Scan

PREDICT.imagefeatures.contour_functions.get_contour_boundary(contour)

Labels pixels on edge of boundary

PREDICT.imagefeatures.contour_functions.get_contour_boundary_points(contour)

Get boundary coordinates from contour

PREDICT.imagefeatures.contour_functions.get_not_voi_voxels(contour, image)

Sets all voxels within VOI to 0

PREDICT.imagefeatures.contour_functions.get_smooth_contour(mask, N_min, N_max)

Find local convex hull for given contour

PREDICT.imagefeatures.contour_functions.get_voi_voxels(contour, image)

Gives back VOI (non-zero slices), and indices of slices

PREDICT.imagefeatures.contour_functions.local_convex_hull(contour, N_min, N_max)

Find local convex hull for given contour

PREDICT.imagefeatures.contour_functions.local_convex_hull_points(points, N_min, N_max)

Find local convex points, can be used for smoothing boundary

PREDICT.imagefeatures.contour_functions.sort_points(points)

Order supplied points in clockwise order

PREDICT.imagefeatures.contour_functions.turn(p, q, r)

PREDICT.imagefeatures.dti_features module

PREDICT.imagefeatures.dti_features.get_dti_features(image, mask, meta_data)
PREDICT.imagefeatures.dti_features.get_dti_post_features(image, mask, meta_data)
PREDICT.imagefeatures.dti_features.get_statistical_moments(tumor_map)

PREDICT.imagefeatures.get_features module

PREDICT.imagefeatures.get_features.get_image_features(image_data, mask, parameters, config=None, config_general=None, output=None)

Calculate features from a ROI of an image.

image_data: Pandas DataFrame or dictionary, mandatory

Contains the image, image type, metadata and semantics for the feature extraction. These have to be indexed by these keys.

Should either be a Pandas DataFrame, in which the image type is he key of the images, or a dictionary, in which image type is a a separate field.

The image should be a SimpleITK Image, the image type a string, the metadata a pydicom dicom type and the semantics a dictionary.

mask: ITK Image, mandatory
ROI to be used for feature extraction.
parameters: dictionary, mandatory,
Parameters for feature calculation. See the Github Wiki for the possible fields and their description.
config: dictionary, mandatory
Configuration for feature calculation. Mostly configures which features are calculated or not. See the Github Wiki for the possible fields and their description.
config_general: dictionary, mandatory
Configuration for general settings. Currently only configures settings for the Joblib Parallel function. See the Github Wiki for the possible fields and their description.
output: string, mandatory
path referring to the .hdf5 file to which the output should be written for the CalcFeatures function. This field is used to match the patient ID of the semantic features to this filename.
feature_values: list
Contains the values for all extracted features.
feature_labels: list
Contains the labels for all extracted features. Each entry corresponds to the element with the same index from the feature_values object.

PREDICT.imagefeatures.histogram_features module

PREDICT.imagefeatures.histogram_features.create_histogram(data, bins)
PREDICT.imagefeatures.histogram_features.get_diff_in_out(image, contour)
PREDICT.imagefeatures.histogram_features.get_energy(data)
PREDICT.imagefeatures.histogram_features.get_entropy(hist)
PREDICT.imagefeatures.histogram_features.get_histogram_features(data, N_bins)

Compute histogram or first order features.

data: numpy array, mandatory
1D array from which the features are extracted.
N_bins: integer, mandatory
Number of bins to be used in histogram creation.
histogram_features: list
Contains the values for all extracted features.
histogram_labels: list
Contains the labels for all extracted features. Each entry corresponds to the element with the same index from the histogram_features object.
PREDICT.imagefeatures.histogram_features.get_kurtosis(data)
PREDICT.imagefeatures.histogram_features.get_max(data)
PREDICT.imagefeatures.histogram_features.get_mean(data)
PREDICT.imagefeatures.histogram_features.get_median(data)
PREDICT.imagefeatures.histogram_features.get_min(data)
PREDICT.imagefeatures.histogram_features.get_peak_position(histogram, bins)
PREDICT.imagefeatures.histogram_features.get_quartile_range(data)
PREDICT.imagefeatures.histogram_features.get_range(data)
PREDICT.imagefeatures.histogram_features.get_skewness(data)
PREDICT.imagefeatures.histogram_features.get_std(data)

PREDICT.imagefeatures.image_helper module

PREDICT.imagefeatures.image_helper.get_masked_slices_image(image_array, mask_array)
PREDICT.imagefeatures.image_helper.get_masked_slices_mask(mask_image)
PREDICT.imagefeatures.image_helper.get_masked_voxels(image_array, mask_array)

PREDICT.imagefeatures.log_features module

PREDICT.imagefeatures.log_features.get_log_features(image, mask, parameters={})

Compute features by filtering an image with a Laplacian of Gaussian (LoG) filter, after which histogram features are extracted.

image: numpy array, mandatory
Image array from which the features are extracted.
mask: numpy array, mandatory
ROI to be used for feature extraction.
parameters: dictionary, optional
Contains the parameters for feature computation. Currently can only include a list of sigma values to be used for the LoG filter. Default values for sigma are [1, 5, 10].
LoG_features: list
Contains the values for all extracted features.
LoG_labels: list
Contains the labels for all extracted features. Each entry corresponds to the element with the same index from the LoG_features object.

PREDICT.imagefeatures.orientation_features module

PREDICT.imagefeatures.orientation_features.get_orientation_features(mask)

PREDICT.imagefeatures.patient_features module

PREDICT.imagefeatures.patient_features.get_patient_features(metadata, image_type, protocol_feat=False)

PREDICT.imagefeatures.phase_features module

PREDICT.imagefeatures.phase_features.get_phase_features(image, mask, parameters={})
PREDICT.imagefeatures.phase_features.replacenan(x)

PREDICT.imagefeatures.semantic_features module

PREDICT.imagefeatures.semantic_features.get_semantic_features(data, patientID)

PREDICT.imagefeatures.shape_features module

PREDICT.imagefeatures.shape_features.compute_abs_dist_to_center(points)

Computes the absolute distance to center for given boundary points

PREDICT.imagefeatures.shape_features.compute_area(points)

Computes the area of the given boundary points using shoelace formula

PREDICT.imagefeatures.shape_features.compute_compactness(points)

Computes compactness of the given boundary points, 1 for circle

PREDICT.imagefeatures.shape_features.compute_covariance_matrix(points)

Computes covariance matrix for giving boundary points, according to Peura et al. 1997, “Efficiency of Simple Shape Descriptors”

PREDICT.imagefeatures.shape_features.compute_cvar(points)

Computes circular variance for giving boundary points, according to Peura et al. 1997, “Efficiency of Simple Shape Descriptors”

PREDICT.imagefeatures.shape_features.compute_dist_to_center(points)

Computes the distance to the center for the given boundary points

PREDICT.imagefeatures.shape_features.compute_evar(points)

Computes eliptic variance for giving boundary points, according to Peura et al. 1997, “Efficiency of Simple Shape Descriptors”

PREDICT.imagefeatures.shape_features.compute_mean_radius(points)

Computes mean radius for giving boundary points, according to Peura et al. 1997, “Efficiency of Simple Shape Descriptors”

PREDICT.imagefeatures.shape_features.compute_perimeter(points)

Computes the perimeter of the given boundary points

PREDICT.imagefeatures.shape_features.compute_prax(points)

Computes ratio of principal axes for giving boundary points, according to Peura et al. 1997, “Efficiency of Simple Shape Descriptors”

PREDICT.imagefeatures.shape_features.compute_radial_distance(points)

Computes the radial distance for the given boundary points, according to Xu et al 2012, “A comprehensive descriptor of shape”

PREDICT.imagefeatures.shape_features.compute_roughness(points, rad_distance=None, min_points=3, max_points=15)

compute_roughness computes the roughness according to “Xu et al. 2012, A comprehensive descriptor of shape”

Args:
points ([Nx2] numpy array): array of boundary points
Kwargs:
rad_distance (numpy array): Radial distance if already computed
[default: None]
min_points (int): Minimum number of points in a segment
[default: 3]
max_points (int): Maximum number of points in a segment
[default: 15]
Returns:
roughness (numpy array): The roughness in the different segments roughness_avg (float): The average roughness
PREDICT.imagefeatures.shape_features.get_center(points)

Computes the center of the given boundary points

PREDICT.imagefeatures.shape_features.get_shape_features(mask, metadata=None, mode='2D')

Compute all shape features on a mask. Returns two lists: the feature values and the feature labels.

PREDICT.imagefeatures.shape_features.get_shape_features_2D(mask_ITKim, metadata=None)
PREDICT.imagefeatures.shape_features.get_shape_features_3D(mask_ITKim, metadata=None)

PREDICT.imagefeatures.sitk_helper module

PREDICT.imagefeatures.sitk_helper.GetArrayFromImage(image)

GetArrayFromImage converts an ITK image to a numpy array, while ensuring the orientation is kept the same.

Args:
image (ITK image): 2D or 3D ITK image
Returns:
numpy array
PREDICT.imagefeatures.sitk_helper.GetImageFromArray(array)

GetImageFromArray converts a numpy array to an ITK image, while ensuring the orientation is kept the same.

Args:
array (numpy array): 2D or 3D array of image
Returns:
ITK image

PREDICT.imagefeatures.texture_features module

PREDICT.imagefeatures.texture_features.bbox_2D(img, mask)
PREDICT.imagefeatures.texture_features.bbox_3D(img, mask)
PREDICT.imagefeatures.texture_features.gabor_filter(image, mask, kernel)

Filter an image with a Gabor kernel. The kernel should be a list containing the frequency and the angle. After filtering, the image is flattened and masked by the mask.

PREDICT.imagefeatures.texture_features.gabor_filter_parallel(image, mask, parameters={}, n_jobs=1, backend='threading')

Apply gabor filters to image, done in parallel. Note: on a cluster, where parallelisation of the gabor filters is not possible, use backend=”threading”

PREDICT.imagefeatures.texture_features.get_GLCM_features(image, mask, parameters={})

Compute Gray Level Co-occurence Matrix (GLCM) features. The image is first discretized to a set number of greyscale values. The GLCM will be computed at multiple distances and angles. The pixels outside the mask will always be set to zero.

As the GLCM is defined in 2D, the GLCM for a 3D image will be computed by computing statistics over all the GLCM for all 2D axial slices, such as the mean and std.

The output are two lists: the feature values and the labels.

PREDICT.imagefeatures.texture_features.get_GLCM_features_multislice(image, mask, parameters={})
PREDICT.imagefeatures.texture_features.get_GLRLM_features(image, mask)
PREDICT.imagefeatures.texture_features.get_GLSZM_features(image, mask)
PREDICT.imagefeatures.texture_features.get_LBP_features(image, mask, parameters={})

Compute features by applying a Local Binary Pattern (LBP) filter to an image. The LBP will be constructed with a radius and neighboorhood defined by N_points. These must be provided as lists of integers.

As LBP are defined in 2D, the LBP for a 3D image will be computed by computing statistics over all the LBP for all 2D axial slices, such as the mean and std.

The output are two lists: the feature values and the labels.

PREDICT.imagefeatures.texture_features.get_NGTDM_features(image, mask)
PREDICT.imagefeatures.texture_features.get_texture_features(image, mask, parameters=None, config='LBP', config_general={})

PREDICT.imagefeatures.vessel_features module

PREDICT.imagefeatures.vessel_features.get_vessel_features(image, mask, parameters={})

Module contents