Table Of Contents

Previous topic

Examples

Next topic

Common

This Page

Yayi core python extensions

This page details the python bindings of Yayi. Since these are bindings, for each class or function described here, there exist the equivalent C++ class or function. The python modules are also consistent with their C++ counterparts.

Reference

Structuring Elements

class YayiStructuringElementPython.ConstNeighborhood

Main const neighborhood class. This class does not allow any writing into the image

Center((ConstNeighborhood)arg1, (object)arg2) → object :

(coordinate): centers the structuring element at the specified coordinate

C++ signature :
yayi::s_return_code Center(yayi::se::IConstNeighborhood {lvalue},yayi::s_coordinate<0, int>)
Center( (ConstNeighborhood)arg1, (object)arg2) -> object :

(iterator): centers the structuring element at the specified iterator position

C++ signature :
yayi::s_return_code Center(yayi::se::IConstNeighborhood {lvalue},yayi::IConstIterator*)
Center( (ConstNeighborhood)arg1, (long)arg2) -> object :

(offset): centers the structuring element at the specified offset

C++ signature :
yayi::s_return_code Center(yayi::se::IConstNeighborhood {lvalue},long long)
SetShift((ConstNeighborhood)arg1, (object)arg2) → object :

specifies the shift that will be later applied to the center

C++ signature :
yayi::s_return_code SetShift(yayi::se::IConstNeighborhood {lvalue},yayi::s_coordinate<0, int>)
ShiftCenter((ConstNeighborhood)arg1) → object :

shifts the center by a shift previously defined

C++ signature :
yayi::s_return_code ShiftCenter(yayi::se::IConstNeighborhood {lvalue})
pixels

returns an iterator on the pixels in the neighborhood previously centered

YayiStructuringElementPython.NeighborhoodFactory((Image)arg1, (StructuringElement)arg2) → ConstNeighborhood :

(image, structuring element): factory for the neighborhood. Returns a neighborhood instance on the image based on the provided structuring element. Returns None on error.

C++ signature :
yayi::se::IConstNeighborhood* NeighborhoodFactory(yayi::IImage,yayi::se::IStructuringElement)
YayiStructuringElementPython.SECross2D() → StructuringElement :
C++ signature :
yayi::se::IStructuringElement const* SECross2D()
YayiStructuringElementPython.SEFactory((structuring_element_type)arg1, (int)arg2, (HyperRectangle)arg3, (structuring_element_subtype)arg4) → StructuringElement :

(structuring element type, dimension, shape, structuring element subtype): factory for structuring elements

C++ signature :
yayi::se::IStructuringElement* SEFactory(yayi::se::e_structuring_element_type,unsigned char,yayi::s_any_type,yayi::se::e_structuring_element_subtype)
YayiStructuringElementPython.SEHex2D() → StructuringElement :
C++ signature :
yayi::se::IStructuringElement const* SEHex2D()
YayiStructuringElementPython.SESegmentX2D() → StructuringElement :
C++ signature :
yayi::se::IStructuringElement const* SESegmentX2D()
YayiStructuringElementPython.SESegmentX3D() → StructuringElement :
C++ signature :
yayi::se::IStructuringElement const* SESegmentX3D()
YayiStructuringElementPython.SESegmentY2D() → StructuringElement :
C++ signature :
yayi::se::IStructuringElement const* SESegmentY2D()
YayiStructuringElementPython.SESegmentY3D() → StructuringElement :
C++ signature :
yayi::se::IStructuringElement const* SESegmentY3D()
YayiStructuringElementPython.SESegmentZ3D() → StructuringElement :
C++ signature :
yayi::se::IStructuringElement const* SESegmentZ3D()
YayiStructuringElementPython.SESquare2D() → StructuringElement :
C++ signature :
yayi::se::IStructuringElement const* SESquare2D()
YayiStructuringElementPython.SESquare3D() → StructuringElement :
C++ signature :
yayi::se::IStructuringElement const* SESquare3D()
class YayiStructuringElementPython.StructuringElement

