Closed alexyangalexyang closed 9 months ago
@alexyangalexyang , I am convinced that this could be achieved through scripting. E.g., the following groovy snippet should highlight the terminal nodes in all the paths listed in the Path Manager:
#@SNTService snt
if (!snt.isActive()) {
println(">>>> SNT is not running <<<<")
return
}
for (p in snt.getPaths()) {
lastIdx = p.size()-1
p.setEditableNode(lastIdx)
}
snt.updateViewers() // ensure viewers are repainted
There are a couple of ways to highlight nodes,. This snippet exploits the fact that nodes tagged for editing operations are rendered different in the image being traced, so it just tags them as editable
Does this solve your issue?
Thanks a lot! I tried but this only works on the z stack. It still doesn't show the ends on the 3D reconstruction.
On Fri, Nov 3, 2023 at 9:23 PM Tiago Ferreira @.***> wrote:
@alexyangalexyang https://github.com/alexyangalexyang , I am convinced that this could be achieved through scripting. E.g., the following groovy snippet should highlight the terminal nodes in all the paths listed in the Path Manager:
@.*** snt if (!snt.isActive()) { println(">>>> SNT is not running <<<<") return }for (p in snt.getPaths()) { lastIdx = p.size()-1 p.setEditableNode(lastIdx) } snt.updateViewers() // ensure viewers are repainted
There are a couple of ways to highlight nodes,. This snippet exploits the fact that nodes tagged for editing operations are rendered different in the image being traced, so it just tags them as editable
Does this solve your issue?
— Reply to this email directly, view it on GitHub https://github.com/morphonets/SNT/issues/206#issuecomment-1793285482, or unsubscribe https://github.com/notifications/unsubscribe-auth/A3BWR3Z3R3J54QXM34TEUE3YCWKHZAVCNFSM6AAAAAA63CEUKWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTOOJTGI4DKNBYGI . You are receiving this because you were mentioned.Message ID: @.***>
--
Alex Chih-Yu Yang, PhDPostdoctoral Fellow
Kleckner Lab Dept. of Molecular and Cellular Biology Harvard University
Correct. that snippet only highlights the nodes in the image being traced. To have them highlighted in the Reconstruction Viewer you could use something like this snippet (Groovy):
#@SNTService snt
import sc.fiji.snt.*
import sc.fiji.snt.analysis.*
import sc.fiji.snt.viewer.*
import net.imagej.display.ColorTables
// load a reconstruction
try {
tree = new Tree("/path/to/a/reconstruction.file")
} catch (Exception ignored) { // invalid file, load demo instead
tree = snt.demoTrees().get(0)
}
// retrieve tips
treeStats = new TreeStatistics(tree)
tips = treeStats.getTips()
// add tree to a new instance of an interactive viewer
viewer = new Viewer3D(true)
tree.setColor("yellow")
viewer.add(tree)
// add tips as 3D annotations: as monochrome collection
annotations = viewer.annotatePoints(tips, "annotated tips: monochrome")
annotations.setSize(20)
annotations.setColor("cyan")
// add tips as 3D annotations: as collection color-mapped to a morphometric trait
nodeStats = treeStats.getNodeStatistics("tips")
mapper = new NodeColorMapper(nodeStats)
mapper.map("x-coord", ColorTables.ICE)
annotations = viewer.annotatePoints(mapper.getNodes(), "annotated tips: color-mapped")
annotations.setSize(20)
// display
viewer.show()
Which displays the following:
@alexyangalexyang , did this solve the issue? Shall we close it?
Yes please! Thanks a lot
Alex
On Wed, Dec 13, 2023 at 9:55 AM Tiago Ferreira @.***> wrote:
@alexyangalexyang https://github.com/alexyangalexyang , did this solve the issue? Shall we close it?
— Reply to this email directly, view it on GitHub https://github.com/morphonets/SNT/issues/206#issuecomment-1854067971, or unsubscribe https://github.com/notifications/unsubscribe-auth/A3BWR32YA5EPPH5PWICDZ2DYJG6URAVCNFSM6AAAAAA63CEUKWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNJUGA3DOOJXGE . You are receiving this because you were mentioned.Message ID: @.***>
--
Alex Chih-Yu Yang, PhDPostdoctoral Fellow
Kleckner Lab Dept. of Molecular and Cellular Biology Harvard University
Is your feature request related to a problem? Please describe.
When tracing the filaments, I sometimes want to show the "2 ends" with a disk-like marks. I found it is not available. Therefore, I collected all the ends coordinates, trying to show that disks in separate paths. However, the program will automatically link all the ends, which I don't want. I tried to use "disconnect" or "rebuild" function but it doesn't work. Describe the solution you'd like
I wonder if there is an easier way to "decompose" single filament to "several single points", one path for each point. Of course I could do it one by one but it is very inconvenient.
Describe alternatives you've considered
I show the "2 ends" in the 3D view with a disk-like marks. Now the program allows "lines and disks" but it shows all nodes with disks. I only want the ends.
Additional context Thank you!