SIM/WFM Segmentation

Structured Illumination Microscopy (SIM) and Widefield Microscopy (WFM) segmentation module provides comprehensive tools for super-resolution and conventional fluorescence microscopy data analysis.

Core Functions

Core Segmentation API

SIM/WFM segmentation now uses the unified Segmenter API for consistent interface.

Recommended Usage (Unified API):

from ipa.processing.segmentation import SIMERSegmenter, SIMMitoSegmenter, WFMSegmenter

# ER Network Segmentation
er_seg = SIMERSegmenter(device='cuda')
er_seg.load_model()
results = er_seg.predict(volume)

# Mitochondria Segmentation
mito_seg = SIMMitoSegmenter(device='cuda')
mito_seg.load_model()
results = mito_seg.predict(volume)

# General WFM Segmentation
wfm_seg = WFMSegmenter(device='cuda')
wfm_seg.load_model()
results = wfm_seg.predict(volume)

For detailed API documentation, see Segmentation Module.

Example Usage

ER Network Segmentation

from ipa.processing.segmentation import SIMERSegmenter
from ipa.data_loader import UniversalDataLoader

# Load SIM ER data
er_data = UniversalDataLoader.load_data("SIM_ER.tif")

# Segment ER network
segmenter = SIMERSegmenter(device='cuda')
segmenter.load_model()
results = segmenter.predict(er_data)
er_mask = results['er_mask']

ISG Sphere Detection

from ipa.processing.segmentation import SIMISGSegmenter

# Load ISG immunofluorescence data
isg_data = UniversalDataLoader.load_data("SIM_ISG.tif")

# Detect spherical granules
segmenter = SIMISGSegmenter(device='cuda')
segmenter.load_model()
results = segmenter.predict(isg_data)
isg_mask = results['isg_mask']
print(f"Detected {num_spheres} ISG spheres")

Nucleus and Cell Segmentation

from ipa.processing.segmentation import segment_cell_shape, segment_nucleus

# Cell shape segmentation using actin
cell_mask = segment_cell_shape(
    actin_data,
    threshold=None,  # Automatic threshold
    min_size=1000
)

# Nuclear segmentation
nucleus_data = UniversalDataLoader.load_data("SIM_raw_N.tif")
labeled_nuclei = segment_nucleus(nucleus_data)
num_nuclei = np.max(labeled_nuclei)
print(f"Detected {num_nuclei} nuclei")