niftynet.evaluation.region_properties module

class RegionProperties(seg, img, measures, num_neighbors=6, threshold=0, pixdim=(1, 1, 1))[source]

Bases: object

This class enables the extraction of image features (Harilick features) and basic statistics over a segmentation

centre_of_mass()[source]

Calculates the centre of mass of the segmentation using the threshold to binarise the initial map

Returns:
volume

this provides a decorator to cache function outputs to avoid repeating some heavy function computations

surface

this provides a decorator to cache function outputs to avoid repeating some heavy function computations

glcm()[source]

Creation of the grey level co-occurrence matrix. The neighbourhood distance is set to 1 in this instance. All neighborhood shifts are calculated for each modality

Returns:multi_mod_glcm list of m (number of modalities) matrices of size bin x bin x neigh
harilick_matrix()[source]

this function populates the matrix of harilick features for each image modality and neighborhood shift and average over the neighbours

Returns:
call_asm()[source]

Extracts the angular second moment features from the harilick matrix of features. Length of the output is the number of modalities

Returns:
call_contrast()[source]

Extracts the contrast feature from the harilick matrix of features

Returns:
call_correlation()[source]

Extracts the correlation feature from the harilick matrix of features

Returns:
call_sum_square()[source]

Extracts the sum square feature from the harilick matrix of features

Returns:
call_sum_average()[source]

Extracts the sum average feature from the harilick matrix of features

Returns:
call_idifferent_moment()[source]

Extracts the inverse difference of moment feature from the harilick matrix of features

Returns:
call_sum_entropy()[source]

Extracts the sum entropy features from the harilick matrix of features

Returns:
call_entropy()[source]

Extracts the entropy features from the harilick matrix of features

Returns:
call_difference_variance()[source]

Extracts the difference variance from the harilick matrix of features

Returns:
call_difference_entropy()[source]

Extracts the difference entropy features from the harilic matrix of features

Returns:
call_sum_variance()[source]

Extracts the difference entropy features from the harilick matrix of features

Returns:
call_imc1()[source]

Extracts the first information measure of correlation from the harilick matrix of features

Returns:
call_imc2()[source]

Extracts the second information measure of correlation from the harilick matrix of features

Returns:
harilick(matrix)[source]

Creates the vector of harilick features for one glcm matrix. Definition of the Harilick features can be found in

Textural features for image classification Robert Harilick K, Shanmugam and Its’Hak Dinstein in IEEE Transactions on systems, man and cybernetics Vol SMC-3 issue 6 pp610-621
Parameters:matrix – glcm matrix on which to calculates the Harilick features
Returns:
angular_second_moment(matrix)[source]

Calculates the angular second moment

Parameters:matrix
Returns:
contrast(matrix)[source]

Calculates the angular second moment

Parameters:matrix
Returns:
homogeneity(matrix)[source]

Calculates the homogeneity over the glcm matrix

Parameters:matrix
Returns:
energy(matrix)[source]

Calculates the energy over the glcm matrix

Parameters:matrix
Returns:
entropy(matrix)[source]

Calculates the entropy over the glcm matrix

Parameters:matrix
Returns:
correlation(matrix)[source]

Calculates the correlation over the glcm matrix

Parameters:matrix
Returns:
inverse_difference_moment(matrix)[source]

Calculates the inverse difference moment over the glcm matrix

Parameters:matrix
Returns:
sum_average(matrix)[source]

Calculates the sum average over the glcm matrix

Parameters:matrix
Returns:
sum_entropy(matrix)[source]

Calculates the sum entropy over the glcm matrix

Parameters:matrix
Returns:
sum_variance(matrix)[source]

Calculates the sum variance over the glcm matrix

Parameters:matrix
Returns:
difference_variance_entropy(matrix)[source]

Calculates the difference of variance entropy over the glcm matrix

Parameters:matrix
Returns:
information_measure_correlation(matrix)[source]

Calculates the two measures of information measure of correlation over the glcm matrix

Parameters:matrix
Returns:ic_1, ic_2
sum_square_variance(matrix)[source]

Calculates the sum of square variance over the glcm matrix

Parameters:matrix
Returns:
sav()[source]

Calculates the Surface area / Volume ratio in terms of Probabilistic Count, Binarised count, Probabilistic Volume, Binarised Volume

Returns:
compactness()[source]

Calculates the compactness S^1.5/V in terms of probabilistic count, binarised count, probabilistic volume, binarised volume

Returns:
min_()[source]

Calculates the minimum of the image over the segmentation

Returns:
max_()[source]

Calculates the maximum of the image over the segmentation

Returns:
weighted_mean_()[source]

Calculates the weighted mean of the image given the probabilistic segmentation. If binary, mean and weighted mean will give the same result

Returns:
mean_()[source]

Calculates the mean of the image over the segmentation

Returns:
skewness_()[source]

Calculates the skewness of the image over the binarised segmentation

Returns:
std_()[source]

calculates the standard deviation of the image over the binarised segmentation

Returns:
kurtosis_()[source]

calculates the kurtosis of the image over the binarised segmentation

Returns:
median_()[source]

calculates the median of the image over the binarised segmentation

Returns:
quantile_25()[source]

calculates the first quartile of the image over the binarised segmentation

Returns:
quantile_75()[source]

calculates the third quartile of the image over the binarised segmentation

Returns:
header_str()[source]

creates the header string to be output as part of the result report

Returns:
to_string(fmt='{:4f}')[source]

transforms the result dictionary into a string according to a specified format to be written on the result report

Parameters:fmt – Format under which the result will be written e.g ‘{:4f}’
Returns: