SMIL 1.1.2
Loading...
Searching...
No Matches
Distance Function

Detailed Description

+ Collaboration diagram for Distance Function:

Function Documentation

◆ distance()

template<class T1 , class T2 >
RES_T distance ( const Image< T1 > &  imIn,
Image< T2 > &  imOut,
const StrElt se = DEFAULT_SE 
)

distance() - Distance function

Parameters
[in]imIn: Binary input image
[out]imOut: Output image
[in]se: Structuring Element

◆ distanceEuclidean()

template<class T1 , class T2 >
RES_T distanceEuclidean ( const Image< T1 > &  imIn,
Image< T2 > &  imOut,
const StrElt se = DEFAULT_SE 
)

distanceEuclidean() - Euclidean distance function.

Parameters
[in]imIn: Binary input image
[out]imOut: Output image
[in]se: Structuring Element

◆ distanceGeodesic()

template<class T1 , class T2 >
RES_T distanceGeodesic ( const Image< T1 > &  imIn,
const Image< T1 > &  imMask,
Image< T2 > &  imOut,
const StrElt se = DEFAULT_SE 
)

distanceGeodesic() - Geodesic distance function

Parameters
[in]imIn: Binary input image
[in]imMask: Binary mask image
[out]imOut: Output image
[in]se: Structuring Element

Example

import smilPython as sp
im = sp.Image("cells.png")
imDist = sp.Image(im)
imMask = sp.Image(im)
imMark = sp.Image(im)
imGeoDist = sp.Image(im)
# create a marker image, the same as the original image except at
# some point inside the "true" region, which is set to "0"
nl = sp.HexSE()
sp.distance(im, imDist, nl)
sp.compare(imDist, "==", sp.maxVal(imDist), 0, im, imMark)
# use the original image as the mask.
sp.copy(im, imMask)
sp.distanceGeodesic(imMark, imMask, imGeoDist, nl)
imGeoDist.show()
sp.maxVal(imGeoDist)