> ## Documentation Index
> Fetch the complete documentation index at: https://docs.atomscale.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# SEM

> Object segmentation and morphological analysis from electron micrographs

SEM (Scanning Electron Microscopy) analysis automatically detects and segments objects from micrographs, then extracts morphological features for each object. The model provides per-object confidence scores, and unreliable detections are filtered out before results are presented.

## Overview

The SEM pipeline processes data in four stages:

1. **Image preparation**: detects and removes the metadata banner, reads the scalebar for spatial calibration
2. **Segmentation**: detects and segments individual objects using a deep learning model with uncertainty estimation
3. **Feature extraction**: measures morphological properties per object, including size, shape, and spacing metrics
4. **Filtering**: removes low-confidence detections and flags objects near the image border

### Key Metrics

| Metric                    | What It Tells You                                                                                     |
| ------------------------- | ----------------------------------------------------------------------------------------------------- |
| Equivalent diameter       | Average object size derived from major and minor axis lengths.                                        |
| Circularity               | Shape regularity (4πA/P²). A value of 1.0 indicates a perfect circle.                                 |
| Eccentricity              | How elongated an object is. Values near 0 are circular; values near 1 are highly elongated.           |
| Solidity                  | Ratio of object area to its convex hull area. Lower values indicate more concave or irregular shapes. |
| Nearest neighbor distance | Spacing between objects, measured both centroid-to-centroid and edge-to-edge.                         |
| Mean uncertainty          | Segmentation confidence for each object. Used to filter unreliable detections.                        |

<Tabs>
  <Tab title="Guide">
    ### Adding Data

    Upload SEM images (PNG or TIF) through the data page. Analysis begins automatically once the upload completes.

    ### Viewing Results

    Once processing completes, the workspace shows several sections:

    **Image viewer**: Displays the SEM image with a segmentation fingerprint overlay highlighting detected objects.

    **Outlier detection**: An interactive feature analysis view. Use the facet dropdown to switch between groups of related features (size, shape, spacing, etc.). Each feature is displayed as a histogram with objects classified as inliers or outliers:

    * **Green**: outlier (low end)
    * **Blue**: inlier
    * **Red**: outlier (high end)

    Drag the boundary lines on any histogram or enter numeric values to adjust the outlier thresholds. Bounds are saved per browser automatically.

    ### Configuration

    Open the configuration drawer (gear icon) to set spatial calibration. Enter the pixel distance and corresponding real-world distance with units to convert measurements from pixels to physical units. You can save and load workflow configuration presets from the dropdown at the top of the drawer.
  </Tab>

  <Tab title="Technical Details">
    ### Analysis Pipeline

    The SEM pipeline processes each uploaded image through four stages.

    #### Stage 1: Image Preparation

    The pipeline automatically detects and crops the instrument metadata banner, then reads the scalebar to establish spatial calibration. If calibration is already present in the image metadata (e.g., from a TIF header), scalebar detection is skipped.

    #### Stage 2: Segmentation

    The image is divided into overlapping patches and each patch is processed by a deep learning segmentation model that produces both an object mask and a per-pixel uncertainty map. Patches are then stitched back together into a full-image segmentation.

    #### Stage 3: Feature Extraction

    For each segmented object, the pipeline computes morphological properties including area, perimeter, axis lengths, eccentricity, solidity, and orientation. Derived metrics are calculated from these base measurements: circularity, equivalent diameter, mean uncertainty, mean intensity, and nearest neighbor distances (centroid-to-centroid and edge-to-edge).

    #### Stage 4: Filtering

    Objects are grouped by segmentation uncertainty, and high-uncertainty detections are removed. Objects near the image border are flagged since they may be only partially visible.
  </Tab>
</Tabs>
