scverse / squidpy

Spatial Single Cell Analysis in Python
https://squidpy.readthedocs.io/en/stable/
BSD 3-Clause "New" or "Revised" License
420 stars 76 forks source link

Query Regarding Logic of calculating radius in generate_spot_crops() #725

Open JieShengm opened 1 year ago

JieShengm commented 1 year ago

Thank you for developing such a valuable tool!

I have a question regarding the logic behind this line of code (https://github.com/scverse/squidpy/blame/ecee104bd165921f7a48934c13ff95599405e3eb/src/squidpy/im/_container.py#L820). I noticed that it performs floor division, followed by rounding, and then converts the result to an integer. However, if the diameter is <= 1, this process returns a radius of 0. This could potentially cause the downstream calculate_image_features() function to generate invalid feature values.

giovp commented 1 year ago

hi @JieShengm ,

indeed that's true, although I believe that would be unlikely since this unit should always be in pixel space. Is this an issue in your settings?