adalca / pystrum Goto Github PK
View Code? Open in Web Editor NEWA general library of python tools
A general library of python tools
The usage of np.bool
is here:
pystrum/pystrum/pynd/ndutils.py
Line 581 in 8cd5c48
np.bool
was removed in numpy==1.24
:
The deprecation for the aliases np.object, np.bool, np.float,
np.complex, np.str, and np.int is expired (introduces NumPy
1.20). Some of these will now give a FutureWarning in addition to
raising an error since they will be mapped to the NumPy scalars in
the future. (numpy/numpy#22607)
When importing pystrum
(or even importing downstream dependencies like neurite
), the following error will be thrown:
File "/home/runner/work/spinalcordtoolbox/spinalcordtoolbox/python/envs/venv_sct/lib/python3.8/site-packages/voxelmorph/__init__.py", line 12, in <module>
import neurite
File "/home/runner/work/spinalcordtoolbox/spinalcordtoolbox/python/envs/venv_sct/lib/python3.8/site-packages/neurite/__init__.py", line 19, in <module>
import pystrum
File "/home/runner/work/spinalcordtoolbox/spinalcordtoolbox/python/envs/venv_sct/lib/python3.8/site-packages/pystrum/__init__.py", line 3, in <module>
from . import pynd
File "/home/runner/work/spinalcordtoolbox/spinalcordtoolbox/python/envs/venv_sct/lib/python3.8/site-packages/pystrum/pynd/__init__.py", line 1, in <module>
from . import ndutils
File "/home/runner/work/spinalcordtoolbox/spinalcordtoolbox/python/envs/venv_sct/lib/python3.8/site-packages/pystrum/pynd/ndutils.py", line 581, in <module>
def sphere_vol(vol_shape, radius, center=None, dtype=np.bool):
File "/home/runner/work/spinalcordtoolbox/spinalcordtoolbox/python/envs/venv_sct/lib/python3.8/site-packages/numpy/__init__.py", line 284, in __getattr__
raise AttributeError("module {!r} has no attribute "
AttributeError: module 'numpy' has no attribute 'bool'
As for how to fix this issue: np.bool
is just an alias to the built-in bool
type. (More information about the deprecation can be found here.)
poetry install fails
143│
144│ error = ChefBuildError("\n\n".join(message_parts))
145│
146│ if error is not None:
→ 147│ raise error from None
148│
149│ return path
150│
151│ def _prepare_sdist(self, archive: Path, destination: Path | None = None) -> Path:
Note: This error originates from the build backend, and is likely not a problem with poetry but with pystrum (0.3) not supporting PEP 517 builds. You can verify this by running 'pip wheel --use-pep517 "pystrum (==0.3)"'.
This can be worked around with pip install pystrum
from in an activated poetry shell.
In generators.py of the 'neuron' module used by the 'brainstorm', pytools.patchlib was imported, but i cannot find it in pystrum, where is it?
bw2contour
performs a signed distance transform and seemed a bit sluggish when I ran it. Here's the logic I used instead. Basically, you can convolve a 3d indicator function (level_set
in the code) with the [-1, +2, -1]
kernel in the x, y, and z directions to extract the surface of that indicator function. Currently I return the interior surface, but trivial to modify for the exterior one.
lbl = np.zeros_like(seg)
kern = np.array([-1,+2,-1]).reshape([3]+[1]*(seg.ndim-1))
for k in range(1,self.numclass):
level_set = k * (seg == k)
conv = np.zeros_like(seg)
for i in range(0,seg.ndim):
filt = np.swapaxes(kern,0,i)
conv += np.abs(convolve(level_set, filt))
lbl += level_set * (conv > 0)
return lbl `
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.