Nuclei-staining Image

Why Nuclei-staining?

Nuclei-staining has no bias in labeling cells in a tissue slice, making it invaluable for determining tissue area and cell location. Stereo-seq experiments and bioinformatics analysis tools are compatible with two stains, ssDNA and DAPI.

STOmics R&D team has compared and tested various commercialized staining reagents and found that ssDNA staining has the least effect on the downstream mRNA capture rate. The blue-fluorescent DAPI nucleic acid stain is a commonly used nuclear counterstain with high specificity in staining nuclei and can be used alongside other fluorescent reagents. In addition, both ssDNA and DAPI staining allow visualization of tracklines.

Considerations for Nuclei-staining Images

Processing nuclei-staining images in StereoMap and SAW requires either an individual acquisition stored in a single-page grayscale file at 8 or 16-bit depth . (See Image Types and Format for more information)

Fluorescence Image
Data Type and File Format

Grayscale image

One 8 or 16-bit grayscale single-page image file.

Step 1: Upload Image

Click on Choose file in the drag-and-drop box to select a compatible image file from your file system, or drag and drop the file into the box. Only one image file is allowed for this image type.

Please visit Image Processing Input Files for detailed image file information.

After selecting a file, the system will parse the image and extract necessary data. Parsing time may vary depending on the file type and size. Stereo-seq chip serial number (SN) and microscope setting provide important information in the image processing steps. The .tar.gz or .stereo the input file contains these data, so the parsing process will start directly.

If your input file is is .tif or .tiff, you'll need to manually enter the required information specified in this step and click Confirm to begin parsing and quality check.

Once parsing and quality checks are complete, click Next to proceed to Step 2.

Step 2: Image Registration

In this step, you will need to adjust the orientation, position, and scale of the image to align it with the spatial feature expression matrix. StereoMap provides two registration approaches for aligning images in the context of Stereo-seq data analysis.

  1. Morphology Registration: Aligns image with matrix based on the similarity of their morphology.

  2. Feature Point Registration: Aligns image to the trackline template deduced from the Stereo-seq chip SN by marking a key point. There’s no need to bring in a spatial feature expression matrix generated by SAW, but some prerequisites should be taken into account.

Morphology Registration

If you uploaded a .stereo file in Step 1, both the image and the spatial feature expression matrix will be visible in Step 2. For .tar.gz or .tif/.tiff image file, you will need to add a .stereo file to specify a spatial feature expression matrix as the reference. Click to select the .stereo file.

Or, if your image is in the .stereo file, but you want to change the reference expression matrix, you can click the and load a new file. This action will reload the matrix, but use the image from step 1.

The registration process involves two stages:

  • Rough Alignment: Match the orientation of the image based on morphology.

    • Use the Flip tool to mirror the image.

    • Click on and use the Control knob to rotate the image accordingly.

  • Fine Alignment: Adjust the position and scale for exact overlap with the spatial feature expression map.

    • Use the Move panel by setting the step size and pan in four directions.

    • Adjust scales using the Scale tool to match the dimensions of the microscope image with the spatial feature expression map.

    • Click"Chip tracklines" to display tracklines derived from the spatial feature expression matrix to assist with fine alignment. This template is a representation of the matrix.

    • If the tracklines on the image appear dim, manually adjust the Normalization , Contrast , Brightness , and Opacity .

circle-info

The images are adjusted to optimize the visibility of tracklines.

Example of trackline overlapping
circle-info

Adjusting Saturation will not affect the grayscale image.

The image that has been adjusted will be marked as complete by .

circle-info

After the image has been aligned with the matrix, steps 3 and 4 can be bypassed. You can export the semi-processed .tar.gz image directly and feed this output to SAW for automatic segmentation.

In addition, a *regist.tif image file will be provided. This is a reoriented image that matches the shape and orientation of its corresponding feature expression matrix. This image serves as the starting point for tissue and cell segmentation. If you’re considering using other external segmentation tools or algorithms, it’s strongly advised to utilize this *regist.tif file as the input.

Feature Point Registration

Registration with feature points involves aligning images without the need for a feature expression matrix. It uses tracklines detected from the image and lines from the chip mask according to predefined rules.

circle-info

Prerequisite to accessing this approach:

  1. Image must pass QC: this ensures the tracklines are visible.

  2. Valid Stereo-seq chips that follow the predefined rules: Stereo-seq N FFPE V1.0, Stereo-seq T FF V1.3, or Stereo-CITE T V1.1 chips.

  3. Input .tar.gz or the .stereo file correspondent .tar.gz is generated from StereoMap >= 4.1.

To ensure that the two sets of lines match, you must also identify a specific point to indicate the orientation of the image; otherwise, the auto-alignment may fail.

