-
Install the header files for Python 3, numpy and CGAL (see the end of this document). On Debian-based systems:
sudo apt-get install libcgal-dev python3-dev python3-numpy. -
To compile type
make.If you get the error message
Could not find the numpy C headers. Is the numpy Python module installed properly?you do not have the
numpyPython package installed. -
You can put the resulting
pypaya2.soin the same directory as your analysis Python scripts, or on your PYTHONPATH.
Computing the Minkowski Tensors of a polygon:
import pypaya2
vertices = [[2., 3.], [1., 1.], [-3., 4.], [-2., 0.], [2., 0.]
minkval = pypaya2.imt_for_polygon(vertices)
print(minkval['psi2'])
Performing Voronoi-Minkowski analysis of a point pattern:
import pypaya2
seeds = [[2., 3.], [1., 1.], [-3., 4.], [-2., 0.], [2., 0.]
minkval = pypaya2.imt_for_pointpattern(seeds)
print(minkval['psi2'])
Computing the Minkowski tensors of an image, assumed to be a 2D array:
minkval = pypaya2.imt_for_image(image)
print(minkval['psi2'])
minkval = pypaya2.imt_for_image(image, threshold=[1, 3, 10, 30])
print(minkval['psi2'])
Run make test.
On Debian/Ubuntu-based systems:
sudo apt-get install libcgal-dev python3-dev python3-numpy
On MacOS with Homebrew
brew install boost cgal numpy
Once you have installed any missing dependencies, type make clean to have the Makefile detect them.
If you still have Python 2, edit the file features.mk and add the line PYTHON_VERSION = 2.
You will need python2-dev and python-numpy packages.