DIPlib / diplib

Quantitative Image Analysis in C++, MATLAB and Python
https://diplib.org
Apache License 2.0
211 stars 48 forks source link

Occasional segfault in RadonTransformCircles #149

Closed anntzer closed 3 months ago

anntzer commented 3 months ago

Component diplib 3.4.1 installed from PyPI.

Describe the bug RadonTransformCircles sometimes segfaults. This appears to occur nondeterministically depending on the input.

To Reproduce

for it in $(seq 0 100); do
    python -c 'import diplib as d, numpy as np; np.random.seed(18); d.RadonTransformCircles(np.random.randn(100, 100), mode="projection", options={"hollow"})' ||
        echo "fail at iteration $it"
done

This appears to fail every couple of iterations, even though the input is always the same (np.random.seed + np.random.randn is just used to generate a fixed input. The error message is

Fatal Python error: Segmentation fault

Current thread 0x00000001fbcf7ac0 (most recent call first):
  File "<string>", line 1 in <module>

Extension modules: numpy.core._multiarray_umath, numpy.core._multiarray_tests, numpy.linalg._umath_linalg, numpy.fft._pocketfft_internal, numpy.random._common, numpy.random.bit_generator, numpy.random._bounded_integers, numpy.random._mt19937, numpy.random.mtrand, numpy.random._philox, numpy.random._pcg64, numpy.random._sfc64, numpy.random._generator (total: 13)

System information:

crisluengo commented 3 months ago

Thank you for pointing this out! It's a simple fix, but what to fix was not easy to figure out. :)

crisluengo commented 3 months ago

If you upgrade to 3.4.3, this issue will be fixed.