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

Overlapping Spots Not Registered #13

Open
buttf7 opened this issue Aug 16, 2022 · 2 comments
Open

Overlapping Spots Not Registered #13

buttf7 opened this issue Aug 16, 2022 · 2 comments

Comments

@buttf7
Copy link

buttf7 commented Aug 16, 2022

Hi! I was wondering if clustering of spots is able to be detected by RSFISH. My attempts to analyze cells with greater spot densities it has only resulted in either no or singular spot detection.

@StephanPreibisch
Copy link
Member

StephanPreibisch commented Aug 16, 2022

Hi @buttf7, could you please upload some example screenshots of what exactly he is trying to achieve.

Here is a detailed description of how to find close detections:

RS-FISH allows the user to choose between different detection methods to localize spots in the image. The tool offers three localization methods that build on each other: 1. radial symmetry (‘No RANSAC’), 2. radial symmetry + RANSAC (the default option), 3. radial symmetry + multi-consensus RANSAC (Supplemental Fig. 7a). The default option is radial symmetry detection of spots with additional RANSAC outlier removal. In cases where the noise level is low, and an even higher computation speed is preferred, the RANSAC outlier removal step can be skipped by choosing “no RANSAC”. In cases where many spots are crowded and potentially overlap, we recommend choosing multi-consensus RANSAC spot detection, which will try to separate close points by detecting gradients in several rounds.

The next step is to choose the parameters for detection, which is simplified by the plugin’s visual feedback (Supplemental Fig. 7b). Using the default spot detection method, there are two windows with parameters to set and two different visual feedback cues (see the Tutorial RS-FISH section). The red circle marks spots detected using the radial symmetry parameters, and the blue cross confirms those spots that pass the RANSAC outlier removal. The detection of the red circle can be adjusted by tuning the expected dimensions of the spot (sigma) and the threshold of the signal intensity of the DoG pre-detected spots.

The RANSAC parameters determine which and how the gradients are used to localize each spot. The support region radius determines the number of gradients computed in a local patch around each DoG pre-detected spot. We propose a default radius of 3 pixels which means a 7x7[x7] pixel patch resulting in 216 gradients for the 3D case. In general, we propose to select this radius to have a size similar to the radius that was selected for DoG (red circle). Decreasing this number might allow more spots to be found but will decrease localization precision as fewer gradients are used to define the center. The inlier ratio describes the fraction of gradients computed in each patch that are required to converge to the same center point in order to retain the pre-detected spot as a valid localization. Increasing the inlier ratio increases the robustness of the detected spot but can decrease the total number of detected spots, especially for lower SNR spots. The max error threshold defines the maximally allowed distance error (in pixels) for the intersection point defined by the gradients in order to classify a given gradient as an inlier; i.e., how far away from the intersection point can each gradient be (only in a perfect scenario, all gradients intersect perfectly in the same point, see Supp. Fig 1d). Decreasing the max error decreases the number of false detections (because gradients generated by a noisy background rarely point towards the exact same center), but potentially also reduces the number of lower intensity real detections, especially if the noise level is high. The max error should be chosen as function of noise, the lower the noise, the lower the error can be. We generally suggest an error around 1 pixel as a good starting point.

For the multi-consensus selection, a window pops up where parameters for additional rounds of spot detection can be defined. It is important to realize that for multi-consensus to work well, the max error in the RANSAC settings should be set relatively low since otherwise, the gradients pointing towards the centers of two (or more) nearby spots are interpreted as intersecting into a single spot. A typical setting could be 0.5 - 0.75 pixels for images with good signal-to-noise levels. It is important to first run RS-FISH in RANSAC mode before running the multi-consensus because the output parameters of the first RANSAC run are used to set the multi-consensus parameters. Upon finishing the first RANSAC run, the log record will output two critical parameters: the average #inliers and stdev #inliers. The average #inliers defines how many inliers intersect in each spot on average, while the stdev #inliers describes its variability. The parameters for multi-consensus RANSAC must be defined relative to those two values. The “Initial #inlier threshold for new spot (avg - nstdev) n=” asks the user how many inliers are required for it to be considered a new spot next to an already found one. For example, let us assume a 7x7x7 local neighborhood with 216 total candidate gradients. If average #inliers was 80 and stdev #inliers was 6, then defining n=8 would require at least 80-48=32 inliers for a new spot to be defined. Keep in mind that only around 136 gradients (=216-80) are left to be evaluated per local patch because about 80 are already assigned to the first spot. Once a new spot is identified, we re-center the local patch around its center location and compute the gradients across the updated local patch. Thus, the second parameter, “Final #inlier threshold for new spot (avg - nstdev) n=”, is usually chosen higher, e.g., n=6, thus requiring 80-32=48 inliers in the updated patch for a final confirmation of a new spot.

Setting the min number of inliers is a simpler, not adaptive way to define when new spots are assigned in a local patch. It describes the absolute number of inlier gradients minimally required to localize a point. Typically, a value of 30 inliers is a reasonable starting point. Note that in order to only use the min number of inliers, it is required to set “Initial #inlier threshold for new spot (avg - nstdev) n=” and “Final #inlier threshold for new spot (avg - nstdev) n=” very high.

@buttf7
Copy link
Author

buttf7 commented Sep 11, 2022

I had another question concerning spot detection. In some of the files I have worked with and performed spot detection, the detection is missing the top layer of spots and not registering them. However, all other spots are being detected. Is this also parameter-dependent, or is it a limitation? I can provide an example as well if that helps.

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

No branches or pull requests

2 participants