ImageThresholder

Class to threshold an image and plot necessary figures related to thresholding

class munge.ImageThresholder.ImageThresholder(data_element, n_components=2, method='gmm', postprocess=False)

Bases: object

ImageThresholder class can be instantiated with the following args

  • parameters, types, return and return types:
Parameters:
  • data_element – Instance of DataElement class
  • n_components – Number of components to the model fit
dilate(thresholded_img)

Performs binary dilation on the given image using a disk-shaped structural element of arbitrary radius 3.

Parameters:thresholded_img – thresholded image
Returns:dilated image
get_jaccard_coeff()

Gets the jaccard similarity co-efficient of the reference and the detected region

Returns:jaccard coefficient
get_thresholded_contour_mask()

Thresholds the o-contour region and returns a mask

Returns:Boolean mask containing the thresholded image
plot_model_fit(filename=None)

Plots the histogram of the o-contour region with the gaussians that were used to fit the model and the selected threshold value

Parameters:filename – File path to save the plot
plot_thresholding_result(filename=None)

Plots the thresholded region along with the ground truth region overlaid in different colors

Parameters:filename – File path to save the plot