Main structuring element class

GetSESubType((StructuringElement)arg1) → structuring_element_subtype :

returns the subtype of the structuring element

C++ signature :
yayi::se::e_structuring_element_subtype GetSESubType(yayi::se::IStructuringElement {lvalue})
GetSEType((StructuringElement)arg1) → structuring_element_type :

returns the type of the structuring element

C++ signature :
yayi::se::e_structuring_element_type GetSEType(yayi::se::IStructuringElement {lvalue})
IsEqualUnordered((StructuringElement)arg1, (StructuringElement)arg2) → bool :

returns true if the provided structuring element is equivalent to the current instance. Two structuring elements are equivalent if, for any position, they yield the same set of neighboring points.

C++ signature :
bool IsEqualUnordered(yayi::se::IStructuringElement {lvalue},yayi::se::IStructuringElement const*)
RemoveCenter((StructuringElement)arg1) → StructuringElement :

returns a new structuring element with the same shape, but without any center element

C++ signature :
yayi::se::IStructuringElement* RemoveCenter(yayi::se::IStructuringElement {lvalue})
Transpose((StructuringElement)arg1) → StructuringElement :

returns a new structuring element that is the transposed of this one

C++ signature :
yayi::se::IStructuringElement* Transpose(yayi::se::IStructuringElement {lvalue})

Neighborhood Processing

YayiNeighborhoodProcessingPython.local_circular_mean_and_concentration((Image)imin, (StructuringElement)se, (Image)imout) → object :

Computes the circular mean and concentration over each neighborhoods of imin defined by se (imout should be complex)

C++ signature :
yayi::s_return_code local_circular_mean_and_concentration(yayi::IImage const*,yayi::se::IStructuringElement const*,yayi::IImage*)
YayiNeighborhoodProcessingPython.local_mean((Image)imin, (StructuringElement)se, (Image)imout) → object :

Computes the mean over each neighborhoods of imin defined by se

C++ signature :
yayi::s_return_code local_mean(yayi::IImage const*,yayi::se::IStructuringElement const*,yayi::IImage*)
YayiNeighborhoodProcessingPython.local_median((Image)imin, (StructuringElement)se, (Image)imout) → object :

Computes the median on each neighborhood

C++ signature :
yayi::s_return_code local_median(yayi::IImage const*,yayi::se::IStructuringElement const*,yayi::IImage*)
YayiNeighborhoodProcessingPython.local_weighted_circular_mean_and_concentration((Image)imin, (StructuringElement)se, (Image)imout) → object :

Computes the circular mean and concentration of channel 0 linearly weighted by channel 2 over each neighborhoods of imin defined by se (imout should be complex)

C++ signature :
yayi::s_return_code local_weighted_circular_mean_and_concentration(yayi::IImage const*,yayi::se::IStructuringElement const*,yayi::IImage*)

Low level morphology

YayiLowLevelMorphologyPython.Close((Image)arg1, (StructuringElement)arg2, (Image)arg3) → object :

(im_source, SE, im_destination) : Performs the closing/closure of one image into another with the specified structuring element

C++ signature :
yayi::s_return_code Close(yayi::IImage const*,yayi::se::IStructuringElement const*,yayi::IImage*)
YayiLowLevelMorphologyPython.Dilation((Image)arg1, (StructuringElement)arg2, (Image)arg3) → object :

(im_source, SE, im_destination) : Performs the dilation of one image into another with the specified structuring element

C++ signature :
yayi::s_return_code Dilation(yayi::IImage const*,yayi::se::IStructuringElement const*,yayi::IImage*)
YayiLowLevelMorphologyPython.Erosion((Image)arg1, (StructuringElement)arg2, (Image)arg3) → object :

(im_source, SE, im_destination) : Performs the erosion of one image into another with the specified structuring element

C++ signature :
yayi::s_return_code Erosion(yayi::IImage const*,yayi::se::IStructuringElement const*,yayi::IImage*)
YayiLowLevelMorphologyPython.GeodesicDilation((Image)im_source, (Image)im_mask, (StructuringElement)SE, (Image)im_destination) → object :

Performs the classical geodesic dilation of im_source under im_mask with the provided structuring element

C++ signature :
yayi::s_return_code GeodesicDilation(yayi::IImage const*,yayi::IImage const*,yayi::se::IStructuringElement const*,yayi::IImage*)
YayiLowLevelMorphologyPython.GeodesicErosion((Image)im_source, (Image)im_mask, (StructuringElement)SE, (Image)im_destination) → object :

Performs the classical geodesic erosion of im_source over im_mask with the provided structuring element

C++ signature :
yayi::s_return_code GeodesicErosion(yayi::IImage const*,yayi::IImage const*,yayi::se::IStructuringElement const*,yayi::IImage*)
YayiLowLevelMorphologyPython.Gradient((Image)arg1, (StructuringElement)arg2, (Image)arg3) → object :

(im_source, SE, im_destination) : Performs the classical morphological gradient of one image into another with the specified structuring element

C++ signature :
yayi::s_return_code Gradient(yayi::IImage const*,yayi::se::IStructuringElement const*,yayi::IImage*)
YayiLowLevelMorphologyPython.GradientInf((Image)arg1, (StructuringElement)arg2, (Image)arg3) → object :

(im_source, SE, im_destination) : Performs the classical morphological half inferior gradient of one image into another with the specified structuring element

C++ signature :
yayi::s_return_code GradientInf(yayi::IImage const*,yayi::se::IStructuringElement const*,yayi::IImage*)
YayiLowLevelMorphologyPython.GradientSup((Image)arg1, (StructuringElement)arg2, (Image)arg3) → object :

(im_source, SE, im_destination) : Performs the classical morphological half superior gradient of one image into another with the specified structuring element

C++ signature :
yayi::s_return_code GradientSup(yayi::IImage const*,yayi::se::IStructuringElement const*,yayi::IImage*)
YayiLowLevelMorphologyPython.MinkowskiAddition((Image)arg1, (StructuringElement)arg2, (Image)arg3) → object :

(im_source, SE, im_destination) : Performs the Minkowski addition of one image into another with the specified structuring element (basically dilation with the implicitely transposed structuring element)

C++ signature :
yayi::s_return_code MinkowskiAddition(yayi::IImage const*,yayi::se::IStructuringElement const*,yayi::IImage*)
YayiLowLevelMorphologyPython.MinkowskiSubtraction((Image)arg1, (StructuringElement)arg2, (Image)arg3) → object :

(im_source, SE, im_destination) : Performs the Minkowski subtraction of one image into another with the specified structuring element (basically erosion with the implicitely transposed structuring element)

C++ signature :
yayi::s_return_code MinkowskiSubtraction(yayi::IImage const*,yayi::se::IStructuringElement const*,yayi::IImage*)
YayiLowLevelMorphologyPython.Open((Image)arg1, (StructuringElement)arg2, (Image)arg3) → object :

(im_source, SE, im_destination) : Performs the opening of one image into another with the specified structuring element

C++ signature :
yayi::s_return_code Open(yayi::IImage const*,yayi::se::IStructuringElement const*,yayi::IImage*)
YayiLowLevelMorphologyPython.SoillesHitOrMiss((Image)im_source, (StructuringElement)foreground_SE, (StructuringElement)background_SE, (Image)im_destination) → object :

Performs the hit-or_miss transform for gray level images based on Soilles definition.

C++ signature :
yayi::s_return_code SoillesHitOrMiss(yayi::IImage const*,yayi::se::IStructuringElement const*,yayi::se::IStructuringElement const*,yayi::IImage*)

Labels

YayiLabelPython.ImageLabelMaximas((Image)arg1, (StructuringElement)arg2, (Image)arg3) → object :

(imin, se, imout) : labels maximum plateaus of imin into imout with a single id per connected component

C++ signature :
yayi::s_return_code ImageLabelMaximas(yayi::IImage const*,yayi::se::IStructuringElement const*,yayi::IImage*)
YayiLabelPython.ImageLabelMinimas((Image)arg1, (StructuringElement)arg2, (Image)arg3) → object :

(imin, se, imout) : labels minimum plateaus of imin into imout with a single id per connected component

C++ signature :
yayi::s_return_code ImageLabelMinimas(yayi::IImage const*,yayi::se::IStructuringElement const*,yayi::IImage*)
YayiLabelPython.image_label((Image)imin, (StructuringElement)se, (Image)imout) → object :

Labels the connected components of imin in imout. Each connected component is identified in imout with a unique value. The connectivity used for the connected components is given by se.

Parameters:
  • imin (image) – input image
  • se (SE) – connectivity in imin for discovering the connection between two pixels
  • imout (image) – output image
Returns:

None on success, throws an error otherwise

C++ signature :
yayi::s_return_code image_label(yayi::IImage const*,yayi::se::IStructuringElement const*,yayi::IImage*)
YayiLabelPython.image_label_binary_components_with_area((Image)imin, (StructuringElement)se, (Image)imout) → object :
Labels components formed of non “black” pixels and extracts their area
returns:a “dictionary” which key is the id of the connected component, and the value is its area.
C++ signature :
yayi::s_any_type image_label_binary_components_with_area(yayi::IImage const*,yayi::se::IStructuringElement const*,yayi::IImage*)
YayiLabelPython.image_label_non_black_to_offset((Image)imin, (StructuringElement)se) → object :

returns a list of list containing the offsets of the points of each connected component

C++ signature :
yayi::s_any_type image_label_non_black_to_offset(yayi::IImage const*,yayi::se::IStructuringElement const*)

Reconstructions

YayiReconstructionPython.ClosingByReconstruction((Image)image_marker, (Image)image_mask, (StructuringElement)SE, (Image)reconstruction) → object :

Performs an algebraic closing by morphological reconstruction of image_marker over image_mask (successive geodesic erosions)

C++ signature :
yayi::s_return_code ClosingByReconstruction(yayi::IImage const*,yayi::IImage const*,yayi::se::IStructuringElement const*,yayi::IImage*)
YayiReconstructionPython.FillHoles((Image)imin, (StructuringElement)SE, (Image)imout) → object :

Fills the holes of imin using SE as neighboring graph. Stores the output in imout

C++ signature :
yayi::s_return_code FillHoles(yayi::IImage const*,yayi::se::IStructuringElement const*,yayi::IImage*)
YayiReconstructionPython.HConcave((Image)im_source, (StructuringElement)SE, (HyperRectangle)variant, (Image)im_destination) → object :

Performs the h-concave transformation, abs(h-minima(im_source) - im_source).

C++ signature :
yayi::s_return_code HConcave(yayi::IImage const*,yayi::se::IStructuringElement const*,yayi::s_any_type,yayi::IImage*)
YayiReconstructionPython.HConvex((Image)im_source, (StructuringElement)SE, (HyperRectangle)variant, (Image)im_destination) → object :

Performs the h-convex transformation, abs(h-maxima(im_source) - im_source).

C++ signature :
yayi::s_return_code HConvex(yayi::IImage const*,yayi::se::IStructuringElement const*,yayi::s_any_type,yayi::IImage*)
YayiReconstructionPython.HMaxima((Image)im_source, (StructuringElement)SE, (HyperRectangle)variant, (Image)im_destination) → object :

Performs the h-maxima transformation, it suppresses all maxima whose depth is below a given level threshold (variant).

C++ signature :
yayi::s_return_code HMaxima(yayi::IImage const*,yayi::se::IStructuringElement const*,yayi::s_any_type,yayi::IImage*)
YayiReconstructionPython.HMinima((Image)im_source, (StructuringElement)SE, (HyperRectangle)variant, (Image)im_destination) → object :

Performs the h-minima transformation, it suppresses all minima whose depth is above a given level threshold (variant).

C++ signature :
yayi::s_return_code HMinima(yayi::IImage const*,yayi::se::IStructuringElement const*,yayi::s_any_type,yayi::IImage*)
YayiReconstructionPython.Levelings((Image)image_marker, (Image)image_mask, (StructuringElement)SE, (Image)levelings) → object :

Performs a leveling of image_marker with reference image_mask

C++ signature :
yayi::s_return_code Levelings(yayi::IImage const*,yayi::IImage const*,yayi::se::IStructuringElement const*,yayi::IImage*)
YayiReconstructionPython.OpeningByReconstruction((Image)image_marker, (Image)image_mask, (StructuringElement)SE, (Image)reconstruction) → object :

Performs an algebraic opening by morphological reconstruction of image_marker under image_mask (successive geodesic dilations)

C++ signature :
yayi::s_return_code OpeningByReconstruction(yayi::IImage const*,yayi::IImage const*,yayi::se::IStructuringElement const*,yayi::IImage*)
YayiReconstructionPython.PseudoDynamicClosing((Image)im_source, (StructuringElement)SE, (HyperRectangle)variant, (Image)im_destination) → object :

Performs the PseudoDynamiClosing transformation, similar to h-minima but restores the dynamic of remaining minima

C++ signature :
yayi::s_return_code PseudoDynamicClosing(yayi::IImage const*,yayi::se::IStructuringElement const*,yayi::s_any_type,yayi::IImage*)
YayiReconstructionPython.PseudoDynamicOpening((Image)im_source, (StructuringElement)SE, (HyperRectangle)variant, (Image)im_destination) → object :

Performs the PseudoDynamiOpening transformation, similar to h-maxima but restores the dynamic of remaining maxima

C++ signature :
yayi::s_return_code PseudoDynamicOpening(yayi::IImage const*,yayi::se::IStructuringElement const*,yayi::s_any_type,yayi::IImage*)

Segmentation

This module contains segmentation methods.

Reference

YayiSegmentationPython.IsotropicSeededWatershed((Image)topographical_map, (Image)im_seeds, (StructuringElement)SE, (Image)watershed) → object :

Performs the isotropic watershed transform of topographical_map, and using im_seeds as seeds

C++ signature :
yayi::s_return_code IsotropicSeededWatershed(yayi::IImage const*,yayi::IImage const*,yayi::se::IStructuringElement const*,yayi::IImage*)
YayiSegmentationPython.IsotropicWatershed((Image)topographical_map, (StructuringElement)SE, (Image)watershed) → object :

Performs the isotropic watershed transform of topographical_map, and using local minima as seeds

C++ signature :
yayi::s_return_code IsotropicWatershed(yayi::IImage const*,yayi::se::IStructuringElement const*,yayi::IImage*)

Measurements

YayiMeasurementsPython.MeasCircularMeanAndConcentrationOnMask((Image)imin, (Image)immask, (HyperRectangle)mask_value) → object :

Returns the circular mean and concentration for each region of the image. The regions are non-overlapping and defined by immask. The return type is a map of complex elements

C++ signature :
yayi::s_any_type MeasCircularMeanAndConcentrationOnMask(yayi::IImage const*,yayi::IImage const*,yayi::s_any_type)
YayiMeasurementsPython.MeasCircularMeanAndConcentrationOnRegions((Image)imin, (Image)imregions) → object :

Returns the circular mean and concentration for each region of the image. The regions are non-overlapping and defined by imregions. The return type is a map of complex elements

C++ signature :
yayi::s_any_type MeasCircularMeanAndConcentrationOnRegions(yayi::IImage const*,yayi::IImage const*)
YayiMeasurementsPython.MeasHistogram((Image)imin) → object :

Returns the histogram of the image

