예제 #1
0
 def _load_om_inverse_head_mat(self, file_name):
     """
     Load a previously stored inverse head matrix into an OpenMEEG SymMatrix
     object.
     """
     inverse_head_martix = om.SymMatrix()
     inverse_head_martix.load(file_name)
     return inverse_head_martix
예제 #2
0
v2 = om.Vertex(0., 1., 0., 1)
v3 = om.Vertex(0., 0., 1., 2)

#print v1.norm()
#print (v1 + v2).norm()

normal = om.Vect3(1., 0., 0.)
t = om.Triangle(v1, v2, v3)

hm_file = subject + '.hm'
hm.save(hm_file)

ssm_file = subject + '.ssm'
ssm.save(ssm_file)

m1 = om.SymMatrix()
m1.load(hm_file)
#print m1(0, 0)
#print m1.nlin()
#print m1.ncol()

m2 = om.Matrix()
m2.load(ssm_file)
#m2.setvalue(2,3,-0.2) # m2(2,3)=-0.2
#print m2(2,3)
#print m2(0, 0)
#print m2.nlin()
#print m2.ncol()

###############################################################################
# Numpy interface
예제 #3
0
###############################################################################
# create a dir for leadfields and tmp
if not op.exists("tmp"):
    import os
    os.mkdir('tmp')
if not op.exists("leadfields"):
    import os
    os.mkdir('leadfields')

# Compute Leadfields
gauss_order = 3
use_adaptive_integration = True
dipole_in_cortex = True

if op.exists("tmp/hmi.mat"):
    hminv = om.SymMatrix("tmp/hmi.mat")
    print("HM inverse loaded from ", "tmp/hmi.mat")
else:
    hm = om.HeadMat(geom, gauss_order)
    hm.invert()
    hm.save("tmp/hmi.mat")
    hminv = hm
    # hminv = hm.inverse() # to also test the adjoint method: comment the 3
    # previous lines, and uncomment this line, and the two others containing
    # 'adjoint'

if op.exists("tmp/dsm.mat"):
    dsm = om.Matrix("tmp/dsm.mat")
    print("DSM loaded from ", "tmp/dsm.mat")
else:
    dsm = om.DipSourceMat(geom, dipoles, gauss_order, use_adaptive_integration,