Analyzing mRNAs Along Curved Structures (Dendrites of Neurons) in Napari

Sample image


Hello, I am currently working on a neuron mRNA quantification project. In the big picture, I want to extract information from single molecule fluorescence microscopy images of neurons. The image above is an example. I would really want to perform my entire project in Napari and Python.

Analysis goals

The information I need include the distribution (distance from nucleus) of mRNA, intensity of mRNA, etc. As a result, I would like to achieve the functions listed below:

Pipeline A:

  1. Stretch/straighten the dendrite so I can later calculate its distance from nucleus simply using the two coordinates. (Otherwise, it’s hard to find distance as the dendrites are curved paths.)
  2. Create outlines of all the dendrites for each neuron.
  3. Identify and Count mRNAs using image analysis. (Perhaps by setting a threshold.)
  4. Record the coordinates of each mRNA (white dots in the image).

Pipeline B (Thank you for suggesting this @jni :grinning:):

  1. Create outlines of dendrite.
  2. Segment and skeletonize the dendrites.
  3. Identify mRNAs and count along the skeleton (the segment that each mRNA belongs to will indicate its distance from nucleus).


For pipeline A, I wonder if Napari can achieve step 1 - straighten the dendrite. I am currently relying on ImageJ for that task and my programming skills do not allow me to create program that would automatically transform image to straighten it.

Another great challenge for me is how to identify mRNAs using Napari and Python. The only way I could think of is by setting min and max threshold and size limit for the program to determine whether a signal is mRNA. However, this is probably inaccurate, as signals of mRNA need to be fit on Gaussian Curves instead of simply setting threshold. Does anyone know any existing plugin or library in Napari or Python that can achieve that (similar to FishQuant in MatLab)?

Any help or insights will be greatly appreciated. Thanks :slight_smile:

Hi @Ryan_Huang! Thanks for the post! When you say you straighten the dendrite with ImageJ, what do you mean exactly? Do you draw the dendrite and then call a specific plugin?

For me, the image looks too noisy to automatically identify the dendrites. Perhaps denoising e.g. with Noise2Void/Noise2Self would change that, I’m not sure. So for either pipeline, I think you’ll need to find the dendrite manually, whatever you do.

Also, napari itself is not (yet) capable of any processing. Rather, as a viewer + annotation tool, it allows you to insert manual inspection / annotation steps into a bigger pipeline of Python tools. In this case, you could draw the dendrite in napari, skeletonize with scikit-image, identify mRNAs with (?) (I don’t know a tool for this but maybe someone else will be able to chime in), and count them with skan, in each step displaying the results in napari to be able to manually check their correctness.

1 Like

Hi @jni! Thank you for your reply!

To straighten the dendrite with ImageJ, I use one of their built-in function: [Edit > Selection > Straighten]. So I would first manually trace the dendrite using lots of small line segments, then I perform that function and the dendrite would get transformed with the line I trace as the central axis. This is what it looks like:
The small window on the top left corner is the result of the straightening function.

I will try denoising the image first and then see if I can automatically identify the dendrites. If it does not work, I will do it manually in napari.

For now, the only step in my pipeline that prevents me from moving everything into Python is identifying mRNAs. My lab uses FishQuant in MatLab because it can identify mRNAs with great accuracy and precision. However, I am more familiar with Python and hope to perform the rest of the analysis in Python. Therefore, I am currently looking for possible tools in Python that can identify mRNAs. Once I figured that out, I would perform my entire image analysis project in Python and use napari to enhance manual inspection and annotation :slight_smile:

Hi @Ryan_Huang so glad you’re giving napari and Python a go for your project, that’s great!

As @jni mentioned napari right now doesn’t support that sort of interactive processing like straightening a dendrite, but we do support the manual annotation side of things with the path shape in our shapes layer, see what I have drawn below:

There is also a very cool issue looking at adding spine interpolation to napari too, which you might find interesting

For the mRNA detection, you might be interesting in using the #starfish library (which is also on cc @neuromusic @mattcai

1 Like

Hi @sofroniewn! Thank you for your reply and suggestions!

The path annotation function in napari will definitely be helpful for me to better visualize and skeletonize the dendrites.

I will look into and try the #starfish library to see if I can perform mRNA detections along the dendrites in Python. This will “fill the hole” of my analysis pipeline. Thank you again for the information. :grinning: