Pixelflow is a tool for extracting information about the characteristics of objects in images. Segmentation models can be used to identify objects, but researchers typically then want to obtain more details about these objects, e.g. their number, size, shape etc. Pixelflow aims to simplify this process, working with a mask from 2D or 3D images and outputting a dataframe of the desired characteristics.
It is part of the scivision library of tools for working with computer vision models and data.
Pixelflow is not currently available through PyPI, but it can be installed directly from this github repo
pip install git+https://github.com/alan-turing-institute/pixelflow.git
from pixelflow import pixelflow, pixelflow_custom
import numpy.typing as npt
@pixelflow_custom
def custom_func(x: npt.NDArray, y: npt.NDArray) -> float:
return -np.sum(x * y)
pixelflow(
mask,
img,
features=('label', 'bbox', 'centroid', 'area', 'major_axis_length', 'orientation', 'image_intensity'),
custom=(custom_func,),
dim_labels="YX",
labelled=True
)
A more detailed example usecase of pixelflow, extracting information on seed size and shape, can be found in the scivision-gallery.
Contributions of any kind welcome! Please feel free to open a pull request or raise an issue.