neuralib.imglib.factory.ImageProcFactory

final class neuralib.imglib.factory.ImageProcFactory[source]

Bases: object

Factory for basic imaging processing

image: ndarray

Image array. Array[uint, [H, W]|[H, W, 3]|[H, W, 4]]

mode: Literal['r', 'g', 'b', 'RGB', 'RGBA', 'gray']

Color mode

classmethod load(file, alpha=False)[source]

Load the image file

Parameters:
  • file (str | Path | bytes | BinaryIO | BufferedIOBase | BufferedReader) – Filepath of the image

  • alpha (bool) – Keep alpha channel

Returns:

ImageProcFactory

Return type:

Self

property height: int

image height H

property width: int

image width W

select_channel(channel)[source]

Select RGB channel

Parameters:

channel (Literal['red', 'green', 'blue', 'r', 'g', 'b']) – {red’, ‘green’, ‘blue’, ‘r’, ‘g’, ‘b’}

Return type:

Self

view_2d(flip=True)[source]

view RGB or RGBA image as 2d array. Array[uint, [H, W]]

Parameters:

flip (bool)

Return type:

Self

cvt_gray()[source]

convert to grayscale

Return type:

Self

gaussian_blur(ksize, sigma)[source]
Parameters:
  • ksize (int)

  • sigma (int)

Return type:

Self

edge_detection(lower_threshold=30, upper_threshold=150)[source]
Parameters:
  • lower_threshold (int)

  • upper_threshold (int)

Return type:

Self

binarize(threshold=150)[source]
Parameters:

threshold (int)

Return type:

Self

de_noise(h=10, temp_win_size=7, search_win_size=21)[source]
Parameters:
  • h (int)

  • temp_win_size (int)

  • search_win_size (int)

Return type:

Self

__init__(image, mode)

Method generated by attrs for class ImageProcFactory.

Parameters:
  • image (ndarray)

  • mode (Literal['r', 'g', 'b', 'RGB', 'RGBA', 'gray'])

Return type:

None

local_maxima_image(channel, **kwargs)[source]

find the local maxima of the selection points. i.e., used in roi selection of the neuron before counting

Parameters:

channel (Literal['red', 'green', 'blue', 'r', 'g', 'b']) – color of image

Returns:

Array[uint, [H, W]]

Return type:

Self