def head2meg(self): """ Call OpenMEEG's Head2MEGMat method to calculate the head to MEG sensor matrix. """ LOG.info("Computing Head2MEGMat...") h2s_mat = om.Head2MEGMat(self.om_head, self.om_sensors) LOG.info("head2meg: %d x %d" % (h2s_mat.nlin(), h2s_mat.ncol())) return h2s_mat
############################################################################### # Compute forward problem (Build Gain Matrices) gauss_order = 3 use_adaptive_integration = True dipole_in_cortex = True hm = om.HeadMat(geom, gauss_order) #hm.invert() # invert hm inplace (no copy) #hminv = hm hminv = hm.inverse() # invert hm with a copy ssm = om.SurfSourceMat(geom, mesh) ss2mm = om.SurfSource2MEGMat(mesh, sensors) dsm = om.DipSourceMat(geom, dipoles, gauss_order, use_adaptive_integration, "") ds2mm = om.DipSource2MEGMat(dipoles, sensors) h2mm = om.Head2MEGMat(geom, sensors) h2em = om.Head2EEGMat(geom, patches) gain_meg_surf = om.GainMEG(hminv, ssm, h2mm, ss2mm) gain_eeg_surf = om.GainEEG(hminv, ssm, h2em) gain_meg_dip = om.GainMEG(hminv, dsm, h2mm, ds2mm) gain_adjoint_meg_dip = om.GainMEGadjoint(geom, dipoles, hm, h2mm, ds2mm) gain_eeg_dip = om.GainEEG(hminv, dsm, h2em) gain_adjoint_eeg_dip = om.GainEEGadjoint(geom, dipoles, hm, h2em) gain_adjoint_eeg_meg_dip = om.GainEEGMEGadjoint(geom, dipoles, hm, h2em, h2mm, ds2mm) print "hm : %d x %d" % (hm.nlin(), hm.ncol()) print "hminv : %d x %d" % (hminv.nlin(), hminv.ncol()) print "ssm : %d x %d" % (ssm.nlin(), ssm.ncol()) print "ss2mm : %d x %d" % (ss2mm.nlin(), ss2mm.ncol()) print "dsm : %d x %d" % (ssm.nlin(), ssm.ncol())
# Compute forward problem (Build Gain Matrices) gauss_order = 3 use_adaptive_integration = True dipole_in_cortex = True hm = om.HeadMat(geom, gauss_order) # hm.invert() # invert hm inplace (no copy) # hminv = hm hminv = hm.inverse() # invert hm with a copy ssm = om.SurfSourceMat(geom, mesh) ss2mm = om.SurfSource2MEGMat(mesh, sensors) dsm = om.DipSourceMat(geom, dipoles, gauss_order, use_adaptive_integration, "") ds2mm = om.DipSource2MEGMat(dipoles, sensors) h2mm = om.Head2MEGMat(geom, sensors) h2em = om.Head2EEGMat(geom, patches) gain_meg_surf = om.GainMEG(hminv, ssm, h2mm, ss2mm) gain_eeg_surf = om.GainEEG(hminv, ssm, h2em) gain_meg_dip = om.GainMEG(hminv, dsm, h2mm, ds2mm) gain_adjoint_meg_dip = om.GainMEGadjoint(geom, dipoles, hm, h2mm, ds2mm) gain_eeg_dip = om.GainEEG(hminv, dsm, h2em) gain_adjoint_eeg_dip = om.GainEEGadjoint(geom, dipoles, hm, h2em) gain_adjoint_eeg_meg_dip = om.GainEEGMEGadjoint(geom, dipoles, hm, h2em, h2mm, ds2mm) print("hm : %d x %d" % (hm.nlin(), hm.ncol())) print("hminv : %d x %d" % (hminv.nlin(), hminv.ncol())) print("ssm : %d x %d" % (ssm.nlin(), ssm.ncol())) print("ss2mm : %d x %d" % (ss2mm.nlin(), ss2mm.ncol())) print("dsm : %d x %d" % (ssm.nlin(), ssm.ncol()))