![]() Backend can be specified by a string or by an instance of Backend class. These functions mimic scikit-image counterparts Padding from imops import pad, pad_to_shape y = pad ( x, 10, axis = ) # `ratio` controls how much padding is applied to left side: # 0 - pad from right # 1 - pad from left # 0.5 - distribute the padding equally z = pad_to_shape ( x, ( 4, 120, 67 ), ratio = 0.25 ) Cropping from imops import crop_to_shape # `ratio` controls the position of the crop # 0 - crop from right # 1 - crop from left # 0.5 - crop from the middle z = crop_to_shape ( x, ( 4, 120, 67 ), ratio = 0.25 ) Labeling from imops import label # same as `` labeled, num_components = label ( x, background = 1, return_num = True ) Backendsįor zoom, zoom_to_shape, interp1d, radon, inverse_radon you can specify which backend to use. Works faster only for ndim<=3, dtype=float32 or float64, order=1 or 'linear' Fast binary morphology from imops import binary_dilation, binary_erosion, binary_opening, binary_closing Works faster only for ndim<=3, dtype=float32 or float64, output=None, order=1, mode='constant', grid_mode=False Fast 1d linear interpolation from imops import interp1d # same as `1d` Pip install imops # additionally install Numba backend Features Fast Radon transform from imops import radon, inverse_radon Fast linear/bilinear/trilinear zoom from imops import zoom, zoom_to_shape # fast zoom with optional fallback to scipy's implementation y = zoom ( x, 2, axis = ) # a handy function to zoom the array to a given shape # without the need to compute the scale factor z = zoom_to_shape ( x, ( 4, 120, 67 )) Install pip install imops # default install with Cython backend ![]() Efficient parallelizable algorithms for multidimensional arrays to speed up your data pipelines.
0 Comments
Leave a Reply. |