Skip to content

Support adaptive background thresholding for Xenium data via stain_bg_percentile argument #21

@katwre

Description

@katwre

Hi hi,

I wanted to share my experience running SCS on 10x Xenium data - I'm trying to add it to the nf-core spatialxe pipeline ( nf-core/spatialxe#130 ). I found that the default background threshold (stain_bg_threshold=10) does not work well for Xenium data, since almost all pixels have values above 10. This results in no background being detected and the model failing to train properly.

I hope it's fine that I prepared a pull request to adjust for that (#22). Summary of changes:

  • Added an argument to the preprocess function called stain_bg_percentile that allows users to specify a percentile-based adaptive background threshold for stain intensity.
  • Added a note in the README and example scripts about using stain_bg_percentile for Visium/H&E data.
  • Clarified that the default threshold is for low-range fluorescence images, and percentile-based thresholding is recommended for H&E.

Please find attached a notebook with my test code Test_SCS2Visium.ipynb and the results as a screenshot:

Image

Let me know if you'd like any further changes. Thanks for maintaining SCS!

Cheers,
Kasia

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions