mycelyso.processing package¶
Submodules¶
mycelyso.processing.binarization module¶
The binarization module contains the binarization routine used to segment phase contrast images of mycelium networks into foreground and background.
-
mycelyso.processing.binarization.
bataineh
(image, mask=None, window_size=15, return_threshold=False, **kwargs)[source]¶ Thresholding method as developed by [Bataineh2011a].
[Bataineh2011a] Bataineh et al. (2011) Pattern Recognit. Lett. DOI: 10.1016/j.patrec.2011.08.001 Parameters: - image – Input image
- mask – Possible mask denoting a ROI
- window_size – Window size
- return_threshold – Whether to return a binarization, or the actual threshold values
- kwargs – For compatibility
Returns:
-
mycelyso.processing.binarization.
experimental_thresholding
(image, mask=None, window_size=15, gaussian_sigma=3.0, shift=0.2, target=-0.5, quotient=1.2, return_threshold=False, **kwargs)[source]¶ A novel thresholding method basing upon the shape index as defined by [Koenderink1992], and [Bataineh2011] automatic adaptive thresholding. The method is due to be explained in detail in the future.
[Koenderink1992] Koenderink and van Doorn (1992) Image Vision Comput. DOI: 10.1016/0262-8856(92)90076-F [Bataineh2011] Bataineh et al. (2011) Pattern Recognit. Lett. DOI: 10.1016/j.patrec.2011.08.001 Parameters: - image – Input image
- mask – Possible mask denoting a ROI
- window_size – Window size
- gaussian_sigma – Sigma of the Gaussian used for smoothing
- shift – Shift parameter
- target – Target shape index parameter
- quotient – Quotient parameter
- return_threshold – Whether to return a binarization, or the actual threshold values
- kwargs – For compatibility
Returns:
-
mycelyso.processing.binarization.
feng
(image, mask=None, window_size=15, window_size2=30, a1=0.12, gamma=2, k1=0.25, k2=0.04, return_threshold=False, **kwargs)[source]¶ Thresholding method as developed by [Feng2004].
[Feng2004] Fend & Tan (2004) IEICE Electronics Express DOI: 10.1587/elex.1.501 Parameters: - image – Input image
- mask – Possible mask denoting a ROI
- window_size – Window size
- window_size2 – Second window size
- a1 – a1 value
- gamma – gamma value
- k1 – k1 value
- k2 – k2 value
- return_threshold – Whether to return a binarization, or the actual threshold values
- kwargs – For compatibility
Returns:
-
mycelyso.processing.binarization.
mean_and_std
(image, window_size=15)[source]¶ Helper function returning mean and average images sped up using integral images / summed area tables.
Parameters: - image – Input image
- window_size – Window size
Returns: tuple (mean, std)
-
mycelyso.processing.binarization.
nick
(image, window_size=15, k=-0.1, return_threshold=False, **kwargs)[source]¶ Thresholding method as developed by [Khurshid2009].
[Khurshid2009] Khurshid et al. (2009) Proc. SPIE DOI: 10.1117/12.805827 Parameters: - image – Input image
- window_size – Window size
- k – k value
- return_threshold – Whether to return a binarization, or the actual threshold values
- kwargs – For compatibility
Returns:
-
mycelyso.processing.binarization.
normalize
(image)[source]¶ Normalizes an image to the range 0-1
Parameters: image – Returns:
-
mycelyso.processing.binarization.
phansalkar
(image, window_size=15, k=0.25, r=0.5, p=2.0, q=10.0, return_threshold=False, **kwargs)[source]¶ Thresholding method as developed by [Phansalkar2011].
[Phansalkar2011] Phansalkar et al. (2011) Proc. ICCSP DOI: 10.1109/ICCSP.2011.5739305 Parameters: - image – Input image
- window_size – Window size
- k – k value
- r – r value
- p – p value
- q – q value
- return_threshold – Whether to return a binarization, or the actual threshold values
- kwargs – For compatibility
Returns:
-
mycelyso.processing.binarization.
sauvola
(image, window_size=15, k=0.5, r=128, return_threshold=False, **kwargs)[source]¶ Thresholding method as developed by [Sauvola1997].
[Sauvola1997] Sauvola et al. (1997) Proc. Doc. Anal. Recog. DOI: 10.1109/ICDAR.1997.619831 Parameters: - image – Input image
- window_size – Window size
- k – k value
- r – r value
- return_threshold – Whether to return a binarization, or the actual threshold values
- kwargs – For compatibility
Returns:
-
mycelyso.processing.binarization.
wolf
(image, mask=None, window_size=15, a=0.5, return_threshold=False, **kwargs)[source]¶ Thresholding method as developed by [Wolf2004].
[Wolf2004] Wolf & Jolion (2004) Form. Pattern Anal. & App. DOI: 10.1007/s10044-003-0197-7 Parameters: - image – Input image
- mask – Possible mask denoting a ROI
- window_size – Window size
- a – a value
- return_threshold – Whether to return a binarization, or the actual threshold values
- kwargs – For compatibility
Returns:
mycelyso.processing.pixelgraphs module¶
The pixelgraphs module contains various functions to work with skeleton images, and treating the paths of the skeleton as graphs, which can be walked along.
-
mycelyso.processing.pixelgraphs.
get_all_neighbor_nums
(num)[source]¶ Return all set neighbor bits in num.
Parameters: num – Neighborhood representation. Returns: Array of values
-
mycelyso.processing.pixelgraphs.
get_all_neighbors
(num)[source]¶ Return positions for all set neighbor bits in num
Parameters: num – Neighborhood representation Returns: Array of shifts
-
mycelyso.processing.pixelgraphs.
get_connectivity_map
(binary)[source]¶ Returns a ‘connectivity map’, where each value represents the count of neighbors at a position.
Parameters: binary – Binary input image Returns:
-
mycelyso.processing.pixelgraphs.
get_inverse_neighbor_shift
(num)[source]¶ Get the shift corresponding to the inverse direction represented by num.
Parameters: num – Neighborhood bit Returns: Shift (r, c)
-
mycelyso.processing.pixelgraphs.
get_neighborhood_map
(binary)[source]¶ Returns a ‘neighborhood map’, where each value binary encodes the connections at a point.
Parameters: binary – Binary input image Returns:
-
mycelyso.processing.pixelgraphs.
get_next_neighbor
(num)[source]¶ Returns the coordinates represented by a numeric neighbor bit.
Parameters: num – Neighbor bit Returns: Shift (r, c)
-
mycelyso.processing.pixelgraphs.
is_edge
(connectivity)[source]¶ Returns True if connectivity corresponds an edge (is two).
Parameters: connectivity – Scalar or matrix Returns: Boolean or matrix of boolean
-
mycelyso.processing.pixelgraphs.
is_end
(connectivity)[source]¶ Returns True if connectivity corresponds to an endpoint (is one).
Parameters: connectivity – Scalar or matrix Returns: Boolean or matrix of boolean
Module contents¶
The processing submodule contains various functions and management classes concerned with image processing of hyphae network images.