Code Monkey home page Code Monkey logo

pystrum's People

Contributors

adalca avatar ahoopes avatar mu40 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

pystrum's Issues

Pystrum is incompatible with `numpy==1.24` due to `AttributeError` from now-removed `np.bool`

The usage of np.bool is here:

def sphere_vol(vol_shape, radius, center=None, dtype=np.bool):

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.)

Doesn't support PEP 517 – A build-system independent format for source trees

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.

Where is pytools.patchlib

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?

Speeding up bw2contour

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                                             `

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.