Creating flat_lh.gii file for cortex.webgl.show

I’m attempting to create a full surfaces folder in the filestore based on the example, with flat_lh.gii, inflated_lh.gii, pia_lh.gii, wm_lh.gii, and those for the right hemisphere in order to use cortex.quickshow, plt.show, and cortex.webgl.show.

I used cortex.freesurfer.flatten to create files lh.full.flat.patch.3d and rh.full.flat.patch.3d from lh.full.patch.3d that I created from making cuts. I want to convert these files to flat_lh.gii, but mris_convert gives me segmentation fault errors.

mris_convert lh.full.flat.patch.3d flat_lh.gii

ASSERTION FAILED: /Users/developer/space_freesurfer/build/tulum/trunk/developer-7.1.1/utils/mrisurf_metricProperties.cpp:4323 mris->dist_nsize == 0

ASSERTION FAILED: /Users/developer/space_freesurfer/build/tulum/trunk/developer-7.1.1/utils/mrisurf_metricProperties.cpp:4323 mris->dist_nsize == 0

Segmentation fault: 11

cortex.freesurfer.import_flat with lh.full.flat.patch.3d gives me ValueError: cannot reshape array of size 409586 into shape (3).

My overall goal is to display using cortex.webgl.show. Is creating these files the correct approach and if so, are there any instructions explaining possible steps?

It seems that one needs to use the -p option to indicate that the input is a patch, as explained in this email from Freesurfer’s mail archive:

mris_convert -p lh.full.flat.patch.3d flat_lh.gii

Without this, I was getting:

  • ValueError: cannot reshape array of size 733591 into shape (3) when trying to load lh.full.flat.patch.3d with the freesurfer module from nibabel
  • a memory error when trying to run mris_convert on my local machine