Topology3d¶
Defines basic 3d discrete topology utils.
Note
The definitions are compatible with a separable convolutional kernel with weights along the 3 dimensions given by:
>>> [[(2**(3**d))**k for k in range(3)] for d in range(3)]
-
cube_base_2
(center=None)[source]¶ Returns an array with base 2 numbers on the cube for convolution and lut matching
-
extract_neighbourhood
(img, x, y, z)[source]¶ Return the neighbourhoods of the indicated voxels
- Arguments:
img (array): the 3d image x,y,z (n array): coordinates of the voxels to extract neighbourhoods from
- Returns:
array (nx27 array): neighbourhoods
- Note:
Assumes borders of the image are zero so that 0<x,y,z<w,h,d !
-
index_from_binary
(source, sink=None, method='shared', dtype='uint32', processes=None, verbose=False)[source]¶ Calculate the local 3x3x3 configuration in a binary source.
Note
The configuration kernel is separable and convolution with it is calculated via a sequence of 1d convolutions.
-
index_kernel
(axis=None, dtype='uint32')[source]¶ Separable 1d kernels to obtain configuration index.
-
neighbourhood_list
(img, dtype='int64', verbose=False)[source]¶ Return a list of x,y,z and list indices of the 26 neighbours
-
neighbourhood_opposing_directions
()[source]¶ Returns a list of neighbour indices that are opposite of each other
-
n18
= array([[[False, True, False], [ True, True, True], [False, True, False]], [[ True, True, True], [ True, False, True], [ True, True, True]], [[False, True, False], [ True, True, True], [False, True, False]]])¶ 18-Neighborhood excluding center
-
n26
= array([[[ True, True, True], [ True, True, True], [ True, True, True]], [[ True, True, True], [ True, False, True], [ True, True, True]], [[ True, True, True], [ True, True, True], [ True, True, True]]])¶ 26-Neighborhood excluding center
-
n6
= array([[[False, False, False], [False, True, False], [False, False, False]], [[False, True, False], [ True, False, True], [False, True, False]], [[False, False, False], [False, True, False], [False, False, False]]])¶ 6-Neighborhood excluding center