alan-turing-institute / pixelflow

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Continuous integration status badge Licence badge (BSD 3 Clause)

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.

Installation

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

Usage

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.

Contributing

Contributions of any kind welcome! Please feel free to open a pull request or raise an issue.

About

License:BSD 3-Clause "New" or "Revised" License


Languages

Language:Python 100.0%