Skip to content

PyPlaque_utils_picks

gh_actions_runner edited this page Aug 1, 2025 · 2 revisions

Functions:

get_strel(neighbourhood)

get_strel Function This function returns structural elements of the defined neighbourhood.

Args: neighbourhood (int, required): Neighbourhood value of 4 or 8.

Returns: np.uint8 array of the structural element.

picks_area(image, neighbourhood=4)

picks_area Function This function calculates the area of Pick's (https://en.wikipedia.org/wiki/Pick%27s_theorem) regions in an image. It estimates the area of Pick's by first calculating the perimeter using morphological operations and then applying a predefined set of weights to estimate the number of pixels that make up the perimeter. The total perimeter is used along with the eroded image to estimate the area, considering both the interior and exterior contributions to the area calculation.

Args: image (np.ndarray, required): A 2D numpy array representing the binary or grayscale image containing Pick's regions. neighbourhood (int, optional): An integer specifying the type of connectivity to use for morphological operations. Use 4 for 4-connectivity or 8 for 8-connectivity. Defaults to 4.

Returns: float: The estimated area of Pick's in the image, calculated as a combination of the number of pixels in the eroded image and the weighted perimeter.

Raises: TypeError: If image is not a 2D numpy array or neighbourhood is not an integer. ValueError: If neighbourhood is not either 4 or 8.

picks_perimeter(image, neighbourhood=4)

picks_perimeter Function This function calculates the total perimeter of Pick's (https://en.wikipedia.org/wiki/Pick%27s_theorem) regions in an image. It identifies and measures the perimeter of Pick's by using morphological operations to detect borders and then computes a weighted sum based on predefined weights for different pixel contributions to the perimeter. It supports both 4-connectivity and 8-connectivity neighborhoods, which are determined by the neighbourhood parameter.

Args: image (np.ndarray, required): A 2D numpy array representing the binary or grayscale image containing Pick's regions. neighbourhood (int, optional): An integer specifying the type of connectivity to use for morphological operations. Use 4 for 4-connectivity or 8 for 8-connectivity. Defaults to 4.

Returns: float: The total perimeter of PICKs in the image, calculated as a weighted sum of pixel contributions based on their neighborhood connectivity and proximity to other boundaries.

Raises: TypeError: If image is not a 2D numpy array or neighbourhood is not an integer. ValueError: If neighbourhood is not either 4 or 8.

Clone this wiki locally