catmaid / CATMAID

Collaborative Annotation Toolkit for Massive Amounts of Image Data
https://catmaid.org
GNU General Public License v3.0
182 stars 56 forks source link

Measuring distance between two nodes for tags and multiple skeletons (export as csv) #2233

Open nrandel opened 1 year ago

nrandel commented 1 year ago

Hi Tom,

The F8: Measuring between two nodes is very nice. Could you extent the tool to

1) Enable the measurement of several skeletons and export the results in a csv (if nodes are tagged, it would be good to have the skeleton id and tag in the csv as well) eg. skeleton ID 1, tagX/ skeleton ID 2 (or 1 if same skeleton), tagY/Distance

2) Select multiple skeletons (eg. in 3D viewer or neuron search) and be able to measure the distance between two customized/ unique tags within a neuron and export as csv.

Thank you! Nadine

clbarnes commented 1 year ago

This could be a simple widget. Add skeletons from a source as usual, then have 2 multiline text fields, "from tag" and "to tag". Each line is a different tag, and then for each skeletons in the selection, find all the distances from all of the "from" tags to all of the "to" tags, giving a TSV export.

So it would be like

Skeletons selected
-------------------------
1

From tags
-------------
A
B

To tags
---------
X
Y

Output (as a TSV, just hard to write them in github comments)

skeleton_id, from_tag, to_tag, from_treenode_id, to_treenode_id, distance
1,A,X,2,3,1000
1,A,Y,4,5,1500
1,B,X,6,7,2000

and so on. Would that be helpful?

In fact, it may not need to be its own widget - it could be a button in the Measurements widget which opens a popup with the 2 input boxes.

nrandel commented 1 year ago

As long it can be applied within or/ and between skeletons, it looks good!

Thank you

clbarnes commented 1 year ago

Ah didn't realise you needed it between skeletons, I was just thinking about path length on an individual skeleton rather than cartesian distance between arbitrary points. Not sure whether a single flow could capture both cases.

What might be the easiest thing to add here would be a TSV export for the Tag Table. You can already constrain that by a group of skeletons, and the export could be something like skeleton_id,tag_name,node_id,x,y,z. Then it would be a pretty short script to calculate distances between whichever skeletons and tags you want.

nrandel commented 1 year ago

I actually need it within the same skeleton (exactly as you describe it above), I misunderstood you before