pyBIA.image_moments =================== .. py:module:: pyBIA.image_moments Functions --------- .. autoapisummary:: pyBIA.image_moments.make_moments_table pyBIA.image_moments.calculate_moments pyBIA.image_moments.calculate_central_moments pyBIA.image_moments.calculate_geometrically_centered_moments pyBIA.image_moments.calculate_hu_moments pyBIA.image_moments.calculate_legendre_moments pyBIA.image_moments.zernike_radial_polynomial pyBIA.image_moments.calculate_zernike_moments Module Contents --------------- .. py:function:: make_moments_table(image: numpy.ndarray) -> astropy.table.Table Compute a full set of image moments and return as an Astropy Table. This function computes raw moments, central moments, Hu moments, geometrically centered polynomial moments, and Legendre moments. It is the main feature-generation function used in pyBIA to build morphology catalogs. :param image: 2D array representing a greyscale image. :type image: ndarray :returns: A table with 47 features including raw, central, geometrically centered, Hu, and Legendre moments. :rtype: astropy.table.Table .. py:function:: calculate_moments(image: numpy.ndarray, x: numpy.ndarray = None, y: numpy.ndarray = None, m00: float = None) -> list Compute raw spatial moments up to 3rd order. :param image: 2D array representing a greyscale image. :type image: ndarray :returns: Raw moments [m00, m10, m01, ..., m03]. :rtype: list of float .. py:function:: calculate_central_moments(image: numpy.ndarray, x: numpy.ndarray = None, y: numpy.ndarray = None, m00: float = None) -> list Compute central moments up to 3rd order. :param image: 2D array representing a greyscale image. :type image: ndarray :returns: Central moments [mu00, mu10, ..., mu03]. :rtype: list of float .. py:function:: calculate_geometrically_centered_moments(image: numpy.ndarray, max_order: int = 3, x: numpy.ndarray = None, y: numpy.ndarray = None) -> list Compute raw polynomial moments centered on the geometric center of the image grid. :param image: 2D array representing a greyscale image. :type image: ndarray :param max_order: Maximum total order of the moments (default is 3). :type max_order: int, optional :returns: Polynomial moments of the form sum(x^p * y^q * image(x,y)) for p+q ≤ max_order, where (x, y) are pixel coordinates shifted so that (0,0) is the geometric center of the image. :rtype: list of float .. py:function:: calculate_hu_moments(image: numpy.ndarray, central_moments=None) -> list Compute Hu moments using classical eta-normalization. :param image: 2D array representing a greyscale image. :type image: ndarray :param central_moments: Precomputed central moments to third order (10 total: [mu00, mu10, ..., mu03]). If not provided, they will be computed from the image. :type central_moments: list of float, optional :returns: Classical Hu moments [hu1, ..., hu7] using eta(p,q) invariants. :rtype: list of float .. py:function:: calculate_legendre_moments(image: numpy.ndarray, max_order: int = 3) -> list[float] Compute 2D Legendre moments L_nm for n + m ≤ max_order using orthonormal basis. :param image: 2D array representing a greyscale image. :type image: ndarray :param max_order: Maximum total order (n + m) of Legendre moments to compute. :type max_order: int :returns: Legendre moments up to n+m ≤ max_order. :rtype: list of float .. py:function:: zernike_radial_polynomial(n: int, m: int, r: numpy.ndarray) -> numpy.ndarray Compute the Zernike radial polynomial R_n^m(r). .. py:function:: calculate_zernike_moments(image: numpy.ndarray, max_order: int = 3, x: numpy.ndarray = None, y: numpy.ndarray = None) -> list Compute the magnitudes of Zernike moments up to a given order. Zernike moments are evaluated on a unit disk and their magnitudes are rotationally invariant. :param image: 2D array representing a greyscale image. :type image: ndarray :param max_order: Maximum radial order (n) of the moments (default is 3). :type max_order: int, optional :param x: Precomputed coordinate grids. :type x: ndarray, optional :param y: Precomputed coordinate grids. :type y: ndarray, optional :returns: Magnitudes of Zernike moments |Z_nm| for valid (n, m) pairs where n <= max_order. :rtype: list of float