Skip to main content

Calculate Feret diameter.

Project description

Feret

This python module can calculate the maximum and minimum Feret Diameter of a binary image. For a detailed explanation see this wikipedia page.

At this early development stage, it can only calculate the maximum and minimum Feret Diameter but feature releases will offer the Feret diameter 90° to maximum and minimum. The module will also not return the angle of the diameters. Many things will come in the future.

The module can be used as followed:

import feret
import tifffile as tif

img = tif.imread('example.tif')

# get the class
res = feret.calc(img)
maxf, minf = res.maxferet, res.minferet

# get the values
maxf, minf = feret.all(img)

# get only maxferet
maxf = feret.max(img)

# get only minferet
minf = feret.min(img)

At the moment there is only one option. It is possible to use the pixel corners instead of the pixel centers. ImageJ uses the pixel corners. Here the keyword edge is used. See the following code to get maxferet und minferet for the edges.

import feret
import tifffile as tif

img = tif.imread('example.tif')

# get the class
res = feret.calc(img, edge=True)
maxf, minf = res.maxferet, res.minferet

# get the values
maxf, minf = feret.all(img, edge=True)

# get only maxferet
maxf = feret.max(img, edge=True)

# get only minferet
minf = feret.min(img, edge=True)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

feret-0.2.tar.gz (3.9 kB view hashes)

Uploaded Source

Built Distribution

feret-0.2-py3-none-any.whl (3.9 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page