help > Error in viewing Surf Ice mesh by fsleyes
Showing 1-4 of 4 posts
Display:
Results per page:
Oct 16, 2019  07:10 AM | Yong Li
Error in viewing Surf Ice mesh by fsleyes
Dear Chris and colleagues,

Thank you for the nice Surf Ice.

I used 'Advanced/ConvertVoxelwiseVolumeToMes' of Surf Ice (v1.0.20190720 64-bit Linux (Legacy OpenGL)) to create GIFTI meshes but encountered error while viewing them in fsleyes (0.31.0+build0).

The error message is 'Details: not well-formated (invalid token): line 1, column 5.

Could you please help me out? And is it possible to provide python example code to use 'Advanced/ConvertVoxelwiseVolumeToMes' function, e.g., ROI.nii as input and ROI.gii as output? Thank you very much in advance!

Best regards,

Yong
Oct 16, 2019  04:10 PM | Chris Rorden
RE: Error in viewing Surf Ice mesh by fsleyes
Yong,

1.) The menu item Scripting/Python/Help will print out all of the in-built Python functions and arguments for each. The function you are interested in is "meshcreate", where you supply an input voxelwise image, output mesh name, voxel intensity threshold, mesh reduction factor, minimum cluster size and smoothing style (0=none, 1=masked, 2=smoothed). So a minimal mesh creation would look like this: 

import gl
gl.meshcreate('/usr/local/fsl/data/standard/avg152T1_brain.nii.gz', '~/mymesh.gii', 5200, 0.2, 1, 1)

2.) I am not sure why FSLeyes can not read these GIfTI files. Perhaps it requires manifold volumes or has other expectations. You can view the GIfTI image with Surfice or with Matlab using this library
  https://www.artefact.tk/software/matlab/gifti/
I am happy to extend the file if I can add tags that help FSLeyes, but to my eyes it looks like a valid GIfTI image.

g = gifti('mymesh.gii')

>> g = gifti('mymesh.gii')
g =
struct with fields:
faces: [21973×3 int32]
mat: [4×4 double]
vertices: [10937×3 single]
>> figure; plot(g);
Oct 16, 2019  05:10 PM | Chris Rorden
RE: Error in viewing Surf Ice mesh by fsleyes
Paul McCarthy notes that you can use a text editor to change the first line of the GIfTI file to help FSLeyes out. The next version of Surfice will do this for you. Simply change the line as shown below (this forum has issues with xml text formatting):
Attachment: xml.png
Oct 17, 2019  08:10 AM | Yong Li
RE: Error in viewing Surf Ice mesh by fsleyes
Thank you, Chris! Thank you, Paul! All works out nicely.

Best regards,

Yong