GUI Usage Guide¶
Starting the GUI¶
Method 1: Direct Command¶
Method 2: Container Deployment¶
Method 3: Windows¶
GUI Interface Overview¶
The FOCUS GUI consists of four main stages:
Stage 1: Setup¶
Purpose: Define your dataset location and configuration approach
Interface Elements: - Dataset Path: Browse to your dataset directory - Load Config: Load an existing configuration file - New Config: Start a new configuration from scratch - Next: Proceed to configuration stage
Actions: 1. Click Browse to select your dataset directory 2. Choose New Config for first-time setup or Load Config to modify existing 3. Click Next to continue
Stage 2: Configuration¶
Purpose: Define modalities, processing parameters, and pipeline settings
Main Sections:
Dataset Settings¶
- Dataset Path: Displayed from setup stage
- Reference Modality: Select which modality serves as the coordinate reference
Outputs are always written back under dataset_path (the final dataset lands at
<dataset_path>/merged/multimodal_dataset.h5mu); there is no separate output-directory
field.
Modality Configuration¶
Adding Modalities: 1. Click Add Modality button 2. Select modality type from dropdown: - Microscopy Image - MSI (Mass Spectrometry Imaging) - Raman Spectroscopy Imaging - Spatial Transcriptomics 3. Enter modality name (must match directory names) 4. Configure modality-specific settings
Modality-Specific Settings:
Microscopy Image: - Input Format: OME-TIFF, qpTIFF, TIFF, or CZI - Color Enhancement: Enable/disable gamma correction and contrast stretching - Background Removal: Enable/disable and choose the fill colour (white or black) - Crop to Tissue: Enable/disable with margin size
Note
The number of OME-TIFF pyramid levels is computed automatically from the image size and is not a GUI setting.
MSI (Mass Spectrometry Imaging): - Intensity Normalization: None/TIC/Log/CLR - Background Detection: Enable/disable GMM-based detection - Recalibration: Enable/disable m/z recalibration - Lipid Annotation: Enable/disable lipid database matching
Note
Ion mode is not a GUI setting. Each sample's ion modes are detected from its data: an ion mode is used when its pos/ or neg/ subfolder holds a complete .imzML + .ibd pair. The GUI creates both subfolders for every MSI sample. If you only have one ion mode, leave the other empty.
Raman Spectroscopy Imaging: - Wavenumber Range: Range to process - BaSiC Correction: Enable/disable - Background Removal: Enable/disable - ASHLAR Stitching: Enable/disable - Spectral Cleaning: Despike, denoise, baseline options
Spatial Transcriptomics: - Spot filters: Min/Max Count Per Spot, Min/Max Genes Per Spot (leave blank to disable) - Gene filters: Min Spots Per Gene, Min Count Spots Ratio Per Gene (applied to the merged dataset) - Remove Mitochondrial Genes: Enable/disable - Total Counts Normalize: Enable/disable (scales each spot to 10,000 counts) - Log1p Transform: Enable/disable
Note
Every spot filter, gene filter and normalisation step is off by default. With defaults, .X in the output holds the raw counts from your input file. There is no highly-variable-gene selection.
Processing Options¶
Preprocessing: - Force Recomputing: Reprocess all files even if cached
Alignment: - Perform Alignment: Enable/disable alignment stage - Alignment Strategy: Manual (GUI) or Pre-aligned - Force Recomputing: Re-run alignment even if cached
Registration: - Perform Registration: Enable/disable registration stage - Registration Type: Feature Extraction (GPU) or Spot Interpolation (CPU) - Force Recomputing: Re-run registration even if cached
Feature Extraction Settings (GPU only): - Patch Size: Size of image patches (default: 224) - Background Color: White or black background handling
Feature Extraction expects H&E brightfield images
Its model (Prov-GigaPath) is pretrained on H&E-stained brightfield tiles. Select it only for an H&E histological section imaged in RGB; for fluorescence, IHC or other stains select None as the registration type. The GUI does not restrict the choice and the pipeline does not check the stain. A non-H&E image is embedded without any error.
Spot-interpolation registration is parameter-free in the GUI. The interpolation neighbourhood is derived automatically from each modality's spot size.
Advanced Settings¶
- HuggingFace Token: Required for
feature_extractionregistration (used to download the Prov-GigaPath model weights)
Actions:
1. Configure all desired modalities
2. Set processing options
3. Review advanced settings
4. Configuration is automatically saved as focus_config.json
5. Click Start Processing to run FOCUS with the current configuration
Stage 3: Running¶
Purpose: Monitor pipeline execution and perform interactive tasks
Interface Elements: - Progress Bar: Overall pipeline progress - Stage Indicator: Current pipeline stage (Preprocessing/Alignment/Registration/Compilation) - Log Panel: Real-time logging output - Status Panel: Current operation details - Alignment Button: Appears during alignment stage
Pipeline Stages:
Preprocessing Stage¶
- Shows progress for each modality
- Displays sample-by-sample processing
- Estimated time remaining
- Log output for each operation
Alignment Stage¶
- Manual Alignment Required: When alignment button appears
- Click Open Alignment Tool to launch alignment GUI
- Perform visual alignment (see Alignment Guide)
- Confirm the last sample of that modality. The pipeline continues automatically, and the alignment tab can be closed afterwards
- The button reappears for the next non-reference modality, if there is one
Registration Stage¶
- Shows feature extraction or interpolation progress
- Displays modality-by-modality processing
- GPU utilization monitor (if applicable)
- Memory usage monitoring
Compilation Stage¶
- MuData compilation progress
- Validation checks
- Final output generation
Actions: - Monitor progress in real-time - Review logs for any warnings/errors - Perform manual alignment when prompted - Pipeline runs automatically through all stages
Stage 4: Complete¶
Purpose: Review results and access output files
Interface Elements: - Completion Summary: Pipeline execution summary - Output Files List: All generated files with paths - Statistics: Processing time, data sizes - Open Folder: Button to open output directory - New Pipeline: Button to start new pipeline - Exit: Button to close GUI
Output Files:
- Preprocessed files for each modality
- Aligned coordinate files
- Registered feature matrices
- Final MuData file (<dataset_path>/merged/multimodal_dataset.h5mu)
- The run log file (<dataset_path>/focus.log)
- Configuration file (<dataset_path>/focus_config.json)
Actions: 1. Review output file list 2. Click Open Folder to access results 3. Click New Pipeline to start another run 4. Click Exit to close the GUI
Interactive Alignment Tool¶
Overview¶
The alignment tool is a separate web interface for interactive visual alignment between modalities.
Starting the Tool¶
- During the Running stage, when alignment is needed
- Click Open Alignment Tool button
- New browser window opens at
http://localhost:8000
Interface Layout¶
The window is split into two parts: a display viewport (80% of the width) and a control panel (20%).
Display viewport - Both modalities are drawn overlaid in the same viewport - The reference modality is the layer on top and the one that moves; the target modality is fixed and defines the coordinate space - Image modalities are shown at the lowest pyramid level of their OME-TIFF; spot modalities are coloured by cluster label
Control panel: each layer has its own section, headed by that modality's name and type.
Control Panel Tools¶
Mode - Aligner (selected at start): the pointer acts on the reference layer - Camera: the pointer pans and zooms the view, leaving the transform untouched
Transform (acts on the reference layer) - Flip Horizontal / Flip Vertical - Scale − / + with Reset - Rotation ° − / + with Reset - Reset Distortion: undoes corner and edge dragging only - Reset Transform: returns the layer to its starting position
Pointer gestures in Aligner mode - Drag inside the frame to translate - Drag a corner handle to move that corner alone; drag an edge handle to move its two corners together - Drag just outside a corner to rotate about the layer's centre - Mouse wheel to scale about the pointer
Per-layer controls - Opacity (reference layer): how strongly it covers the target - Spot Classes with All / None: show or hide individual clusters of a spot layer - Foreground with All / FG / BG: restrict a spot layer to foreground or background spots - View Zoom − / + with Reset: zoom the viewport
Confirm - Confirm Alignment: saves the transform and loads the next sample
Alignment Modes¶
The tool adapts to the modality types of the pair. In every mode the transform applies to the reference modality only; the target stays fixed and defines the coordinate space.
| Pair | What you align | What FOCUS stores |
|---|---|---|
| Spot reference → spot target | The reference spots onto the target spots | Reference spot coordinates in the target's frame |
| Spot reference → image target | The reference spots onto the target image | Reference spot coordinates in the target image's pixel frame |
| Image reference → image target | The reference image onto the target image | The target image cropped to the region the reference covers |
An image reference paired with a spot modality is not supported and is rejected when the configuration is validated.
Workflow¶
- Sample Selection: Tool automatically loads current sample
- Alignment: Perform manual alignment as described above
- Confirmation: Click Confirm Alignment to save
- Next Sample: Tool automatically advances to next sample
- Completion: After the last sample of the modality is confirmed, the tool reports completion and the pipeline resumes; close the tab then
Tips for Accurate Alignment¶
- Visual Reference: Identify distinctive features present in both modalities
- Distributed Adjustments: Make adjustments distributed across the tissue area
- Zoom In: Use high zoom for precise alignment
- Check Coverage: Ensure entire tissue area is covered
- Symmetry: Use symmetrical features for verification
- Iterative: Make small adjustments and verify frequently
Configuration Management¶
Automatic Configuration Saving¶
The configuration is automatically saved as focus_config.json in the dataset directory every time you make a change. You do not need to click a save button. Changes are saved immediately.
Loading Configurations¶
- In Setup stage, click Load Config
- Browse to existing
focus_config.jsonfile or another named config file - All settings loaded and ready for execution
Modifying Configurations¶
- Load existing configuration in the GUI
- Make desired changes in Configuration stage
- Changes are automatically saved to
focus_config.json - To keep multiple configs, manually copy
focus_config.jsonto different filenames (e.g.,focus_config_v1.json,focus_config_v2.json) and load them as needed
Configuration File Structure¶
The JSON configuration file contains:
{
"dataset_path": "/path/to/dataset",
"reference_modality": "msi",
"perform_alignment": true,
"perform_registration": true,
"huggingface_token": null,
"spatial_annotations": null,
"modalities": [
{
"alignment_strategy": "manual",
"name": "msi",
"processing_settings": {
"mass_tolerance": 10,
"intensity_normalization": "tic",
"min_intensity_threshold": 10000,
"detect_background": true,
"force_recomputing": false
},
"registration_settings": {},
"registration_type": "none",
"type": "msi"
},
{
"alignment_strategy": "manual",
"alignment_force_recomputing": false,
"name": "microscopy",
"processing_settings": {
"color_enhancement": true,
"remove_background": true,
"crop_to_tissue": true,
"gamma": 0.45,
"force_recomputing": false
},
"registration_settings": {},
"registration_type": "feature_extraction",
"type": "microscopy_image"
}
]
}
See Configuration Reference for detailed field explanations.
Troubleshooting GUI Issues¶
Common Problems¶
Issue: GUI doesn't start
- Solution: Check conda environment is activated
- Command: conda activate FOCUS
Issue: Port already in use
- Solution: Change GUI port or kill existing process
- Command: lsof -i :5050 then kill <PID>
Issue: Browser doesn't open automatically
- Solution: Manually open http://localhost:5050
Issue: Alignment tool doesn't launch
- Solution: Check port 8000 availability
- Command: lsof -i :8000 then kill <PID>
Logs and Debugging¶
- Run log: A single log file is written to
<dataset_path>/focus.log(always at DEBUG level). Start the GUI withfocus --debugto also show DEBUG output, including werkzeug HTTP request logs, in the terminal. - Browser Console: Press F12 in the browser for frontend errors
- Network Tab: Check API requests/responses
Error Messages¶
| Error | Meaning | Solution |
|---|---|---|
| "Dataset path not found" | Invalid dataset directory | Check path exists and permissions |
| "Configuration invalid" | Malformed JSON config | Validate JSON structure |
| "Modality not found" | Directory missing | Check directory names match config |
| "Port in use" | Another process using port | Kill process or change port |
| "GPU not available" | CUDA not detected | Install drivers or use CPU mode |
Best Practices¶
Data Organization¶
- Consistent Naming: Use clear, consistent sample and modality names
- Directory Structure: Follow exact structure requirements
- File Formats: Use supported input formats only
- Permissions: Ensure read/write access to all directories
Configuration¶
- Start Simple: Begin with default settings
- Test Small: Test with small subset first
- Incremental Changes: Modify one setting at a time
- Auto-saved: Configuration is automatically saved as you make changes
Execution¶
- Monitor Resources: Watch CPU/RAM usage
- Check Logs: Review logs during execution
- Validate Outputs: Verify intermediate files
- Backup Config: Keep backup of working configurations
Alignment¶
- Use High-Quality Reference: Choose modality with rich morphological features
- Distributed Adjustments: Make adjustments across the tissue area
- Zoom for Precision: Use maximum zoom for critical areas
- Verify Coverage: Ensure entire tissue is aligned
Next Steps¶
- Try the CLI: Explore CLI Usage for automated execution
- Learn Configuration: Deep dive into Configuration Reference
- Understand Pipeline: Read about Pipeline Stages
- Prepare your data: See Preparing Your Data
Support¶
For GUI-related issues:
- Check Browser Console: Press F12 for error details
- Review Logs: Check GUI and pipeline logs
- Clear Cache: Clear browser cache if issues persist
- Try Different Browser: Switch to Chrome/Firefox
- Report Issues: Provide detailed error information when reporting bugs