Requirements to select the correct feature point and get the correct registration result:

  1. The tissue's orientation in the image matches its placement on the slide, with the slide's engraved label on the right. The maximum tilting angle allowed is less than 15°.

  2. The four chip edges/corners can be seen from the image.

  3. The imaging process has strictly followed the instructions specified in Microscope Assessment Guidelinearrow-up-right - Chapter 3 Microscope Imaging Guidelines - 3.2.2. Precautions for Experimental Operations. You can access it from STOmicsarrow-up-right -> Resources Documentsarrow-up-right.

circle-exclamation
circle-info

Feature point registration begins with an image that has been adjusted for rotation and scaling.

The process of feature point registration involves two stages:

  • Adjusting Image Visibility: To ensure all four edges and corners of the chip are clearly visible.

  • Selecting a Reference Point: To set it as the reference.

To ensure all four sides of the chip are visible, you can manually adjust the image's Normalization , Contrast , Brightness , and Opacity .

Once you can see the chip, you should identify a predetermined point inside the chip region that is nearest to the bottom left corner. Click on this point to select it, and then click Next to complete the registration.

After selection, the orientation of the image will be auto-adjusted. You will see the result in Step 3: Tissue Segmentation.

circle-info

After the image has been aligned with the matrix, steps 3 and 4 can be bypassed. You can export the semi-processed .tar.gz image directly and feed this output to SAW for automatic segmentation.

In addition, a *regist.tif image file will be provided. This is a reoriented image that matches the shape and orientation of its corresponding feature expression matrix. This image serves as the starting point for tissue and cell segmentation. If you’re considering using other external segmentation tools or algorithms, it’s strongly advised to utilize this *regist.tif file as the input. Other.tif file may fail to import due to the difference in image and matrix size.

Step 3: Tissue Segmentation

circle-info

Tissue Segmentation is a skippable step.

In this step, you will define the tissue regions. Precisely identifying tissue boundaries helps minimize background interference, improving the accuracy of clustering results. The segmented tissue regions from the image will be mapped onto the sequencing-based spatial feature expression matrix, generating a feature density map for the tissue.

circle-info

If you upload the .stereo file in step 1, you can see a semi-transparent mask overlapped on the registered microscope image.

For .tar.gz or .tif/.tiff image file, you will need to use tools to draw the tissue region.

In the Tissue Segmentation step, you can edit the recorded mask or create a new one. The tissue mask recorded in the .tar.gz or .stereo file appears as "RECORD" in the Segmentation mask dropdown, while manually drawn or imported masks are labeled as "CUSTOM". Select a mask from the dropdown to update the canvas display.

To select or edit the tissue region, use a combination of Lasso , Brush , and Eraser tools.

  • Lasso Tool: This tool is typically used for selecting or deselecting large areas. It allows you to draw a freehand selection around the region of interest.

  • Brush Tool: This tool is more suitable for smaller areas, such as regions around tissue or fill in small holes in the tissue. It allows you to paint over specific areas to include or exclude them from the selection.

  • Eraser Tool: Similar to the Brush tool, the Eraser tool is used for smaller areas. It allows you to remove or deselect specific regions within the larger selection.

Lasso
Brush
Eraser

If you have created a .tif format binary mask file using a third-party tool, you can import it by:

  • Click on the Segmentation Mask dropdown menu on the right panel.

  • Select Add Mask in the CUSTOM category to import mask.

  • Navigate to your .tif binary mask file from your file system and click Open to import it.

If the imported result is unsatisfactory, you can replace it with a new mask

  • Click on the Segmentation Mask dropdown menu again.

  • Select the option with in the CUSTOM category to replace mask.

  • Navigate to your .tif binary mask file from your file system and click Open to import it.

Import tissue mask
Show the file name of the imported mask
Replace the mask

Step 4: Cell Segmentation

circle-info

Cell Segmentation is a skippable step.

Cell segmentation is a key step in generating single-cell spatially resolved feature expression data.

circle-info

If you upload the .stereo file in step 1, you can see the red outlines of the cells/nuclei on the registered microscope image.

For .tar.gz or .tif/.tiff image file, you will need to use tools to label cells.

Cell segmentation is applicable only within the tissue region. Therefore, the areas not encompassed in the Step 3 Tissue Segmentation will appear as a black background.

Similar to Step3 Tissue Segmentation, you can edit a previously recorded mask ("RECORD") or create a new one ("CUSTOM") by selecting from the Segmentation Mask dropdown. Change the active mask by selecting from the Segmentation mask dropdown.

