suite2p
suite2p copied to clipboard
Clarifying spatial scale concepts, and request to enter pixel size as input parameter
I believe suite2p's main algorithms operate on pixels, without regards to the underlying pixel size (in micrometers). I feel like it would be useful to parse/import/input the pixel size in micrometers, and have the pipeline take this directly into consideration for analysis and in the GUI display (show a scalebar). This would make things easier and less error-prone when one uses different scan magnifications or objectives for multiple acquisitions.
I also wish for more clarification on the various spatial input parameters, and the rest of this post is my attempt at understanding them and getting feedback / corrections.
The pipeline requires various input parameters that relate to spatial scale - but I am not totally confident that I understand these fully. The spatial parameters of which I am aware are: spatial_scale, anatomical_only, diameter, min_neuropil_pixels, inner_neuropil_radius
I believe there are two main cell detection modes, namely without cellpose, or with cellpose. If anatomical_only = 0, cellpose is not used, and then spatial_scale comes into play. If spatial_scale = 0, suite2p attempts to determine an "optimal scale" automatically.
Q1: Are there any limits (ROIs too small or too big) for what suite2p can find/handle when spatial_scale = 0? I ask this because when manually setting spatial_scale to a non-zero value, the maximum allowed is 4 (corresponding to 48 pixel ROI diameter) and the minimum is 1 (6 pixels).
Q2: Can suite2p handle multiple sizes of ROIs in a single FOV when spatial_scale = 0? I.e. how does suite2p handle / perform when there is not a single "optimal scale"?
Q3: Does the spatial_scale (if non-zero, or as found to be optimal) also relate to / modify / scale the values of the min_neuropil_pixels, inner_neuropil_radius parameters? Or are these 2 parameters indendent of spatial_scale and should I therefore be manually changing min_neuropil_pixels and inner_neuropil_radius when I have different pixel sizes across recordings?
When anatomical_only is non-zero, cellpose is used, spatial_scale is ignored, and diameter is the relevant parameter. According to the GUI, this input should be the "average diameter of ROIs" and can be a list ("e.g. 6,9"). I believe this refers to the average diameter in pixels.
Q4: Are min_neuropil_pixels and inner_neuropil_radius still considered by suite2p when cellpose is used? Are they adjusted automatically according to the value of diameter, or some other scale found by cellpose automatically?
Q5: If the recording contains multiple types of ROIs of different size classes (e.g. large and small cell bodies, or cell bodies and dendrites, or cell bodies and boutons), what is recommended? Should one always use cellpose and specificy multiple diameters? Or will spatial_scale = 0 (multiscale) handle this situation? Or should one execute multiple independent pipeline runs, each with spatial_scale set to a non-zero value (1, 2, 3, or 4) tailored to one of the ROI types, and combine the results as needed post-hoc?
Q6: The docs on cell detection refer to gaussian smoothing where the std. dev. is 1/10th of ops['diameter']. That doesn't make sense to me, since diameter is a cellpose parameter, and the docs don't discuss cellpose anywhere else. Does spatial_scale play a role in the gaussian smoothing, or is it ignored? Under the hood, is diameter a parameter also used without cellpose, but it is not exposed to the user, and instead derived from spatial_scale?
With your answers, hopefully I'll get a better handle on all this. For now, though, it seems to me that it would be useful to consider two independent input parameters: a calibrated pixel size in micrometers, and a list of target ROI diameters in micrometers. Both cellpose and non-cellpose modes could operate from these, and the GUI could display a scalebar. Potentially the neuropil-related parameters could be specified in micrometers, to remove any ambiguity about how they depend on the other spatial scale parameters.
For reference, the latest docs say:
https://suite2p.readthedocs.io/en/latest/settings.html#roi-detection
spatial_scale: (int, default: 0), what the optimal scale of the recording is in pixels. if set to 0, then the algorithm determines it automatically (recommend this on the first try). If it seems off, set it yourself to the following values: 1 (=6 pixels), 2 (=12 pixels), 3 (=24 pixels), or 4 (=48 pixels).
min_neuropil_pixels: (int, default: 350) minimum number of pixels used to compute neuropil for each cell
inner_neuropil_radius: (int, default: 2) number of pixels to keep between ROI and neuropil donut
https://suite2p.readthedocs.io/en/latest/celldetection.html
Then we smooth the movie in Y and X with a gaussian filter of standard deviation sig = ops['diameter']/10.