Skip to content, Skip to search

Changes

TrakEM2 Scripting

43 bytes added, 09:16, 16 October 2010
Sorting nodes by their tags
<source lang="python">
from ini.trakem2.display import Display
def sortNodesByTags(tree):
table = {}
continue
for tag in tags:
tagged = None if table.has_key(tag): tagged = table[tag] if tagged is Noneelse: tagged = []
table[tag] = tagged
tagged.append(nd)
#
return table
# Obtain the currently selected Tree in the canvas:
tree = Display.getFront().getActive()
# Print the number of nodes that have any given tag:
for tag, tagged in sortNodeByTagssortNodesByTags(tree).iteritems():
print "Nodes for tag '" + str(tag) + "':", len(tagged)
</source>
 
== Compute the betweenness centrality of every node ==
Emailconfirmed, uploaders
653
edits