Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

能在这里向您请教个问题吗? #1

Open
sdsafsdfsaf opened this issue Nov 21, 2024 · 0 comments
Open

能在这里向您请教个问题吗? #1

sdsafsdfsaf opened this issue Nov 21, 2024 · 0 comments

Comments

@sdsafsdfsaf
Copy link

我在用MNE绘制脑磁图时所碰到的问题。
我原先有一个头盔,头盔上有一系列坐标点。我绘制的等磁图是二维的,因此需要将这些点映射到二维平面内。MNE内部提供了一种映射,但是我不太理解是什么意思。这是他提供的函数。

locs3d -= sphere[:3]
 # use spherical (theta, pol) as (r, theta) for polar->cartesian
cart_coords = _cart_to_sph(locs3d)
out = _pol_to_cart(cart_coords[:, 1:][:, ::-1])
# scale from radians to mm
out *= cart_coords[:, [0]] / (np.pi / 2.0)
out += sphere[:2]
def _pol_to_cart(pol):
    """Transform polar coordinates to cartesian."""
    out = np.empty((len(pol), 2))
    if pol.shape[1] == 2:  # phi, theta
        out[:, 0] = pol[:, 0] * np.cos(pol[:, 1])
        out[:, 1] = pol[:, 0] * np.sin(pol[:, 1])
    else:  # radial distance, theta, phi
        d = pol[:, 0] * np.sin(pol[:, 2])
        out[:, 0] = d * np.cos(pol[:, 1])
        out[:, 1] = d * np.sin(pol[:, 1])
    return out

这里他进行了条件1. 我不太理解这个条件1的计算具体有什么含义

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant