def buildMeshImage(vertices, faces, encoding=GiftiEncoding.GIFTI_ENCODING_ASCII): """ build a GiftiImage from arrays of vertices and faces NOTE : this is doing the same as the gifti.GiftiImage_fromTriangles function and is only redefined here for demonstration purpose""" k = GiftiImage_fromarray(vertices) k.arrays[0].intentString = "NIFTI_INTENT_POINTSET" k.addDataArray_fromarray(faces, GiftiIntentCode.NIFTI_INTENT_TRIANGLE) for a in k.arrays: a.encoding = encoding return k