Skip to content

Commit

Permalink
Merge branch 'dev' into hotfix-version-mismatch
Browse files Browse the repository at this point in the history
  • Loading branch information
ma-sadeghi authored Mar 13, 2024
2 parents b08a0f2 + b95bec3 commit 7db9b42
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/porespy/__version__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '2.4.1'
__version__ = '2.4.1.dev1'
25 changes: 20 additions & 5 deletions src/porespy/visualization/_views.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import numpy as np
import scipy.ndimage as spim
from numba import njit, prange
# from mpl_toolkits.mplot3d.art3d import Poly3DCollection


Expand Down Expand Up @@ -142,11 +143,25 @@ def sem(im, axis=0): # pragma: no cover
im = np.transpose(im, axes=[1, 0, 2])
if axis == 2:
im = np.transpose(im, axes=[2, 1, 0])
t = im.shape[0]
depth = np.reshape(np.arange(0, t), [t, 1, 1])
im = im*depth
im = np.amax(im, axis=0)
return im
return _sem_parallel(im)


@njit(parallel=True)
def _sem_parallel(im): # pragma: no cover
r"""
This function is called `sem` to compute the height of the first
voxel in each x, y column. It uses numba for speed, and is
parallelized.
"""
shape=im.shape
depth = np.zeros(shape[:2])
for x in prange(shape[0]):
for y in prange(shape[1]):
for z in range(shape[2]-1, 0, -1):
if not im[x][y][z]:
depth[x][y]=z
break
return depth


def xray(im, axis=0): # pragma: no cover
Expand Down

0 comments on commit 7db9b42

Please sign in to comment.