mango.application.cylinder_fit.cylinder_fit

mango.application.cylinder_fit.cylinder_fit(input, numcyl, retcylimg=False, distributedMetricEvaluation=True, metric=None, radius_range_percent=(50.0, 100.0), centre_range_percent=(-8.0, 8.0), metricThreshRelTol=0.25)[source]

Searches for numcyl cylinders in input image which are approximately aligned with the input image z-axis.

Perform exhaustive search over a grid of cylinder radius, centre-x, centre-y values, then uses numerical optimization (scipy.optimize.minimize()) on the best of the exhaustive search results to refine the cylinder fits.

Returns list of cylinder parameters in global/absolute coordinates and in length units of input.md.getVoxelSizeUnit().

Parameters:
  • input (mango.Dds) – Search for cylinder boundaries in the gradient-vector image of this input image.
  • numcyl (mango.Dds) – Number of cylinders to find.
  • retcylimg (bool) – If True, additionally returns a segmented image with the boundary of the cylinder fits labeled from 0 to numcyl-1.
  • distributedMetricEvaluation (bool) – If True, the metric is evaluated in MPI distributed fashion (data parallelism). If False, the entire gradient-vector image is gathered to each MPI process, and task-parallelism is used as the paradigm to parallelise the cylinder fit searching.
  • metric (CylinderFitGradientMetric) – Metric object used to identify cylinder parameters which indicate the presence of a cylindrical boundary in the input image.
  • radius_range_percent (2 or 3 sequence of float) – Indicates the cylinder-radius exhaustive search grid as (min_percent, max_percent, percent_step). This is a percentage of the minimum input.shape component (i.e. numpy.min(input.shape)). If the percent step size is omitted, then a percent equivalent of 2-voxels is chosen as the step-size.
  • centre_range_percent (2 or 3 sequence of float) – Indicates the cylinder-centre exhaustive search grid as (min_percent, max_percent, percent_step). This is a percentage of the minimum input.shape component (i.e. numpy.min(input.shape)). If the percent step size is omitted, then a percent equivalent of 2-voxels is chosen as the step-size.
  • metricThreshRelTol (float) – Relative tolerance for truncating the exhaustive search metric values. Ignore exhaustive search parameters which give metric values that have relative difference greater than metricThreshRelTol of the best (lowest) metric value in the entire search.
Return type:

list of [metricVal, cylinderParameters] pairs

Returns:

List of pairs pairList = [[metricVal0, cylPrms0], [metricVal1, cylPrms1], ...] where cylPrms0=[[centrez0, centrey0, centrex0], radius0, axisLength0, [axisz0, axisy0, axisx0]], cylPrms1=[[centrez1, centrey1, centrex1], radius1, axisLength1, [axisz1, axisy1, axisx1]], etc. If retcylimg is True, additionally returns segmented mango.Dds image labeled with cylinder boundaries (i.e. returns pairList, segDds). The cylinder parameters are global/absolute coordinates and in length units of input.md.getVoxelSizeUnit()

Previous topic

mango.application.cylinder_fit.cylinder_fit_gradient_metric

Next topic

mango.application.cylinder_fit.cylinder_fit_multi_res

This Page