Skip to content

Conversation

@m-reuter
Copy link
Member

Newer versions of SciPy seem to have forgotten the short functions .A() and .A1() for array conversion, so we call explicitly the long names.

@dkuegler
Copy link
Member

@taha-abdullah please test this with scipy 1.14.1

@taha-abdullah
Copy link
Contributor

I am getting the following error when I run this:

Traceback (most recent call last):
File "/fastsurfer/recon_surf/sample_parc.py", line 430, in
sample_parc(options.insurf, options.inseg, options.seglut, options.surflut, options.outaparc, options.incort, options.projmm, options.radius)
File "/fastsurfer/recon_surf/sample_parc.py", line 421, in sample_parc
smooths = smooth_aparc(surf, surfsamples, cortex)
File "/fastsurfer/recon_surf/smooth_aparc.py", line 335, in smooth_aparc
labels_new = mode_filter(adjM, labels, fillonlylabel, np.array([fillonlylabel]))
File "/fastsurfer/recon_surf/smooth_aparc.py", line 216, in mode_filter
sums = nlabels.sum(axis=1).toarray().squeeze()
AttributeError: 'matrix' object has no attribute 'toarray'
Command exited with non-zero status 1
@#@FSTIME 2024:08:23:11:00:19 recon_surf/sample_parc.py N 16 e 0.95 S 0.12 U 0.83 P 100% M 189276 F 0 R 51683 W 0 c 11 w 1 I 0 O 0 L 3.12 3.06 3.31
@#@FSLOADPOST 2024:08:23:11:00:20 recon_surf/sample_parc.py N 16 3.03 3.04 3.30

@dkuegler
Copy link
Member

This error is with scipy 1.14.1 u
I assume?

@m-reuter
Copy link
Member Author

I assumed that sum produces a sparse matrix just as max, but it produces a matrix, so array conversion is slightly different. I also fixed deprecated in1d. These changes have now been tested with numpy 2.1.0 and script 1.14.1 and yield identical results to the previous version in my test case.

@m-reuter m-reuter merged commit 3a31357 into dev Aug 26, 2024
@m-reuter m-reuter deleted the fix-array branch August 26, 2024 11:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants