Skip to content

Instantly share code, notes, and snippets.

@tferr
Created January 4, 2021 22:48
Show Gist options
  • Save tferr/95a305d11ec9eac606ec36f188571e6f to your computer and use it in GitHub Desktop.
Save tferr/95a305d11ec9eac606ec36f188571e6f to your computer and use it in GitHub Desktop.
Jython script that uses SNT to perform a 'brute force' ML query
from sc.fiji.snt.io import MouseLightLoader, MouseLightQuerier
from sc.fiji.snt.analysis import NodeStatistics, TreeStatistics
from sc.fiji.snt.annotation import AllenUtils
soma_area = AllenUtils.getCompartment("MOs")
target_area = AllenUtils.getCompartment("ACA")
input_ids = MouseLightQuerier.getIDs(soma_area)
output_ids = []
for in_id in input_ids:
print("processing %s..." % in_id)
tree = MouseLightLoader(in_id).getTree('axon')
tree_stats = TreeStatistics(tree)
node_stats = tree_stats.getNodeStatistics('tips')
tips_at_target = node_stats.get(target_area)
if len(tips_at_target) > 9:
output_ids.append(in_id)
print(output_ids)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment