#image-processing #multidimensional-array #ndarray #array #image #multidimensional #matrix

ndarray-ndimage

Multidimensional image processing for ArrayBase, the n-dimensional array data structure provided by ndarray

9 unstable releases (3 breaking)

0.4.0 Aug 31, 2023
0.3.0 Dec 8, 2022
0.2.2 Nov 18, 2022
0.1.3 Oct 14, 2021

#4 in #multidimensional

Download history 87/week @ 2023-12-13 214/week @ 2023-12-20 14/week @ 2023-12-27 305/week @ 2024-01-03 396/week @ 2024-01-10 383/week @ 2024-01-17 403/week @ 2024-01-24 483/week @ 2024-01-31 652/week @ 2024-02-07 612/week @ 2024-02-14 702/week @ 2024-02-21 587/week @ 2024-02-28 569/week @ 2024-03-06 544/week @ 2024-03-13 511/week @ 2024-03-20 386/week @ 2024-03-27

2,116 downloads per month
Used in stonnx

MIT/Apache

97KB
2K SLoC

ndarray-ndimage

This crate provides multidimensional image processing for ndarray's ArrayBase type. It is mainly focussed on 3D arrays/images for now, but some functions are available on on n-d arrays.

It aims to:

  • be a Rust replacement for scipy.ndimage with some other tools like numpy.pad and anything else relevant to image processing. We do not want all options and arguments offered by scipy.ndimage because some of them are incompatible with Rust. We hope to offer the most used ones.
  • be faster or as fast as scipy.ndimage. Most of it is cythonized so it's not as easy as it seems. In fact, I'm usually unable to be faster than SciPy but it does happen on some functions.
  • avoid using unsafe. This is not an unbreakable rule. Its usage will be evaluated and dicussed in the pull requests.

Currently available routines include:

  • Filters: convolve/1d, correlate/1d, gaussian_filter/1d, min/max_filter/1d, median_filter, prewitt, sobel
  • Fourier filters: none. Please use the excellent rustfft crate
  • Interpolation: shift, spline_filter/1d, zoom
  • Measurements: label, label_histogram, largest_connected_components, most_frequent_label
  • Morphology: binary_closing, binary_dilation, binary_erosion, binary_opening. Works on all kernels (structuring elements).
  • Padding: Almost all modes. Work for all dimensions and types.

This crate is a work-in-progress. Only a subset of the scipy.ndimage functions are provided and most of them offer less options than SciPy. Some are offered only in 3D, with less boundary modes, with only 2 types of structuring element, only for binary data, only for f64, etc.

Using with Cargo

[dependencies]
ndarray = "0.15"
ndarray-ndimage = "0.2"

Contributing

ndarray-ndimage needs your help to grow. Please feel free to create issues and submit PRs. Since it is based on scipy.ndimage, it is easy to port new functions and tests. Reading Cython code is highly unpleasant; the joy comes from porting it to Rust!

License

Licensed under the Apache License, Version 2.0 http://www.apache.org/licenses/LICENSE-2.0 or the MIT license http://opensource.org/licenses/MIT, at your option. This file may not be copied, modified, or distributed except according to those terms.

Dependencies

~3.5MB
~59K SLoC