deeptrack.extras.radialcenter Module#
Radial center calculation.
This module provides a robust implementation of the radial symmetry center estimator introduced by Parthasarathy (2011-2012).
The estimator computes local intensity gradients on a half-pixel grid and solves a weighted least-squares problem to find the point that best matches radial symmetry.
Key Features#
Gradient-Based Least-Squares Estimation
Uses intensity gradients evaluated on a half-pixel grid and solves a weighted least-squares system to estimate the center.
Numerical Safeguards
Handles common degeneracies (e.g., constant images, singular systems) by returning nan coordinates instead of raising obscure runtime errors.
Optional Coordinate Swapping
Can swap the returned (x, y) coordinate order for convenience.
Module Structure#
Functions:
radialcenter(I, invert_xy) -> tuple[float, float]
Estimates the center of radial symmetry of a 2D intensity distribution.
Examples#
>>> from deeptrack.extras.radialcenter import radialcenter
Estimate the center of a 2D Gaussian:
>>> import numpy as np
>>>
>>> lin = np.linspace(-10, 10, 101)
>>> xg, yg = np.meshgrid(lin, lin, indexing="xy")
>>> img = np.exp(-0.5 * (xg**2 + yg**2))
>>>
>>> x, y = radialcenter(img)
>>> (round(x, 3), round(y, 3))
(50.0, 50.0)
References#
Raghuveer Parthasarathy, University of Oregon (2011–2012).
Python implementation by Benjamin Midtvedt, University of Gothenburg (2020).
License#
GNU General Public License v3 or later (GPL-3.0-or-later), per the original distribution by Parthasarathy.
Functions#
|
Calculate the center of a 2D intensity distribution. |