where r means the radius of the fitted circle of dark pixels around
the bright interior of the particle. Returns None on failure.
if not isinstance(coords_df, pd.core.series.Series) or len(coords_df) != 2:
raise ValueError("Refine brightfield ring only supports a Series" +
" of 1 particle with values x, y")
if pos_columns is None:
pos_columns = guess_pos_columns(coords_df)
radius = validate_tuple(radius, image.ndim)
if pos_columns is None:
pos_columns = default_pos_columns(image.ndim)
columns = pos_columns + ["r"]
r = radius[0]
refined_r, refined_x, refined_y = _refine_brightfield_ring(image, r,
coords_df)
if refined_r is None or refined_y is None or refined_x is None:
return None
coords_df["x"] = refined_x
coords_df["y"] = refined_y
coords_df["r"] = refined_r
return coords_df
def _refine_brightfield_ring(image, radius, coords_df, threshold=0.5,