- Package managers:
- Pablo Hernandez-Cerdan, David Coeurjolly
- Since
- 1.2
Package Overview
Since release 1.2, DGtal has a partial python binding using pybind11. To install the python package, just use:
Then, you can import the module in python:
At this point, only a partial support is available (some base, kernel, image, topology classes). For a complete review of the available tools, have a look to this Pull-Request.
Just a quick example (Euler characteristics and simple point detection on random sets):
import dgtal
import random
Point = dgtal.kernel.Point3D
Domain = dgtal.kernel.DomainZ3i
Set = dgtal._dgtal.kernel.DigitalSetZ3i
mySet = Set(dom)
# Random set
for i in range(50*50):
mySet.
insert(
Point(random.randint(0,10),random.randint(0,10),random.randint(0,10)))
# Digital Object (with topology)
Topo = Object.TDigitalTopology
FAdj = Topo.TForegroundAdjacency
BAdj = Topo.TBackgroundAdjacency
fadj = FAdj()
badj = BAdj()
topo = Topo(fadj, badj)
obj = Object(topo,mySet)
#Counting the simple points
cptSimple=0
if obj.isSimple(p):
cptSimple += 1
print("Number of simple points: "+str(cptSimple)+ " / " + str(mySet.size()))
# Cubical Complex
kspace = dgtal.topology.KSpace3D()
ccomplex = dgtal.topology.CubicalComplex3D(kspace)
ccomplex.construct(mySet)
print("Euler characteristic: "+str(ccomplex.euler()))
Object< DT26_6, DigitalSet > Object26_6
void insert(VContainer1 &c1, LContainer2 &c2, unsigned int idx, double v)
HyperRectDomain< Space > Domain
for(Domain::ConstIterator it=domain.begin(), it_end=domain.end();it !=it_end;++it,++cnt)