Skip to content

Commit

Permalink
neighbors
Browse files Browse the repository at this point in the history
  • Loading branch information
JasperVanDenBosch committed Jul 26, 2023
1 parent 1b4a71c commit 9278b3e
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions demos/demo_searchlight_surface_bold5k.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import itertools
import datalad.api as datalad
import nibabel, pandas, numpy, tqdm
from sklearn import neighbors as skl_neighbors
from scipy.interpolate import pchip

#description: https://bold5000-dataset.github.io/website/overview.html
Expand Down Expand Up @@ -55,10 +56,16 @@
hrf = pchip(numpy.arange(hrf.size)*STANDARD_TR, hrf)(timepts_block)
hrf = hrf / hrf.max()

# ## get coords of vertices
# fpath_anat = join(fmriprep_dir, 'sub-CSI1', 'anat', f'sub-CSI1_T1w_inflated.L.surf.gii')
# img_anat = nibabel.load(fpath_anat)
# coords = img_anat.agg_data('pointset')
print('starting neighbor search')

## get coords of vertices
fpath_anat = join(fmriprep_dir, 'sub-CSI1', 'anat', f'sub-CSI1_T1w_inflated.L.surf.gii')
img_anat = nibabel.load(fpath_anat)
coords = img_anat.agg_data('pointset')
nn = skl_neighbors.NearestNeighbors(radius=5)
adjacency = nn.fit(coords).radius_neighbors_graph(coords).tolil() # sparse

#raise ValueError

"""388s 194 volumes
Expand Down

0 comments on commit 9278b3e

Please sign in to comment.