weigertlab / spotiflow

Accurate and efficient spot detection for microscopy data
BSD 3-Clause "New" or "Revised" License
46 stars 4 forks source link

Spot diameter from the heatmap or flowmap #5

Closed ajinkya-kulkarni closed 4 months ago

ajinkya-kulkarni commented 4 months ago

Hello team, thanks again for this repo. I was wondering if there is a way to retrieve the spot diameters for each detected spot.

ajinkya-kulkarni commented 4 months ago

Just to add to the discussion - since you already get the prop heatmap and the coords of the spots, I was able to isolate the heatmap for just those points. Then one can use a seeding algorithm for each spot and in principle determine the spot diameter. But one has to again take special care of spots close to each other, which at the moment I dont have a solution to. I would like to hear what you think about this approach.

Best, Ajinkya

maweigert commented 4 months ago

Indeed a nice idea! However the predicted heatmap will try to recover the ground truth Gaussians, which have a fixed sigma (e.g. 1.5px). So its is not really predicting the "spot diameter"

ajinkya-kulkarni commented 4 months ago

Ah ok, I see. In that case, there should be some way to start seeding a circle at each predicted spot (x,y) and "constantly" look at the original image to see whether a big enough seed was generated.

ajinkya-kulkarni commented 4 months ago

Sorry, another question - does the length of the flow more or less predict the spot size? If so, is there a way to expose them as well in the predictions?

maweigert commented 4 months ago

No, unfortunately not. As the annotation spotiflow is trained on are only single points annotations, there is no natural target for such a diameter.

AlbertDominguez commented 4 months ago

Hmm I don't think so. As @maweigert suggested, similarly to the heatmap, the stereographic flow is designed to predict using a specific scale length, and it should not convey any information about the spot size.

Ah ok, I see. In that case, there should be some way to start seeding a circle at each predicted spot (x,y) and "constantly" look at the original image to see whether a big enough seed was generated.

I think this is probably a safer way if you want to proceed to compute the spot size, at least for now

ajinkya-kulkarni commented 4 months ago

Alright, thanks for the help!