Ejemplo n.º 1
0
    def surf2meg(self):
        """
        Create a matrix that can be used to map an OpenMEEG surface source to an 
        OpenMEEG MEG Sensors object.

        NOTE: This source to sensor mapping is not required for EEG.

        """
        LOG.info("Computing DipSource2MEGMat...")
        surf2meg_mat = om.SurfSource2MEGMat(self.om_sources, self.om_sensors)
        LOG.info("surf2meg: %d x %d" %
                 (surf2meg_mat.nlin(), surf2meg_mat.ncol()))
        return surf2meg_mat
Ejemplo n.º 2
0
patches = om.Sensors()
patches.load(patches_file)

###############################################################################
# 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())