SNT - Sholl analysis - how to store data from multiple sholl analyses in the same image?

I have been trying to perform a sholl analysis on approximately 40 images, containing roughly 20 microglia per image. I have been trying to do this manually per microglia, but quickly noticed that when you save to a folder, it overwrites the previous .csv table present in the folder (i was hoping it would add onto it).
I have read the FAQ and as many other sources as I could find, but it’s not really clear to me how i’m supposed to be processing multiple microglia in a single image. I have tried drawing all the tracings and focal points (soma) in an image, but then i’m not sure how to make it run sholl analyses on each marked soma point without also calculating intersections for processes/dendrites that don’t belong to that soma.

Some extra info:
I’m doing max intensity projections of Z-stacks, and i’ve been manually drawing the traces along the processes, and using a single focal point to mark the soma (all within the SNT plug-in).
I will have many more images to process, but I only have about 2 months left on my internship.

Thank you very much for reading, I hope you can help me out.
Kind regards,
Lars

Welcome to the forum @LarsBults!

Just to clarify: Are you do doing the Analysis directly on thresholded images, or tracing processes with SNT, and then Sholl Analysis on the traced Paths?

Thank you Tiago!

I’m tracing the processes using SNT, followed* by a sholl analysis on focal points. Whenever I use traced paths I get the error saying my paths are rooted, and I couldn’t figure out a way to make all the traces converge on the focal point in the center of the soma (since it’s a dark spot in my stainings, the path won’t go there).
Hence I was hoping I could use focal point measurements and stack the data.

I am still confused about the issue (maybe a couple of snapshots would help?). But either-way one of the following should be of help:

  • If you are trying to analyze paths associated to the same cell, but such paths are disconnected: You could select all the primary paths associated with the cell, and run Edit → Merge Primary Path(s) into Common Root in the Path Manager.

  • If the problem is that you have a cocktail of paths and need to analyze only a subset: Select the paths to be analyzed in the Path manager, and run Analysis → Sholl Analysis… setting “Selected Paths” in the “Path filtering” choice. All unselected paths will be ignored. Note that you can also right-click on the image and choose “Sholl Analysis at Nearest Node”

  • If the problem is that you need to analyze many cells at the same time, then you can use Script → Batch → Sholl Bulk Analysis . That will allow you to process an entire folder of reconstruction files, including single TRACES files with multiple cells. Note that there are also a couple of Analysis scripts to merge profiles from multiple cells


image
So I’m trying to run a sholl analysis on this image. I have about 20 other images like this, and more coming up. I want to perform a sholl analysis on each soma in this image, for each image (only including the processes that belong to that particular soma).
Initially I would do this by sholl analysis (focal point) using the selected paths option, but this would force me to rename the saved sholl_table.csv every time, then add all the data to a master file and then average it. This would end up costing me too much time, so I’ve been trying to do it faster.

Since your previous suggestion I’ve tried the batch script for bulk analysis, but it seems to throw all the traces on the same image. I also get several errors in the console. The most notable one being this;


And it’s also not saving the summary tables.

I’m sorry for my near-absolute ignorance.

@LarsBults,

A couple of things:

On your tracing approach
You are complicating things quite a lot by not connecting paths into definable trees. For each cell, there should be a common root (likely the soma), to which all cell-related paths should be associated to. All your paths are disconnected, which effectively is telling the program that there are no hierarchical relationships between traced paths, and that each path defines its own structure. You can see this by running Tag → Morphometry → Cell ID in the Path Manager: You will see that each path is being treated as a unique cell. Here is an example of two cells. Note the parent/child relationships between paths, and that each cell can be “collapsed” into a single entry in the Path Manager list:

Also, note that with accurate relationships between paths, you will be able to perform many other type of analyses that you are currently unable to (Strahler, graph-based, etc.)

I would recommend the following:

  • For the cells you have traced: Select the paths associated with a cell, and run Edit → Merge Primary Path(s) into Common Root in the Path Manager. Once you do so, I do not expect any issues with the Sholl Bulk Analysis command.
  • For future tracings: Have a look at the several video tutorials and step-by-step instructions on how to fork paths while tracing. It will save you lots of headaches.

On the reported exception
The current version of SNT is v3.2.4 (you seem to be running v3.1.112). Looking at the release notes, it seems that if you run Fiji’s updater and update SNT, the exception you describe will no longer occur?

On the current behavior of the ‘Selected Paths’ option
I guess an option for not overriding files would be useful. Unfortunately I don’t know how quickly I can look into it.

On adding all the data to a 'master file’
You would not need to. The Analysis → Sholl Merge Grouped Profiles should do that for you, and if I recall correctly (it has been a while since I last looked into it), it should also generate averaged plots. Here is a screenshot from the documentation:

@tferr

On tracing approach;
thank you for your notes! I did watch the tutorials, but since they were all made for neurons (and i’m working on microglia) there were a couple of things i couldn’t figure out.

  1. One being the convergence on the center, given that I don’t think i can actually tag a whole soma (?). So as a result I would have to make a focal point in the center and then extend the processes into the center of the soma, which would mean data like “length of processes” would be incorrect, right? Also, having 4-6 processes extend from the same point yet all being separate primary paths - is this possible?
  2. to draw additional branches I would have to “avoid making loops” in connecting the secondary branches to the primary branch. It kept saying i was making loops, even though i was connecting a straight line to another straight line (just like in the video). What am I missing here? How are “loops” defined?

On your recommendations;
I have tried the merge primary paths, but the microglia aren’t symmetrical, so the center point it always off the soma (image shown below).
image

On the adding data to a master file:
This is a great tip! thank you very much. I will look into it as quickly as possible.

Hi @LarsBults ,

With the more recent versions of SNT, this should no longer be an issue. As @tferr suggested, updating to version 3.2.4 (and generally keeping up with the current release) is recommended, due to bug fixes and feature additions / improvements.

The “Merge Primary Paths” command takes the centroid of the starting points of the selected paths as the position of the new soma, and so is dependent on the paths being traced in the correct direction (i.e., “outwards” from soma). Another way to link them up would be to create a single-point path to represent the soma, and then merge the other paths to this point

@LarsBults ,

It is certainly possible to extend as many primary paths as needed. It is true the tutorials are quite neuro-centric, but there should be no fundamental differences in workflows between tracing a neuron or glia cell (neuronal somata are also rarely ‘centered’).

The real hurdle here seems to be that, as is, the Sholl prompt assumes you will want to override output files on re-analysis. I thought about this, and this behavior may not be intuitive indeed. So, in the latest version (v3.2.5, released today), output filenames will be appended a unique suffix if the file already exists at the chosen destination[1]. Note that you can also type in different destination directories (or subdirectories). They will be created if non-existing.

So, at this point this is what I would suggest:

  1. Update to v3.2.5
  2. Open the Analysis → Sholl Analysis… dialog, selecting "-- All – " when asked about which traced structure(s) to consider.
  3. Set Path filtering to “Selected Paths”, adjust options, and set a common output directory. Leave the dialog open.
  4. Select the paths of the cell to be analyzed. Here is a quick way of doing so: For each cell, right-click on the image and choose “Select paths from 2D ROI” and draw coarsely around the cell (this does not need to be precise: All paths intersecting your hand-drawn ROI will be selected
  5. Activate the Sholl Analysis dialog and press “Run Analysis”.
  6. Repeat steps 4) and 5) for each cell. Since the prompt interactively detects which paths are being selected, the analysis will only take into account the paths that are being selected at each round. As mentioned, files will be saved with unique filenames.
  7. Use the Sholl Merge Grouped Profiles script to combine profiles.

This should allow you to parse many cells quite quickly. If not, writing a script would be the way to go. You could have a look at the several examples in the Script Editors’ Templates → Neuronatomy → as a starting point.

NB: For future reference:

  1. In the above steps, you are never specifying the actual center of analysis. It will be inferred by the program for each cell, according to the following criteria:

    • If selected paths are disconnected, the center will be the centroid of their starting nodes
    • If selected paths contain a primary path, the center will be the starting node of the ‘first’ primary path

    If you activate SNT’s debug mode, the Console log will report on the decisions being made in the background. If the center cannot be determined (a warning is displayed), the best would be to use the ‘Sholl Analysis at the Nearest node’ command, that offers slightly more functionality (e.g, sampling Shells can be previewed), but assumes a common center across re-runs.

  2. The summary table is currently not saved (with honesty, I cannot recall why I’ve set it that way: perhaps because it keeps being recycled during the session?). You can use Fiji’s built-in _File → Export → Table… command to do so.

[1] This may cause ‘file clutter’ for those used to the old behavior, where files were being replaced. If this change is not welcomed, we can always set an option for it.