tumourkit.utils.preprocessing.get_centroid_by_id
- tumourkit.utils.preprocessing.get_centroid_by_id(img: ndarray, idx: int) Tuple[int, int]
Given an image and an id representing a component, returns the centroid of the component as a tuple (x, y).
- Parameters:
img (np.ndarray) – A NumPy array representing the image.
idx (int) – An integer representing the id of the component.
- Returns:
A tuple representing the centroid of the component.
- Return type:
Tuple[int, int]
If there are no pixels with the given id in the image, it returns (-1, -1).