PreibischLab / RS-FISH

Tool for precise, interactive, fast and scalable FISH spot detection
GNU General Public License v2.0
45 stars 14 forks source link

How to adjust sigma and threshold #12

Closed buttf7 closed 2 years ago

buttf7 commented 2 years ago

Could a brief explanation on the definition for the sigma and threshold parameters are for spot detection be provided? And how they can be used to optimize detection?

LauraBreimann commented 2 years ago

Hi there, I added a new section (https://github.com/PreibischLab/RS-FISH#parameters) on how to choose the different parameters and added a little overview image. Hope this helps! Pls, let us know if you still have questions.

buttf7 commented 2 years ago

Hi that makes sense. So with respect to sigma, it defines the size of the spots that is detected. Is this a minimum or is there a range associated with the size. For instance, what if I have non-homogenous spot sizes would this method still work?

LauraBreimann commented 2 years ago

Yes exactly, sigma is the size of the detected spots. There is a limit on how to set the slider in the interactive mode, but switching to advanced mode smaller and larger values can be chosen (not sure if there is a limit to this). But for most cases that we tested, we could set all values using the sliders. For non-homogenous spot sizes, it depends a bit on how different the spots are. Typically spots don't have to be exactly the same size to be detected but if the difference is very large it might be useful to detect spots in several rounds with different parameters (maybe scripting this could be really helpful here) and then combine the results.

LauraBreimann commented 2 years ago

If you are unsure you could also share an image (if possible) and I can see if I can help for a specific case.

buttf7 commented 2 years ago

RNA_1to10_processed

Hello, I have provided a sample image. Thank you for all your help.

LauraBreimann commented 2 years ago

Ok couple of questions: is the image normally a z-stack or is it 2D? I see the file is a jpg, do you also have a tiff version of this image? Would it be possible to upload a tiff version of this via google drive or dropbox and provide a link? Then it is much easier for me to help you! But looking at the image we should be able to find good parameters to detect all spots!

buttf7 commented 2 years ago

Hello! Let me know if this works. https://drive.google.com/file/d/18A06Q_YBMry5Lhoqt3anYcJ_fET7s22c/view?usp=sharing

LauraBreimann commented 2 years ago

Hey, so I had pretty good results with these settings :

img min intensity=0.0, max intensity=255.0 SigmaDoG : 1.8965 ThresholdDoG : 0.0019919446 anisotropyCoefficient : 1.0 useAnisotropyForDoG : true RANSAC : SIMPLE MaxError : 1.5801717 InlierRatio : 0.1 supportRadius : 3 GaussFitIntensity : false

Screenshot 2022-06-22 at 13 34 08

It's a bit tricky because the image starts in the middle of the signal, detection can get even a bit better if the signal is completely captured. Alternatively, using a max projection here worked really well for me with the same settings above: Screenshot 2022-06-22 at 13 39 05

Hope this helps!

buttf7 commented 2 years ago

Thank you, that looks great. Is there a way to further minimize false positive detections. Also, would you suggest the multiple layer detection approach.

LauraBreimann commented 2 years ago

So in the above image, I wouldn't call them false positives as I can see signals at each location, but if you only want to detect brighter spots, the intensity threshold can be used to only select spots with higher intensity. When I use the tool I always zoom in really close to one area (for instance one cell) and see what is detected. So I would draw the box for pre detection very small and move it around to really check how the detection looks like. I recorded a little video on how I normally check my image (I used a max projection here, but the same process for the full stack): https://drive.google.com/file/d/1Rwl7Uq-vHoT4-xbsdDvpKB5Q--mJyHeD/view?usp=sharing

buttf7 commented 2 years ago

Is it more difficult to perform the full stack spot detection, I cannot find parameters that appear to detect at even the values that you have provided.

image