Skip to content

Variable (per-point) search radii #12

@SlapDrone

Description

@SlapDrone

Hey folks,

I was wondering whether one could easily support a per-point search radius (precomputed from optimal neighbourhood in PDAL) for calculating the geometric features.

I had a crack at it with this commit on a fork, as I thought it would be relatively straightforward to just extend the float to an array. But I am not well-versed enough in cython and c++ extensions to python to really effectively understand what went wrong.

In building the c++ extension I get:

  × Building wheel for jakteristics (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [21 lines of output]
      running bdist_wheel
      running build
      running build_py
      copying jakteristics/main.py -> build/lib.linux-x86_64-cpython-310/jakteristics
      copying jakteristics/utils.cpp -> build/lib.linux-x86_64-cpython-310/jakteristics
      copying jakteristics/extension.cpp -> build/lib.linux-x86_64-cpython-310/jakteristics
      running build_ext
      building 'jakteristics.extension' extension
      gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -DNPY_NO_DEPRECATED_API=1 -I/tmp/pip-build-env-9kki0rhb/overlay/lib/python3.10/site-packages/numpy/core/include -Ijakteristics/ckdtree/ckdtree/src -Ijakteristics/ckdtree/_lib -I/home/liam/projects/jakteristics/.venv/include -I/home/liam/.pyenv/versions/3.10.8/include/python3.10 -c jakteristics/ckdtree/ckdtree/src/query_ball_point.cxx -o build/temp.linux-x86_64-cpython-310/jakteristics/ckdtree/ckdtree/src/query_ball_point.o -fopenmp
      gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -DNPY_NO_DEPRECATED_API=1 -I/tmp/pip-build-env-9kki0rhb/overlay/lib/python3.10/site-packages/numpy/core/include -Ijakteristics/ckdtree/ckdtree/src -Ijakteristics/ckdtree/_lib -I/home/liam/projects/jakteristics/.venv/include -I/home/liam/.pyenv/versions/3.10.8/include/python3.10 -c jakteristics/extension.cpp -o build/temp.linux-x86_64-cpython-310/jakteristics/extension.o -fopenmp
      jakteristics/extension.cpp: In function ‘PyObject* __pyx_pf_12jakteristics_9extension_compute_features(PyObject*, __Pyx_memviewslice, __Pyx_memviewslice, __pyx_obj_12jakteristics_7ckdtree_7ckdtree_cKDTree*, int, int, int, PyObject*, float)’:
      jakteristics/extension.cpp:3905:99: error: assignment of read-only location ‘* __pyx_temp_pointer’
       3905 |                                         *((__pyx_t_5numpy_float64_t const  *) __pyx_temp_pointer) = __pyx_temp_scalar;
            |                                         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~
      jakteristics/extension.cpp:3988:71: warning: comparison of integer expressions of different signedness: ‘uint32_t’ {aka ‘unsigned int’} and ‘int’ [-Wsign-compare]
       3988 |                               __pyx_t_9 = ((__pyx_v_n_neighbors_at_id > __pyx_v_max_k_neighbors) != 0);
            |                                             ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
      jakteristics/extension.cpp:4048:63: warning: comparison of integer expressions of different signedness: ‘int’ and ‘uint32_t’ {aka ‘unsigned int’} [-Wsign-compare]
       4048 |                               for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_27; __pyx_t_10+=1) {
            |                                                    ~~~~~~~~~~~^~~~~~~~~~~~
      error: command '/usr/bin/gcc' failed with exit code 1
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for jakteristics
Failed to build jakteristics
ERROR: Could not build wheels for jakteristics, which is required to install pyproject.toml-based projects

Figured i'd give you a ping in case the answer is obvious to you devs. It'll take me quite some time to pick through and figure out what's going on.

Happy to open a PR if this is fixable and useful.

Cheers!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions