Last active
August 2, 2017 12:39
-
-
Save wmvanvliet/b6f6acbeba26642f389028509c56caf7 to your computer and use it in GitHub Desktop.
API proposal for picking vertices
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# PROPOSED FUNCTIONS | |
select_vertices_in_label(inst, label): | |
"""Return the vertno of the vertices that lie within one of the labels.""" | |
select_vertices_in_sensor_range(inst, max_dist, info=None): | |
"""Return the vertno of the vertices which nearest sensor is no further away than max_dist.""" | |
restrict_vertices(inst, vertices): | |
"""Restrict the vertices in a Forward, SourceSpaces or SourceEstimate object to the given vertno.""" | |
# EXISTING FUNCTIONALITY CAN BE IMPLEMENTED USING THE ABOVE FUNCTIONS | |
# restrict_forward_to_stc(fwd, stc) | |
restrict_vertices(fwd, stc.vertices) | |
# restrict_forward_to_label(fwd, labels) | |
restrict_vertices(fwd, select_vertices_in_label(fwd, label)) | |
# src.in_label(labels) | |
restrict_vertices(stc, select_vertices_in_label(stc, label)) | |
# NEW FUNCTIONALITY INCLUDES: | |
restrict_vertices(src, stc.vertices) | |
restrict_vertices(fwd, select_vertices_in_sensor_range(fwd, max_dist=0.07)) | |
restrict_vertices(stc, select_vertices_in_sensor_range(stc, max_dist=0.07, info=info)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment