Posts Tagged lib
levset
Posted by in Projects on July 20th, 2008
This library contains classes that implement 2D/3D levelsets (full and narrow-band).
Features:
- explicit and implicit schemes for basic evolution equations.
- marching squares/cubes to obtain a surface.
- fast marching method (FMM) for re-initialization
- loading/saving data
There are also SIP python bindings, making it easy to prototype a solution. For example, to perform chen-vese segmentation, you would define a function that defines the evolution:
# evolution function, returns how much to move and maximum time step.
def fun(levset, image, stats, x, y):
l, d, k = levset(x,y), dirac(levset[x,y],2.0), levset.getCurvature(x,y)
pix = (image.pixel(x,y)&0xFF)/255.0
pin, pout = (pix-stats[0])**2, (pix-stats[1])**2
upd = d*(ak*k+(pin-pout))
return (upd, 0.98/(math.fabs(d*(2.0*ak/(xsp*xsp)+2.0*ak/(ysp*ysp))) + 0.01))
And then you would interleave this function call (bound with extra parameters using a lambda function), with the levelset motion and re-initialization calls
func = lambda levset,x,y: fun(levset, self.image, stats, x, y)
while not done:
stats = computeStats()
for i in xrange(0,3):
levset.moveWithCurvature(func)
levset.ensureSignedDistanceFMM()
#...
nmath
Posted by in Projects on July 20th, 2008
Basic math and vector routines. Features:
- Special classes for common vector/matrix sizes. General matrix class with interface to lapack for numerical routines.
- Minpack for non-linear least squares.
- Smart pointered data; all copies are shallow.
- Python interface.