Plot Profile under path manager

HI,

I have trouble understanding the real meaning of the distance displayed on the plot profile under path manager. Radial Pro Profile.tif (644.0 KB)
What exactly does the x-axis represent? I check the actual data for the points and it appears to me that instead of measuring the intensity on each pixel, the x value follows x=n(n+1)/2 * (pixel value)


Is there a way of changing the unit of x-axis into length (um)?

Welcome to the forum @Martin_Feng!
Sincere thank you for the bug report. The x-Axis uses the spatial calibration units of the image by default (it can also use node indices, see below). But as you noticed, there was a bug: the values were being retrieved as the Euclidean distances between each node and the root of the path, rather than the cumulative distances from the path’s root. I fixed this issue a couple of days ago (the fix should be available in the NeuroAnatomy update site soon). While at it, I also noticed that profiles were not being retrieved for single-channel 2D images so I fixed that too.

To use path indices you could you a script, as follows (python):

# @SNTService snt
# @UIService ui


from sc.fiji.snt import Tree
from sc.fiji.snt.analysis import PathProfiler


def run():

    if not snt.getUI():
        ui.showDialog("SNT is not running.", "Error")
        return

    # Retrieve image
    if not snt.getPlugin().accessToValidImageData():
        ui.showDialog("No image data has been loaded", "Error")
        return
    imp = snt.getPlugin().getLoadedDataAsImp()

    # Retrieve selected paths in the Path Manager dialog.
    # If no selection exists retrieve all listed paths
    paths = snt.getSelectedPaths()
    if not paths:
        paths = snt.getPaths()

    # Assemble the profiler using node indices rather than distance. Note that in headless
    # scripts we could assemble the PathProfiler directly from a Tree and an image
    profiler = PathProfiler(Tree(paths), imp)
    profiler.setNodeIndicesAsDistances(True)

    # To access the profile data one could use profile.getValues()
    # For now let's just display the plot
    profiler.getPlot().show()


run()
1 Like

Hi @tferr !
Thank you so much for your help. I ran the script you provided and it worked. However, I found some discrepancies between the scripting introduction on https://imagej.net/SNT:_Scripting and my own SNT. Specifically, my script menu under SNT does not have “reload” or “New” button. I also tried to save the script under the fold of Fiji/ Script, but it does not allow the new script to show up either. I managed to run it through opening up a new scripting page while editing other script and it gave me the desirable plot.

Again I appreciate your work greatly and I am looking forward to the newly update!

Hi @Martin_Feng, sorry for the late reply. If you have the latest version of SNT (available through the Neuroanatomy update site), the “Reload Scripts…” and “New…” buttons should appear under the “Scripts” menu in the main SNT dialog. If this is not the case we would need to investigate. It is important to note the documentation at imagej.net/SNT is under development, and recent changes to SNT may not be reflected immediately, but we are working on it!