Comments (5)
Hmm, I am not sure what you are asking. I see a purple background with a diagonal yellow band. Which one is the mask? Can you provide some code that demonstrates the problem?
The stencil that this method uses to update each point only looks in the cardinal directions. There are stencils that "look" in the diagonal directions.
from scikit-fmm.
Thank you for your reply. Here are some code snippets. I suspect, as you say, a stencil option would probably make diagonal movement possible - thank you again for any help.
import numpy as np
import numpy.ma as ma
import matplotlib.pyplot as plt
import skfmm
mask_diag = np.diag(np.ones(10))
mask_diag_buff = np.diag(np.ones(10)) + np.diag(np.ones(9), k=1)
init_mask = np.zeros((10, 10))
init_mask[:2, :2] = 1
fig, ax = plt.subplots(1, 3, figsize=(9, 3))
ax[0].imshow(mask_diag)
ax[0].set_title('Diagonal Mask')
ax[1].imshow(mask_diag_buff)
ax[1].set_title('Diagonal Mask with Superdiagonal')
ax[2].imshow(init_mask)
ax[2].set_title('Initialization Mask')
mask_diag = ~(mask_diag.astype(bool))
phi = ma.masked_array(np.ones(mask_diag.shape), mask=mask_diag)
phi.data[init_mask.astype(bool)] = 0
dist = skfmm.distance(phi)
mask_diag = ~(mask_diag_buff.astype(bool))
phi = ma.masked_array(np.ones(mask_diag.shape), mask=mask_diag)
phi.data[init_mask.astype(bool)] = 0
dist_buff = skfmm.distance(phi)
fig, ax = plt.subplots(1, 2, figsize=(8, 4))
ax[0].imshow(dist)
ax[0].set_title('Diagonal Mask')
ax[1].imshow(dist_buff)
ax[1].set_title('Diagonal Mask with Superdiagonal')
from scikit-fmm.
Yes, changing the stencil would be the only way to do this as far as I can tell. There is a paper that describes something similar: Multistencils Fast Marching Methods. http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.69.741&rep=rep1&type=pdf
The first- and second-order stencils used by scikit-fmm are baked into the c++ code in a fairly deep way. So adding new stencils would not be easy. I cannot look into this at the moment unfortunately, but I will keep this in mind for future developments.
If you want to experiment with different stencils, you could make a test implementation of FMM in Python. The binary min-heap provided by the module (skfmm.heap) is for just this purpose. Stay in touch if you get something working, it would be a nice feature to add.
from scikit-fmm.
I am preparing a paper using your package and will cite the github repo. I will also reference the paper for future developments that would improve some of the products I am generating and try to look into the heap method - that's awesome that its easy to experiment with from python.
Thank you for your help.
from scikit-fmm.
I am going to close this issue for now. If anything else come up, let me know.
from scikit-fmm.
Related Issues (20)
- Pip install broken on CIs HOT 4
- about cfmm HOT 1
- ValueError: the array phi contains no zero contour (no zero level set) HOT 1
- cannot import skfmm due to arm64 incompatibility? HOT 1
- Support for python 3.11 HOT 2
- Installation went well, but unable to import HOT 2
- Marching issue in a skeleton HOT 2
- numpy.distutils is no longer available in Python 3.12 HOT 26
- Inaccurate travel paths HOT 2
- Add a less formal introduction of FMM and what it can be used for in the README HOT 1
- error: Multiple top-level packages discovered in a flat-layout: ['skfmm', 'profile']. HOT 5
- Negative curvature of signed distance HOT 9
- a relevant way to cite scikit-fmm
- [Enhancement] Release GIL HOT 3
- Exact representation of contour HOT 13
- Incompatible to numpy 2.0 - numpy removed numpy/noprefix.h HOT 6
- pip instal scikit-fmm error HOT 1
- DEPENDENCY - Update code to use numpy 2.0 HOT 7
- Provide Wheels for scikit-fmm HOT 23
- WARNING: Failed to activate VS environment: Could not find C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from scikit-fmm.