phathom.segmentation package

Submodules

phathom.segmentation.graphcuts module

phathom.segmentation.graphcuts.add_constant_edges(g, node_ids, weight)
phathom.segmentation.graphcuts.add_gradient_edges(g, node_ids, data, B, w0)
phathom.segmentation.graphcuts.add_terminal_edges(g, node_ids, obj_weights, back_weights)
phathom.segmentation.graphcuts.create_new_graph(shape, use_ints=False)
phathom.segmentation.graphcuts.entropy(back_mu, obj_mu, T, nb_levels=256)
phathom.segmentation.graphcuts.find_nearest_T(T_target, Ts)
phathom.segmentation.graphcuts.fit_poisson_mixture(hist_output, T)
phathom.segmentation.graphcuts.get_nb_bins(dtype)
phathom.segmentation.graphcuts.gradient_penalty_lut(data)
phathom.segmentation.graphcuts.graph_cuts(data, back_mu, obj_mu, w_const=0, w_grad=0)

Segments a 3D image using graph cuts

Parameters:
  • data (ndarray) – 3D array of integers to segment
  • back_mu (float) – mean level of the background
  • obj_mu (float) – mean level of the foreground / object
  • w_const (float, optional) – weight to penalize between all adjacent nodes. Default, 0
  • w_grad (float, optional) – weight to penalize between regions with weak edges. Default, 0
Returns:

sgm – 3D array of the segmentation

Return type:

ndarray

phathom.segmentation.graphcuts.hist(data, bins=None, _range=None)
phathom.segmentation.graphcuts.histogram_penalty(x, mu_star)
phathom.segmentation.graphcuts.histogram_penalty_lut(dtype, mu)
phathom.segmentation.graphcuts.information_gain(p)
phathom.segmentation.graphcuts.max_entropy(hist_output, dtype)
phathom.segmentation.graphcuts.parallel_graph_cuts(arr, out_arr, overlap, chunks, nb_workers=None, **kwargs)

Perform graph cuts segmentation in parallel with overlapping chunks

Parameters:
  • arr (array-like or SharedMemory) – reference to Zarr or SharedMemory array to segment
  • out_arr (array-like or SharedMemory) – reference to Zarr or SharedMemory array to write segmentation result to
  • overlap (int) – number of pixels to overlap adjacent chunks
  • chunks (tuple) – shape of each chunk to be segmented (not including the overlap)
  • nb_workers (int, optional) – number of workers to use. Default, cpu_count
  • kwargs (dict) – dictionary of arguments to pass to graph_cuts
phathom.segmentation.graphcuts.poisson_pdf(x, mu)

phathom.segmentation.partition module

phathom.segmentation.segmentation module

Module contents