C++ signature :
yayi::s_any_type MeasHistogram(yayi::IImage const*)
YayiMeasurementsPython.MeasHistogramOnRegions((Image)imin, (Image)imregions) → object :

Returns the histogram for each region of the image. The regions are non-overlapping and defined by imregions

C++ signature :
yayi::s_any_type MeasHistogramOnRegions(yayi::IImage const*,yayi::IImage const*)
YayiMeasurementsPython.MeasMean((Image)imin) → object :

Returns the mean of the image

C++ signature :
yayi::s_any_type MeasMean(yayi::IImage const*)
YayiMeasurementsPython.MeasMeanOnRegions((Image)imin, (Image)imregions) → object :

Returns the mean for each region of the image. The regions are non-overlapping and defined by imregions

C++ signature :
yayi::s_any_type MeasMeanOnRegions(yayi::IImage const*,yayi::IImage const*)
YayiMeasurementsPython.MeasMinMax((Image)arg1) → object :
C++ signature :
yayi::s_any_type MeasMinMax(yayi::IImage const*)
YayiMeasurementsPython.MeasWeightedCircularMeanAndConcentrationOnMask((Image)imin, (Image)immask, (HyperRectangle)mask_value) → object :

Returns the circular mean and concentration of channel 0 weighted by channel 2 for each region of the image. The regions are non-overlapping and defined by immask. The return type is a map of complex elements.

C++ signature :
yayi::s_any_type MeasWeightedCircularMeanAndConcentrationOnMask(yayi::IImage const*,yayi::IImage const*,yayi::s_any_type)
YayiMeasurementsPython.MeasWeightedCircularMeanAndConcentrationOnRegion((Image)imin, (Image)imregions) → object :

Returns the circular mean and concentration of channel 0 weighted by channel 2 for each region of the image. The regions are non-overlapping and defined by imregions. The return type is a map of complex elements.

C++ signature :
yayi::s_any_type MeasWeightedCircularMeanAndConcentrationOnRegion(yayi::IImage const*,yayi::IImage const*)
YayiMeasurementsPython.meas_median((Image)imin) → object :

Returns the median of the image

C++ signature :
yayi::s_any_type meas_median(yayi::IImage const*)

Distances

YayiDistancesPython.DistanceFromSetsBoundary((Image)arg1, (StructuringElement)arg2, (Image)arg3) → object :

(im_source, SE, im_distance) : Performs the morphological distance transform from the sets boundary

C++ signature :
yayi::s_return_code DistanceFromSetsBoundary(yayi::IImage const*,yayi::se::IStructuringElement const*,yayi::IImage*)
YayiDistancesPython.DistanceRegularization((Image)arg1, (StructuringElement)arg2, (Image)arg3) → object :

(im_distance, SE, im_regular_distance) : forces the 1-Lipschitz property on the distance map returned by the QuasiDistance algorithm

C++ signature :
yayi::s_return_code DistanceRegularization(yayi::IImage const*,yayi::se::IStructuringElement const*,yayi::IImage*)
YayiDistancesPython.QuasiDistance((Image)arg1, (StructuringElement)arg2, (Image)arg3, (Image)arg4) → object :

(im_source, SE, im_distance, im_residuals) : Performs the unregularized quasi-distance morphological transform

C++ signature :
yayi::s_return_code QuasiDistance(yayi::IImage const*,yayi::se::IStructuringElement const*,yayi::IImage*,yayi::IImage*)
YayiDistancesPython.QuasiDistancesWeighted((Image)arg1, (StructuringElement)arg2, (HyperRectangle)arg3, (Image)arg4, (Image)arg5) → object :

(im_source, SE, weights, im_distance, im_residuals) : Performs the unregularized weighted quasi-distance morphological transform

C++ signature :
yayi::s_return_code QuasiDistancesWeighted(yayi::IImage const*,yayi::se::IStructuringElement const*,yayi::s_any_type,yayi::IImage*,yayi::IImage*)