| 1 |   [](http://pypi.python.org/pypi/scikit-fmm)[](https://scikit-fmm.readthedocs.io/en/latest/?badge=latest) <a href="https://pepy.tech/project/scikit-fmm"><img alt="Downloads" src="https://pepy.tech/badge/scikit-fmm"></a> |
| 2 | |
| 3 | # scikit-fmm: the fast marching method for Python |
| 4 | |
| 5 | `scikit-fmm` is a Python extension module which implements the fast marching method. |
| 6 | The fast marching method is used to model the evolution of boundaries |
| 7 | and interfaces in a variety of application areas. More specifically, |
| 8 | the fast marching method is a numerical technique for finding |
| 9 | approximate solutions to boundary value problems of the Eikonal |
| 10 | equation: |
| 11 | |
| 12 | F(x) | grad T(x) | = 1 |
| 13 | |
| 14 | Typically, such a problem describes the evolution of a closed curve as |
| 15 | a function of time T with speed F(x)>0 in the normal direction at a |
| 16 | point x on the curve. The speed function is specified, and the time at |
| 17 | which the contour crosses a point x is obtained by solving the |
| 18 | equation. |
| 19 | |
| 20 | scikit-fmm is a simple module which provides functions to calculate |
| 21 | the signed distance and travel time to an interface described by the |
| 22 | zero contour of the input array phi. |
| 23 | |
| 24 | ```python |
| 25 | import skfmm |
| 26 | import numpy as np |
| 27 | phi = np.ones((3, 3)) |
| 28 | phi[1, 1] = -1 |
| 29 | skfmm.distance(phi) |
| 30 | ``` |
| 31 | |
| 32 | ```python |
| 33 | array([[ 1.20710678, 0.5 , 1.20710678], |
| 34 | [ 0.5 , -0.35355339, 0.5 ], |
| 35 | [ 1.20710678, 0.5 , 1.20710678]]) |
| 36 | ``` |
| 37 | --- |
| 38 | ```python |
| 39 | skfmm.travel_time(phi, speed = 3.0 * np.ones_like(phi)) |
| 40 | ``` |
| 41 | |
| 42 | ```python |
| 43 | array([[ 0.40236893, 0.16666667, 0.40236893], |
| 44 | [ 0.16666667, 0.11785113, 0.16666667], |
| 45 | [ 0.40236893, 0.16666667, 0.40236893]]) |
| 46 | ``` |
| 47 | --- |
| 48 | |
| 49 | The input array can be of 1, 2, 3 or higher dimensions and can be a |
| 50 | masked array. A function is provided to compute extension velocities. |
| 51 | |
| 52 | ### Documentation |
| 53 | * http://scikit-fmm.readthedocs.org/en/master/ |
| 54 | |
| 55 | ### PyPI |
| 56 | * http://pypi.python.org/pypi/scikit-fmm |
| 57 | |
| 58 | ### Requirements |
| 59 | * NumPy |
| 60 | * Building requires the pypa/build module |
| 61 | (https://github.com/pypa/build) and a C/C++ compiler |
| 62 | ### Bugs, questions, patches, feature requests, discussion & cetera |
| 63 | * Open a GitHub pull request or a GitHub issue |
| 64 | * Email list: http://groups.google.com/group/scikit-fmm |
| 65 | * Send an email to [email protected] to subscribe. |
| 66 | |
| 67 | ### Installing |
| 68 | * Via pip: `pip install scikit-fmm` |
| 69 | * Anaconda linux-64 and linux-ppc64le packages: |
| 70 | * `conda install scikit-fmm` |
| 71 | * Ubuntu PPA |
| 72 | * https://launchpad.net/~nvidia-digits/+archive/ubuntu/dev |
| 73 | * Debian |
| 74 | * https://tracker.debian.org/pkg/scikit-fmm |
| 75 | |
| 76 | ### Building and installing from Source |
| 77 | * `pip install build` |
| 78 | * `python -m build` |
| 79 | * `pip install .` |
| 80 | |
| 81 | |
| 82 | ### Running Tests |
| 83 | * `python -c "import skfmm; skfmm.test(True)"` (Do not run the tests from the source directory.) |
| 84 | * Tests are doctests in `skfmm/__init__.py` |
| 85 | |
| 86 | ### Building documentation |
| 87 | * Requires sphinx and numpydoc |
| 88 | * `make html` |
| 89 | |
| 90 | ### Publications using scikit-fmm |
| 91 | |
| 92 | * Akinola, I., J Varley, B. Chen, and P.K. Allen |
| 93 | (2018) "Workspace Aware Online Grasp Planning" arXiv:1806.11402v1 |
| 94 | [cs.RO] 29 Jun 2018 https://arxiv.org/pdf/1806.11402.pdf |
| 95 | |
| 96 | * Bortolussi, V., B. Figliuzzi, F. Willot, M. |
| 97 | Faessel, M. Jeandin (2018) "Morphological modeling of cold spray |
| 98 | coatings" Image Anal Stereol 2018;37:145-158 doi:10.5566/ias.1894 |
| 99 | https://hal.archives-ouvertes.fr/hal-01837906/document |
| 100 | |
| 101 | * Chalmers, S., C.D. Saunter, J.M. Girkin and J.G. McCarron (2016) |
| 102 | "Age decreases mitochondrial motility and increases mitochondrial |
| 103 | size in vascular smooth muscle." Journal of Physiology, 594.15 pp |
| 104 | 4283–4295. |
| 105 | |
| 106 | * Diogo Brandão Amorim (2014) "Efficient path planning of a mobile |
| 107 | robot on rough terrain" Master's Thesis, Department of Aerospace |
| 108 | Engineering, University of Lisbon. |
| 109 | |
| 110 | * Giometto, A., D.R. Nelson, and A.W. Murray (2018) |
| 111 | "Physical interactions reduce the power of natural selection in |
| 112 | growing yeast colonies", PNAS November 6, 2018 115 (45) 11448-11453; |
| 113 | published ahead of print October 23, 2018 |
| 114 | https://doi.org/10.1073/pnas.1809587115 |
| 115 | |
| 116 | * Joshua A. Taillon, Christopher Pellegrinelli, Yilin Huang, Eric D. |
| 117 | Wachsman, and Lourdes G. Salamanca-Riba (2014) "Three Dimensional |
| 118 | Microstructural Characterization of Cathode Degradation in SOFCs |
| 119 | Using Focused Ion Beam and SEM" ECS Trans. 2014 61(1): 109-120; |
| 120 | https://www.joshuataillon.com/pdfs/2015-08-06%20jtaillon%203D%20SOFC%20cathode%20degradation.pdf |
| 121 | |
| 122 | * Marshak, C., I. Yanovsky, and L. Vese (2017) "Energy |
| 123 | Minimization for Cirrus and Cumulus Cloud Separation in Atmospheric |
| 124 | Images" IGARSS 2018 - 2018 IEEE International Geoscience and Remote |
| 125 | Sensing Symposium DOI: 10.1109/IGARSS.2018.8517940 |
| 126 | ftp://ftp.math.ucla.edu/pub/camreport/cam17-68.pdf |
| 127 | |
| 128 | * Moon, K. R., V. Delouille, J.J. Li, R. De Visscher, F. Watson and |
| 129 | A.O. Hero III (2016) "Image patch analysis of sunspots and active |
| 130 | regions." J. Space Weather Space Clim., 6, A3, DOI: |
| 131 | 10.1051/swsc/2015043. |
| 132 | |
| 133 | * Tao, M., J. Solomon and A. Butscher (2016) "Near-Isometric Level Set |
| 134 | Tracking." in Eurographics Symposium on Geometry Processing 2016 |
| 135 | Eds: M. Ovsjanikov and D. Panozzo. Volume 35 (2016), Number 5 |
| 136 | |
| 137 | * Thibaut, R., Laloy, E., Hermans, T., 2021. A new framework for |
| 138 | experimental design using Bayesian Evidential Learning: The |
| 139 | case of wellhead protection area. J. Hydrol. 603, 126903. |
| 140 | https://doi.org/10.1016/j.jhydrol.2021.126903 |
| 141 | |
| 142 | * Vargiu, Antioco, M. Marrocu, L. Massidda (2015) "Implementazione e |
| 143 | valutazione su un caso reale del servizio di Cloud Computing per la |
| 144 | simulazione di incendi boschivi in Sardegna" (Implementation and |
| 145 | evaluation on a real case of Cloud computing service for simulation |
| 146 | of Forest fires in Sardinia). Sardinia Department of Energy and |
| 147 | Environment. CRS4 PIA 2010 D5.4. |
| 148 | |
| 149 | * Wronkiewicz, M. (2018) "Mapping buildings with help from machine |
| 150 | learning" Medium article, June 29th 2018 |
| 151 | https://medium.com/devseed/mapping-buildings-with-help-from-machine-learning-f8d8d221214a |
| 152 | |
| 153 | * Makki, K., Ben Salem, D., Ben Amor, B. (2021) "Toward the Assessment |
| 154 | of Intrinsic Geometry of Implicit Brain MRI Manifolds" IEEE Access, |
| 155 | volume 9, pages 131054 - 131071 (September 2021) |
| 156 | DOI: 10.1109/ACCESS.2021.3113611 |
| 157 | https://ieeexplore.ieee.org/abstract/document/9540688 |
| 158 | |
| 159 | ### Version History: |
| 160 | * 0.0.1: February 13 2012 |
| 161 | * Initial release |
| 162 | * 0.0.2: February 26th 2012 |
| 163 | * Including tests and docs in source distribution. Minor changes to |
| 164 | documentation. |
| 165 | * 0.0.3: August 4th 2012 |
| 166 | * Extension velocities. |
| 167 | * Fixes for 64 bit platforms. |
| 168 | * Optional keyword argument for point update order. |
| 169 | * Bug reports and patches from three contributors. |
| 170 | * 0.0.4: October 15th 2012 |
| 171 | * Contributions from Daniel Wheeler: |
| 172 | * Bug fixes in extension velocity. |
| 173 | * Many additional tests and migration to doctest format. |
| 174 | * Additional optional input to extension_velocities() for FiPy compatibly. |
| 175 | * 0.0.5: May 12th 2014 |
| 176 | * Fix for building with MSVC (Jan Margeta). |
| 177 | * Corrected second-order point update. |
| 178 | * 0.0.6: February 20th 2015 |
| 179 | * Documentation clarification (Geordie McBain). |
| 180 | * Python 3 port (Eugene Prilepin). |
| 181 | * Python wrapper for binary min-heap. |
| 182 | * Freeze equidistant narrow-band points simultaneously. |
| 183 | * 0.0.7: October 21st 2015 |
| 184 | * Bug fix to upwind finite difference approximation for negative |
| 185 | phi from Lester Hedges. |
| 186 | * 0.0.8: March 9th 2016 |
| 187 | * Narrow band capability: an optional "narrow" keyword argument |
| 188 | limits the extent of the marching algorithm (Adrian Butscher). |
| 189 | * 0.0.9: August 5th 2016 |
| 190 | * Periodic boundaries: an optional "periodic" keyword argument |
| 191 | enables periodic boundaries in one or more directions (Wolfram Moebius). |
| 192 | * 2019.1.30 January 30th 2019 |
| 193 | * Abrupt change to version numbering scheme. |
| 194 | * Bugfix in setup.py to allow installing via pip with numpy (ManifoldFR). |
| 195 | * Handle C++ exceptions during fast marching (Jens Glaser). |
| 196 | * Accept a zero discriminant in travel time point update. |
| 197 | * 2021.1.20 January 20th 2021 |
| 198 | * Fix divide by zero bugs in travel_time and extension_velocities |
| 199 | * Contributions from Murray Cutforth, f-fanni, and okonrad |
| 200 | * 2021.1.21 January 21st 2021 |
| 201 | * Minor C++ change (removed the auto keyword) to fix the compile on TravisCI. |
| 202 | * 2021.2.2 February 2nd 2021 |
| 203 | * Add a pyproject.toml file to specify numpy as a build |
| 204 | requirement, this is needed to build with new version of pip |
| 205 | (David Parsson). |
| 206 | * 2021.7.8 July 8th 2021 |
| 207 | * Add a pyproject.toml file to the MANIFEST.in file to fix the |
| 208 | numpy build dependency (David Parsson). Fix numpy deprecation |
| 209 | warnings and improve source code formatting (Robin Thibaut). |
| 210 | * 2021.9.23 September 23rd 2021 |
| 211 | * Make the pyproject.toml file specify the oldest supported |
| 212 | numpy as a build requirement, to allow using wheels with any |
| 213 | numpy version. |
| 214 | (David Parsson). |
| 215 | * 2021.10.29 October 29th 2021 |
| 216 | * Fix for point update discriminant exactly equal to zero |
| 217 | * Fall back calculation for point update when discriminant becomes negative |
| 218 | * (Joshua Gehre) |
| 219 | * 2022.02.02 February 2nd 2022 |
| 220 | * Fixes for Python 3.10 compatibility |
| 221 | * (Amin Sadeghi, Xylar Asay-Davis, David Parsson) |
| 222 | * 2022.03.26 March 26th 2022 |
| 223 | * Following the breaking changes in setuptools v61.0.0 it is |
| 224 | suggested to set py_modules to disable auto-discovery behavior. |
| 225 | * (Daniel Ammar) |
| 226 | * 2022.08.15 August 15th 2022 |
| 227 | * Following the breaking changes in setuptools v65 pin setuptools |
| 228 | to v64 |
| 229 | * (DorSSS) |
| 230 | * 2022.04.02 April 2nd 2023 |
| 231 | * Build fixes for Python 3.11 (update pheap cython wrapper) |
| 232 | * No solver changes |
| 233 | * 2024.05.29 May 29th 2024 |
| 234 | * Update build system to use meson |
| 235 | * Python 3.12 support |
| 236 | * No solver changes |
| 237 | * 2025.01.29 January 29th 2025 |
| 238 | * NumPy 2.0 support on Linux and Windows |
| 239 | * Update to Github workflows to use v4 api |
| 240 | * Windows wheels |
| 241 | * Support for Python 3.13 |
| 242 | * 2025.01.29 June 23rd 2025 |
| 243 | * Fixes for deprecated NumPy API and Python 3.11 |
| 244 | * Github Workflow fixes |
| 245 | |
| 246 | |
| 247 | |
| 248 | Copyright 2025 The scikit-fmm team. |
| 249 | |
| 250 | BSD-style license. See LICENSE.txt in the source directory. |