コード例 #1
0
def add_electrodes(mesh_filename):
    fwd_dir = os.environ['FWD_DIR']

    electrode_location_file = op.join(fwd_dir, 'etc', 'ElectrodeLocations_TMS007.txt')
    electrode_name_file = op.join(fwd_dir, 'etc', 'ElectrodeNames_BESA256.txt')

    points = np.loadtxt(electrode_location_file, delimiter=',')
    electrode_names = np.loadtxt(electrode_name_file, dtype='str')

    write_electrode_labels(points, electrode_names, out_file="BESA256.geo")
    mesh_id = 1005

    out_file = rewrite_mesh_with_electrodes(electrode_location_file, electrode_name_file, mesh_filename, mesh_id)
    return out_file
コード例 #2
0
ファイル: tdcs.py プロジェクト: benzwick/forward
def add_electrodes(mesh_filename):
    fwd_dir = os.environ['FWD_DIR']

    electrode_location_file = op.join(fwd_dir, 'etc',
                                      'ElectrodeLocations_TMS007.txt')
    electrode_name_file = op.join(fwd_dir, 'etc', 'ElectrodeNames_BESA256.txt')

    points = np.loadtxt(electrode_location_file, delimiter=',')
    electrode_names = np.loadtxt(electrode_name_file, dtype='str')

    write_electrode_labels(points, electrode_names, out_file="BESA256.geo")
    mesh_id = 1005

    out_file = rewrite_mesh_with_electrodes(electrode_location_file,
                                            electrode_name_file, mesh_filename,
                                            mesh_id)
    return out_file
import os
import os.path as op
import numpy as np
from forward.electrodes import write_electrode_labels

fwd_dir = os.environ["FWD_DIR"]

electrode_location_file = op.join(fwd_dir, "etc", "ElectrodeLocations_BESA256.txt")
electrode_name_file = op.join(fwd_dir, "etc", "ElectrodeNames_BESA256.txt")

points = np.loadtxt(electrode_location_file, delimiter=",")
electrode_names = np.loadtxt(electrode_name_file, dtype="str")

# This is a good time to move the electrodes around
# and get them to match your skull. e.g.:
# Scale by 10x
# points = points * 10
# Move values 5 mm to the right, 25 mm backward,
# and 20 mm upward
# points[:,0] = points[:,0] + 5
# points[:,1] = points[:,1] - 25
# points[:,2] = points[:,2] + 20

write_electrode_labels(points, electrode_names, out_file="BESA256.geo")
コード例 #4
0
import os
import os.path as op
import numpy as np
from forward.electrodes import write_electrode_labels

fwd_dir = os.environ['FWD_DIR']

electrode_location_file = op.join(fwd_dir, 'etc',
                                  'ElectrodeLocations_BESA256.txt')
electrode_name_file = op.join(fwd_dir, 'etc', 'ElectrodeNames_BESA256.txt')

points = np.loadtxt(electrode_location_file, delimiter=',')
electrode_names = np.loadtxt(electrode_name_file, dtype='str')

# This is a good time to move the electrodes around
# and get them to match your skull. e.g.:
# Scale by 10x
#points = points * 10
# Move values 5 mm to the right, 25 mm backward,
# and 20 mm upward
#points[:,0] = points[:,0] + 5
#points[:,1] = points[:,1] - 25
#points[:,2] = points[:,2] + 20

write_electrode_labels(points, electrode_names, out_file="BESA256.geo")