Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Writing to GIfTI with face index stored as float results in errors #33

Closed
dipterix opened this issue Sep 13, 2024 · 2 comments
Closed

Comments

@dipterix
Copy link
Contributor

dipterix commented Sep 13, 2024

Hi @dfsp-spirit , I recently encountered an issue when saving geometry when faces storage is not integer. Here's an reproducible example:

mesh <- rgl::icosahedron3d(diag(c(50, 50, 50, 1)))
f <- tempfile()

faces <- t(mesh$it)
faces[1:4, ]
#>       [,1] [,2] [,3]
#>  [1,]    1    3    9
#>  [2,]    1    9    5
#>  [3,]    1    5    7
#>  [4,]    1    7   10

# storage.mode(faces) <- "double"
freesurferformats::write.fs.surface.gii(
  filepath = f,
  vertex_coords = t(mesh$vb[1:3, ]),
  faces = faces
)

m <- freesurferformats::read.fs.surface.gii(f)

m$faces[1:4, ]
#>             [,1]       [,2]       [,3]
#>  [1,]          1 1073741825 1090519041
#>  [2,]          1 1090519041 1082130433
#>  [3,]          1 1082130433 1086324737
#>  [4,]          1 1086324737 1091567617

The issue was caused due to writing faces as float and then read back as integer32. A PR has been opened last night for this. #32.

Please let me know if anything is needed.

@dfsp-spirit
Copy link
Owner

Thanks, I'll have a look and let you know.

@dfsp-spirit
Copy link
Owner

I merged the PR, this will be part of the next release.

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

No branches or pull requests

2 participants