FZJ-INM1-BDA / siibra-python

Software interfaces for interacting with brain atlases - Python client
Apache License 2.0
48 stars 10 forks source link

Assignment of vertex points on surfaces #461

Open AhmetNSimsek opened 1 year ago

AhmetNSimsek commented 1 year ago

Currently, it is not possible to assign points/vertex/face to regions.

(Decided to add on 04.09.2023 dev meeting)

AhmetNSimsek commented 11 months ago

As siibra already requires scipy, we can employ the following:

import siibra
from scipy.spatial import cKDTree
import numpy as np

mesh = siibra.get_template('bigbrain').fetch(format='mesh')
kdtree = cKDTree(mesh['verts'])

pts = np.array([0.07, 41.18, 43.23])
dist, idx = kdtree.query(pts)  # query closest verticies and their distance

Distance can be used to determine the assignment degree and one can read which label is stored from giilabelled maps.

What do you think @dickscheid and @xgui3783 ?