StereoMap offers three ways to refine your cell segmentation:

  1. Import a Cell Segmentation Mask Use third-party tools or algorithms to segment cells on your registered image and import the result for Stereo-seq analysis. This method is best if you have high-quality segmentation results from third-party tools and want to seamlessly integrate them into your Stereo-seq analysis. It is ideal for large datasets or when using advanced segmentation models.

  2. Parameter-Adjustable Semi-Automatic Tool This method allows you to apply automated segmentation across the entire tissue or within a selected region, with adjustable parameters for optimization. It is recommended when you need a quick and efficient way to refine segmentation while maintaining flexibility. This approach works well when the initial segmentation is decent but requires parameter tuning to improve accuracy, especially in cases with variable cell density.

  3. Manual Refinement with Drawing Tools Using drawing tools like the lasso, brush, and eraser for precise manual cell segmentation adjustments. This method is most suitable for precise corrections in small regions, such as separating clustered cells, correcting segmentation errors, or handling complex regions where automated methods struggle. It is ideal for small datasets or cases requiring detailed, cell-by-cell refinement.

Import a Cell Segmentation Mask

If you have already segmented cells using external tools, you can easily import the .tif format segmentation mask generated from the registered image and use it directly in your Stereo-seq analysis.

  1. Click on the Segmentation Mask dropdown menu on the right panel.

  2. Select Add Mask in the CUSTOM category to import mask.

  3. Navigate to your .tif binary mask file from your file system and click Open to import it.

If the imported result is unsatisfactory, you can replace it with a new mask

  1. Click on the Segmentation Mask dropdown menu again.

  2. Select the option with in the CUSTOM category to replace mask.

  3. Navigate to your .tif binary mask file from your file system and click Open to import it.

Import cell mask
Show the file name of the imported mask
Replace the mask

Parameter-Adjustable Semi-Automatic Tool

The parameter-adjustable semi-automatic tool provides a balance between automation and control, allowing you to refine segmentation by adjusting key parameters to better fit your tissue sample.

  1. Click on the Automated Segmentation dropdown menu on the right panel, and choose Watershed. Once selected, the Box select mouse tool will be activated and ready for use.

  2. Use the Box select mouse tool to select your region of interest (ROI) area where you want to fine-tune the segmentation. This will trigger the Watershed Parameters settings dialog to pop up.

  3. In the pop-up Watershed Parameters settings dialog, modify key parameters to optimize segmentation for your ROI. Refer to Understanding Segmentation Parameters and Tips to Optimizing Segmentation Results for more information.

  4. After adjusting the parameters, click Apply to implement the changes. Wait for the segmentation outcome to process and review the results.

  5. If you are satisfied with the segmentation of most cells, you can further refine any misclassified cells using the drawing tools (lasso, brush, or eraser). Alternatively, if you're satisfied with the segmentation, click Next to proceed to the final step.

circle-info

Be aware that the automated tool only updates the segmentation within your selected region, so cells at the edges of the selection box will have rigid boundaries.

To avoid this issue, you can either select the entire tissue region to ensure smooth segmentation across the tissue, or use the drawing tools to fix any misclassified cells while maintaining the accuracy of the rest of the segmentation.

Manual Refinement with Drawing Tools

This method provides the highest level of precision, manually edit the segmentation using Lasso , Brush , and Eraser tools to fine-tune individual cell boundaries.

  • Lasso: Best for deselecting large areas, such as the background.

  • Brush & Eraser: Ideal for refining smaller areas, such as marking cells, or separating cell clusters.

Lasso to select a cell
Lasso to deselect some cells
Brush
Eraser

Step 5: Export

The final step is to export the results of image registration, tissue segmentation, and cell segmentation. Click Export image processing record to generate a .tar.gz file.

Click on the export will open your file system, and you will be allowed to select a saving path.

There are two types of export files:

  • *.tar.gz File: This file stores your original image along with all manual adjustments you made. It’s essential for SAW to combine sequencing data with image analysis. The internal structure of the .tar.gz is fixed, therefore to keep everything working smoothly, modifying it is not recommended.

  • *regist.tif File: If you manually adjusted the image alignment, this file will be saved in your output folder (or in the /outs/ directory of SAW). The TIFF format makes it easy to use in third-party tools. This image has been cropped and resized to match the feature expression matrix dimensions, ensuring that any data generated from it using external tools can also be re-imported into StereoMap for further analysis.

Pass the TAR.GZ to SAW Pipeline

There are two options for transferring the output of Image Processing to SAW.

  1. Using --image-tar in the SAW count Pipeline

    • This option is to use the --image-tar argument to feed the .tar.gz file into the SAW count pipeline

    • This will process the .tar.gz file along with the Stereo-seq FASTQ files.

    • The final output includes an HTML summary report with integrated sequencing and imaging data.

  1. Using --realigned-image-tar in the SAW realign Pipeline

    • This option is to use the --realigned-image-tar argument to input the .tar.gz file into the SAW realign pipeline

    • SAW realign skips CID mapping and genome alignment.

    • It re-generates aligned images and extracts the feature expression matrix at both tissue and cell level

    • The pipeline produces an updated HTML report with refined segmentation and spatial expression data.

Last updated