def transform_to_another_subject(subject, region, subjects_dir): colin27_xfm = tu.get_talxfm('colin27', subjects_dir) xfm = tu.get_talxfm('colin27', subjects_dir) for hemi in ['lh', 'rh']: verts, faces = utils.read_ply_file(op.join(MMVT_DIR, 'colin27', 'subcortical', '{}_{}.ply'.format(region, hemi))) verts = tu.apply_trans(colin27_xfm, verts) verts = tu.apply_trans(np.linalg.inv(xfm), verts) utils.write_ply_file(verts, faces, op.join(MMVT_DIR, subject, 'subcortical', '{}_{}.ply'.format(region, hemi)))
def convert_to_ply(srf_fname, ply_fname, org_vox2ras_tkr, shifter_vox2tk_ras): verts, faces, verts_num, faces_num = utils.read_srf_file(srf_fname) verts = tu.apply_trans(np.linalg.inv(org_vox2ras_tkr), verts) verts = tu.apply_trans(shifter_vox2tk_ras, verts) utils.write_ply_file(verts, faces, ply_fname)
def to_ras(points, org_vox2ras_tkr, shifter_vox2tk_ras): points = tu.apply_trans(np.linalg.inv(org_vox2ras_tkr), points) points = tu.apply_trans(shifter_vox2tk_ras, points) return points