Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draw Z-Trace function #39

Open
fs2dw opened this issue Jan 13, 2025 · 7 comments
Open

Draw Z-Trace function #39

fs2dw opened this issue Jan 13, 2025 · 7 comments
Labels
enhancement New feature or request

Comments

@fs2dw
Copy link

fs2dw commented Jan 13, 2025

Is your feature request related to a problem? Please describe.

Yes. Previously, on Reconstruct there was a "Draw Z-trace" function on the toolbar that allowed you to manually draw a z-trace and then get the length/distance of the z-trace. I see that there is a "create z-trace" option based on contour midpoints, but it is only for pre-set objects with no manual drawing option.

Describe the solution you'd like

I would like to request this feature because there are portions of an object that I would like to get measurements for (ie. calculating the distance between synapses on a given dendrite segment, for which there is no object). Even if implementing the draw z-trace function is not possible, I'm searching for a way to mark two points on a given object to get the distance between them.

Describe alternatives you've considered

I've considered using stamps and stamping at the midpoint of each trace from the beginning of the point I'd like to measure to the end, although for very long objects with a lot of traces, this becomes incredibly cumbersome. I've also considered re-naming traces into different objects for portions I'd like to measure in order to create a ztrace of those objects. Again, I have some objects with upwards of 700-900 traces each spanning multiple points of a given section, so this would be a nuisance rather than a solution.

Additional context

I've attached a screenshot of one of my objects in the 3D scene and annotated it to help demonstrate the data I'm trying to capture. It shows a dendrite (yellow) that is traced as a singular object. However, the object branches and we're hoping to get lengths of individual dendrite segments (brown dots) and also collect data on the distances between synapses on each segment (red dots). Currently, I can only capture distance data on the full object, but not these details. Any tips to tackle this would be extremely appreciated, thank you!

PyReconstruct_Github

@fs2dw fs2dw added the enhancement New feature or request label Jan 13, 2025
@quasiTriestino
Copy link
Collaborator

If I understand correctly, you'd like a way to get a 1D mapping of objects (be they synapses or whatever) as they occur along the length of each of these branches. It sounds like it'd be nice to be able to "slice" a z trace and get data concerning the separate segments.

I have a similar problem concerning the placement of synapses along dendrites of CA1interneurons, which is a real pain cause the dendrites are tortuous. To deal with this, I've taken the meshes out of PyReconstruct and used a custom-built add-on in Blender to slice the dendrite perpendicular to it's long axis. This gives a nice mapping of synapses occurring along the dendrite and is probably what you're looking for.

I could think of ways of trying to implement something similar in PyReconstruct, but I'm having a hard time getting my head around slicing the z trace (running up the center of a dendritic shaft) based on a synapse. If the dendrite were perfectly cross sectioned then, it'd be easy to do. If the dendrite has any bend to it, it becomes a little more difficult.

If you'd like me to show you how I've dealt with this issue in Blender, go ahead and email me ([email protected]) and we can set up a meeting to chat. It'd likely give me a better idea of what you're trying to do as well.

Thanks for the note! This would be a really nice addition to PyReconstruct, so let me get my mind around it. :)

@fs2dw
Copy link
Author

fs2dw commented Jan 21, 2025

Hi, thank you for taking the time to discuss this! I know it's a little hard to convey in text, but I think the idea of "slicing" a z-trace would be great. It would be useful to even use the contour midpoints of the dendrite for that purpose. Your custom built-in sounds interesting but I don't think it resolves the measurement factor of what I'm trying to get.

As I mentioned, the previous Reconstruct version had a manual "Draw Z-trace" tool - is it not possible to implement that function in PyReconstruct as well? TIA!

@quasiTriestino
Copy link
Collaborator

We could think about virtually sectioning a z-trace by using the centers or edges (or however you'd want to do it) of objects of intereste along the z-trace. (Something like synapses along one of your branches.) In the meantime, while there's no z-trace tool in PyReconstruct, you can perform the same operation using a stamp.

Make a stamp (name it something like branch_01_z_stamp) and then stamp each section as if you were using the old z-trace tool. Once you're done, open the object list, right click that object, and Create ztrace > On contour midpoints. Voilà, you're in business. You'll see the new z-trace in the z-trace list.

@fs2dw
Copy link
Author

fs2dw commented Jan 22, 2025

Virtually sectioning a z-trace would definitely be helpful and less time-intensive! Because, as I mentioned in my original post, stamps are one of the alternatives I've considered and it is not nearly as helpful as the original "Draw Z-trace" tool in Reconstruct (as this requires you to place a stamp on EVERY section (whereas the draw z-trace tool would let you follow through multiple sections and 'click' when the direction changed). Not sure if I'm describing it best, as this may sound like a menial difference, but it's huge when I'm dealing with so many traces. If there were a way to use the stamp tool to identify "start" (say synapse 1) and "stop" (synapse 2) points of a z-trace and then be able to choose an object to use for referencing contour midpoints (the dendrite they're synapsing onto), that would be incredible. But again, not sure how feasible that is!

@quasiTriestino
Copy link
Collaborator

quasiTriestino commented Jan 22, 2025

You do not need to place a stamp on every section in PyReconstruct to do what you're proposing. You can stamp just like you did with the old z-trace tool and then create a z-trace from the new object in the object list. This will create a z-trace just like legacy Reconstruct did.

@fs2dw
Copy link
Author

fs2dw commented Jan 22, 2025

Ah that's good news! I enjoyed seeing the trajectory line with draw z-trace to track it, but in the meantime, I'll just have to go with the stamp route. Please let me know if you end up figuring out something along the lines of splicing a z-trace/segmenting an existing z-trace.

@quasiTriestino
Copy link
Collaborator

Regarding splitting a z-trace, I think we can do this mathematically based on the centers of objects you're interested in. If that's something you'd like, what you'll get back is the data concerning where the objects are along that line and the distances between them.

FYI: In PyReconstruct you can see the z-traces on the images after they have been created. You can also move the z points that were placed. To see them, go to series options then Show Ztraces then show ztraces in field. They might be hard to see under the stamps (The look like little black dots with arrows pointing in the direction of the adjacent z points), but you can hide that stamp object and then click and drag z-points around at will.

Image

Let me know about that idea above and thanks for the post :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants