get_pixel_neighbours

This module’s scope are algorithms related to obtaining the list of neighbours for a given position in an array.

Example:

>>> import tuna
>>> import numpy
>>> z = numpy.zeros ( shape = ( 30, 30 ) )
>>> tuna.tools.get_pixel_neighbours ( position = ( 10, 20 ), array = z )
[(9, 19), (9, 20), (9, 21), (10, 19), (10, 21), (11, 19), (11, 20), (11, 21)]
tuna.tools.get_pixel_neighbours.get_pixel_neighbours(position=(<class 'int'>, <class 'int'>), array=<class 'numpy.ndarray'>, distance_threshold=1)[source]

This function’s goal is to produce a list of tuples of 2 integers where each tuple encodes the position of a neighbour of the input position in the input array.

Parameters:

  • position : tuple of 2 integers
  • array : numpy.ndarray
  • distance_threshold : integer : 1