HAPPY.crack_path module

class HAPPY.crack_path.My_MCP(costs, offsets=None, fully_connected=True, distance_weight=0)[source]

Bases: skimage.graph._mcp.MCP_Flexible

travel_cost(old_cost, new_cost, offset_length)[source]

This method calculates the travel cost for going from the current node to the next. The default implementation returns new_cost. Overload this method to adapt the behaviour of the algorithm.

HAPPY.crack_path.det_crack_path(thres, crop_threshold, num_runs, kernel_size, distance_weight=0)[source]

Determine possible crack paths in the micrograph.

Parameters
  • thres (array) – thesholded image to look at

  • crop_threshold (array) – calculated during thresholding, array of true and false values

  • num_runs (int) – number of crack paths to determine

  • kernel_size (int) – Once a crack is found, all future paths must be at least kernel_size away from it.

  • distance_weight (float) – Crack paths should follow hydrides but only up to a point: they should also be short. This weight determines how much the “shortness” consideration should count compared to the hydride. Higher weight => shorter paths.

Returns

  • edist (array) – min euclidean distace from the hydride to the matrix

  • path_list – list of possible crack paths

  • cost_list (list) – list of cost values for each crack path