本文整理汇总了Python中utility.Utility.write_freesurfer_curvature方法的典型用法代码示例。如果您正苦于以下问题:Python Utility.write_freesurfer_curvature方法的具体用法?Python Utility.write_freesurfer_curvature怎么用?Python Utility.write_freesurfer_curvature使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类utility.Utility
的用法示例。
在下文中一共展示了Utility.write_freesurfer_curvature方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: close_file
# 需要导入模块: from utility import Utility [as 别名]
# 或者: from utility.Utility import write_freesurfer_curvature [as 别名]
def close_file(self, left_hemi_file, right_hemi_file, left_curvature_output_file, right_curvature_output_file):
'''
'''
m = numpy.ctypeslib.as_array(self.__matrix.get_obj())
m = m.reshape(self.__shape)
#here
lh_vertices, lh_faces = nibabel.freesurfer.read_geometry( left_hemi_file )
rh_vertices, rh_faces = nibabel.freesurfer.read_geometry( right_hemi_file )
sum_vector = numpy.sum( m, axis=0 )
import sys, os
sys.path.append(os.path.join( os.path.dirname( __file__ ),'../'))
from utility import Utility
# write curvature files
Utility.write_freesurfer_curvature( left_curvature_output_file, sum_vector[0:len( lh_vertices )] )
Utility.write_freesurfer_curvature( right_curvature_output_file, sum_vector[len( lh_vertices ):] ) # here we start with the offset
# end here
print 'crv written!!! FTW!'
numpy.save( self.__matrix_file, m)
print 'stored matrix'
示例2: create_curvature_files
# 需要导入模块: from utility import Utility [as 别名]
# 或者: from utility.Utility import write_freesurfer_curvature [as 别名]
def create_curvature_files( matrix_file, left_hemi_file, right_hemi_file, left_curvature_output_file, right_curvature_output_file, manual=False ):
'''
'''
# load the surfaces to compute the offsets correctly
# as a reminder: the offset for the right hemisphere is the number of vertices in the left hemisphere
# else-wise the vertex indices for right would start at 0 again
lh_vertices, lh_faces = nibabel.freesurfer.read_geometry( left_hemi_file )
rh_vertices, rh_faces = nibabel.freesurfer.read_geometry( right_hemi_file )
# load the connectivity matrix
#m = numpy.loadtxt( matrix_file, dtype=numpy.uint16 )
m = numpy.load(matrix_file)
sum_vector = numpy.sum( m, axis=0 )
# write curvature files
Utility.write_freesurfer_curvature( left_curvature_output_file, sum_vector[0:len( lh_vertices )] )
Utility.write_freesurfer_curvature( right_curvature_output_file, sum_vector[len( lh_vertices ):] ) # here we start with the offset