Skip to content

351 surface genetic expression is broken with current versions of#374

Merged
zihuaihuai merged 8 commits intomasterfrom
351-surface_genetic_expression-is-broken-with-current-versions-of
Nov 26, 2025
Merged

351 surface genetic expression is broken with current versions of#374
zihuaihuai merged 8 commits intomasterfrom
351-surface_genetic_expression-is-broken-with-current-versions-of

Conversation

@zihuaihuai
Copy link
Collaborator

Summary

Fixed the float64 to float32 dtype issue that was causing GIFTI writing to fail.

Changes

Cast surface Points to float32 before writing to GIFTI format
Added dtype check to avoid unnecessary conversions
Make a copy of the surface to avoid modifying the original data

Why

The surface_genetic_expression function was failing because surface coordinate data was in float64 format, but the GIFTI standard only supports uint8, int32, and float32 datatypes. This caused a ValueError when writing surfaces to GIFTI format.

Testing

The fix ensures that surface data is properly converted to GIFTI-compatible format before writing. Test case included with the fix

close #351

- Cast surface Points to float32 before writing to GIFTI format
- GIFTI standard only supports uint8, int32, and float32 datatypes
- Fixes ValueError: 'Data array has type float64'

Fixes #351
@zihuaihuai zihuaihuai linked an issue Nov 25, 2025 that may be closed by this pull request
@github-actions github-actions bot added the Python On the Python implementation label Nov 25, 2025
@zihuaihuai
Copy link
Collaborator Author

Also fixed compatibility issues with abagen 0.1.3 running on Python 3.13 with pandas 2.x and nibabel 5.x.

@zihuaihuai zihuaihuai merged commit c5ead6d into master Nov 26, 2025
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Python On the Python implementation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

surface_genetic_expression is broken with current versions of

1 participant