[R-pkgs] New package for morphology and smoothing in any number of dimensions: mmand

From: Jon Clayden <jon.clayden_at_gmail.com>
Date: Mon, 30 Apr 2012 17:17:50 +0100


Dear all,

I'm pleased to announce the release on CRAN of the "mmand" package (for Mathematical Morphology in Any Number of Dimensions). It provides functions for performing mathematical morphology (erode, dilate, etc.), smoothing, and other kernel-based operations on array-like objects of any dimensionality. The package is centred around a flexible function called morph(), which can apply any kernel to array elements, optionally conditioned on their value or number of nonzero neighbours.

Operations such as erode and dilate are provided for 2D data by the EBImage Bioconductor package, but mmand can be used for higher (and lower!) dimensional data, can produce and apply anisotropic kernels, and does not have external dependencies--except for the small, pure R package "reportr" (also on CRAN), which is used for message reporting.

Owing to its more general, dimensionality-independent implementation, mmand is a little slower than EBImage; but due to various performance optimisations, run time is still very reasonable. For example:

> x <- EBImage::readImage(system.file("images", "shapes.png", package="EBImage"))
> k <- matrix(1,3,3)
>
> y1 <- EBImage::erode(x,k)
> y2 <- mmand::erode(x,k)
> identical(EBImage::imageData(y1),y2)

[1] TRUE
>
> system.time(for(i in 1:100) EBImage::closing(x,k))
  user system elapsed
 1.791 0.047 1.837
> system.time(for(i in 1:100) mmand::closing(x,k))
  user system elapsed
 3.267 0.018 3.287

A single closing (dilate followed by erode) operation therefore takes around 1/30th of a second in this case.

I hope that this contribution will be useful.

All the best,
Jon



R-packages mailing list
R-packages_at_r-project.org
https://stat.ethz.ch/mailman/listinfo/r-packages Received on Tue 01 May 2012 - 02:38:22 EST

This archive was generated by hypermail 2.2.0 : Tue 01 May 2012 - 02:40:02 EST