HRfunc

Exploring the HRtree



WARNING ⚠️ The HRtree is an experimental community resource that currently contains a limited amount of HRFs contributed by the neuroimaging community. Over time we hope this community resource will grow, however currently functionality listed below is sub-optimal. Estimating your own HRFs or use of a canonical HRF for estimating neural activity may be required.


A core component of the HRfunc tool is the HRtree, a hybrid tree-hash table data structure that efficiently stores HRF estimates with rich detail of their origins. Leveraging this data structure users can filter the HRtree for experimental contexts of interest like age range or experimental task.

Key HRF Contexts


Here are the 10 primary contexts filterable within the HRfunc...

  • method: The deconvolution method employed for estimating the HRF (defaults to 'toeplitz')
  • doi: DOI of paper describing dataset and HRF origin (defaults to 'temp')
  • ch_name: Channel name from which the HRF was estimated (defaults to 'global')
  • study: Study name HRF was estimated for (defaults to None)
  • task: Task name HRF was estimated from (defaults to None)
  • conditions: Experimental conditions (defaults to None)
  • stimulus: The stimulus type (defaults to None)
  • intensity: The intensity of the stimulus (defaults to None)
  • duration: The duration of the HRF estimate (defaults to 30.0 seconds)
  • protocol: The protocol name (defaults to None)
  • age_range: The age range of the subject pool used to estimate the HRF (defaults to None)
  • demographics: The demographics of the subject pool used to estimate the HRF (defaults to None)


Finding Experimentally Relavent HRFs



There are a number of ways one can filter on these contexts. Each experimental context is inserted into a HRhash table alongside a pointer to it's tree node. The HRfunc.branch() function accepts any of the 10 context items and returns a sub-tree that includes all nodes in the HRtree that matched your requested context.


import hrfunc as hrf

# Load a hrfunc montage
montage = hrf.montage('study_HRFs.json')
    
# Replace current HRtree with a sub-tree of context specific HRFs
montage.branch(age_range = [5, 6, 7, 8], task = ['stoop', 'n-back', 'tower of hanoi'])


The outputs of this branch call are similar, but may yeild HRFs with suboptimal similarity. It's recommended to then filter the tree which then does a weighted similarity check on each HRF within the tree and deletes any nodes that do not meet a threshold (defaulting too 95%)


# Filter your montage so it only contains HRFs of interest
montage.filter(threshold = 0.95) 


You can also leverage the K-D trees data structure to look within regions of interest. The specific k-d tree structure used enables us to also quickly group together in uniquely shaped clusters like spheres and boxes.


# Filter your montage so it only contains HRFs of interest
montage.radius_search(optode, maximum_distance = 0.1)


A radius search operation was implemented within the HRtree but easily a custom box search could be also be implemented leveraging the k-d tree structure.