nifty.segmentation¶
Functions¶
-
nifty.segmentation.
connectedComponents
(labels, dense=True, ignoreBackground=False)¶ get connected components of a label image
Get connected components of an image w.r.t. a 4-neighborhood . This is a high level wrapper for
Parameters: - labels (numpy.ndarray) –
- dense (bool) – should the return labeling be dense (default: {True})
- ignoreBackground (bool) – should values of zero be excluded (default: {False})
Returns: [description] [type]
-
nifty.segmentation.
distanceTransformWatersheds
(pmap, preBinarizationMedianRadius=1, threshold=0.5, preSeedSigma=0.75)¶ Superpixels for neuro data as in http://brainiac2.mit.edu/isbi_challenge/
Use raw data and membrane probability maps to generate a over-segmentation suitable for neuro data
Parameters: - pmap (numpy.ndarray) – Membrane probability in [0,1].
- preBinarizationMedianRadius (int) – Radius of diskMedian filter applied to the probability map before binarization. (default:{1})
- threshold (float) – threshold to binarize probability map before applying the distance transform (default: {0.5})
- preSeedSigma (float) – smooth the distance transform image before getting the seeds.
Raises: RuntimeError
– if applied to data with wrong dimensionality
-
nifty.segmentation.
localMaxima
(image)¶ get the local maxima of an image
Get the local maxima wrt a 4-neighborhood on an image. For a plateau, all pixels of this plateau are marked as maximum pixel.
Parameters: image (numpy.ndarray) – the input image Returns: array which is 1 the maximum 0 elsewhere. Return type: (numpy.ndarray)
-
nifty.segmentation.
localMaximaSeeds
(image)¶ Get seed from local maxima
Get seeds by running connected components on the local maxima. This is a high level wrapper around
nifty.segmentation.localMinima()
andnifty.segmentation.connectedComponents()
Parameters: image – [description] Returns: [description] [type] Raises: RuntimeError
– [description]
-
nifty.segmentation.
localMinima
(image)¶ get the local minima of an image
Get the local minima wrt a 4-neighborhood on an image. For a plateau, all pixels of this plateau are marked as minimum pixel.
Parameters: image (numpy.ndarray) – the input image Returns: array which is 1 the minimum 0 elsewhere. Return type: (numpy.ndarray)
-
nifty.segmentation.
localMinimaSeeds
(image)¶ Get seed from local minima
Get seeds by running connected components on the local minima. This is a high level wrapper around
nifty.segmentation.localMinima()
andnifty.segmentation.connectedComponents()
Parameters: image – [description] Returns: [description] [type] Raises: RuntimeError
– [description]
-
nifty.segmentation.
markBoundaries
(image, segmentation, color=None, thin=True)¶ Mark the boundaries in an image
Mark boundaries in an image.
Warning
The returned image shape is twice as large as the input if this is True.
Parameters: - image – the input image
- segmentation – the segmentation
- color (tuple) – the edge color(default: {(0,0,0)})
- thin (bool) – IF true, the image is interpolated and the boundaries are marked in the interpolated image. This will make the output twice as large.
Returns: - image with marked boundaries. Note that
result image has twice as large shape as the input if thin is True.
Return type: (numpy.ndarray)
-
nifty.segmentation.
randomColormap
(size=10000, zeroToZero=False)¶
-
nifty.segmentation.
seededWatersheds
(heightMap, seeds=None, method='node_weighted', acc='max')¶ Seeded watersheds segmentation
Get a segmentation via seeded watersheds. This is a high level wrapper around
nifty.graph.nodeWeightedWatershedsSegmentation()
andnifty.graph.nodeWeightedWatershedsSegmentation()
.Parameters: - heightMap (numpy.ndarray) – height / evaluation map
- seeds (numpy.ndarray) – Seeds as non zero elements in the array. (default: {nifty.segmentation.localMinimaSeeds(heightMap)})
- method (str) –
Algorithm type can be:
- ”node_weighted”: ordinary node weighted watershed
- ”edge_weighted”: edge weighted watershed (minimum spanning tree)
(default: {“max”})
- acc (str) –
If method is “edge_weighted”, one needs to specify how to convert the heightMap into an edgeMap. This parameter specificities this method. Allow values are:
- ’min’ : Take the minimum value of the endpoints of the edge
- ’max’ : Take the minimum value of the endpoints of the edge
- ’sum’ : Take the sum of the values of the endpoints of the edge
- ’prod’ : Take the product of the values of the endpoints of the edge
- ’interpixel’ : Take the value of the image at the interpixel coordinate in between the two endpoints. To do this the image is resampled to have shape :math: `2 cdot shape -1 `
(default: {“max”})
Returns: the segmentation
Return type: numpy.ndarray
Raises: RuntimeError
– [description]
-
nifty.segmentation.
segmentOverlay
(image, segmentation, beta=0.5, zeroToZero=False, showBoundaries=True, color=None, thin=True)¶
-
nifty.segmentation.
slic
(image, nSegments, components)¶ same as skimage.segmentation.slic