Getting Started with mAIcrobe¶
Welcome to mAIcrobe! This guide will get you up and running with bacterial cell analysis in under 10 minutes.
π Installation¶
Prerequisites¶
Before installing mAIcrobe, ensure you have:
- Miniconda (strongly recommended for dependency management)
Installing Miniconda (Recommended)¶
We strongly recommend using miniconda to manage your Python environment and dependencies. This prevents conflicts and ensures a smooth installation experience.
Download and Install Miniconda¶
-
Download the appropriate installer for your system from miniconda.org:
- Windows: Download the
.exeinstaller - macOS: Download the
.pkginstaller (Intel) or.shscript (Apple Silicon) - Linux: Download the
.shscript
- Windows: Download the
-
Install by following the installer prompts:
- Accept the license agreement
- Choose installation location (default is recommended)
- Important: When asked "Do you wish the installer to initialize Miniconda3?", choose Yes
- Important: Do NOT install miniconda, or allow the environments to be managed, in a folder that contains spaces.
-
Restart your terminal/command prompt after installation
-
Verify installation by running the following in your terminal (macOS/Linux) or miniconda command prompt (Windows):
Create a Dedicated Environment¶
Create a clean environment specifically for mAIcrobe. In your terminal (macOS/Linux) or miniconda command prompt (Windows), run:
# Create new environment with Python 3.11
conda create -n mAIcrobe python=3.11
# Activate the environment
conda activate mAIcrobe
Recommended Installation (Using Conda)¶
With your conda environment activated, install mAIcrobe:
Important Make sure your conda environment is activated whenever you want to use mAIcrobe! You should see (mAIcrobe) in your terminal prompt. \n**mAIcrobe is now installed! π** To use it, just activate your conda environment and launch napari. See below for more details.
Alternative Installation Methods (click to expand)
Standard pip Installation (without conda)¶
If you prefer not to use conda (not recommended):
Development Installation (from source)¶
For contributors or advanced users:
β Verify Installation¶
Test your installation by launching napari with the plugin. In your terminal, run:
Or programmatically:
Then check if "mAIcrobe" appears under Plugins in the menu bar.
π₯ First Analysis¶
Let's perform your first bacterial cell analysis using the included sample data.
Step 1: Launch napari¶
Go to your terminal and run:
or programmatically:
Step 2: Load Sample Data¶
mAIcrobe includes S. aureus test images. Load them via:
Option A: GUI Method 1. Go to File > Open Sample > mAIcrobe 2. Select: - "Phase contrast S. aureus" - "Membrane dye S.aureus" - "DNA dye S.aureus"
Option B: Programmatic Method
import napari
import numpy as np
# Launch napari viewer
viewer = napari.Viewer()
# Load sample data
from napari_mAIcrobe._sample_data import phase_example, membrane_example, dna_example
# Get the sample images
phase_data = phase_example()[0]
membrane_data = membrane_example()[0]
dna_data = dna_example()[0]
# Add images to viewer
phase_layer = viewer.add_image(phase_data[0], **phase_data[1])
membrane_layer = viewer.add_image(membrane_data[0], **membrane_data[1])
dna_layer = viewer.add_image(dna_data[0], **dna_data[1])
Step 3: Segment Cells¶
- Go to
Plugins > mAIcrobe > Compute label - Configure segmentation parameters: For the purpose of this tutorial, leave all other parameters as default.
- Click Run
The segmentation will create a new "Labels" layer with individual cells outlined.
Step 4: Analyze Cells¶
- Go to
Plugins > mAIcrobe > Compute cells - Configure analysis parameters:
- Label Image: Select the labels layer from Step 3
- Membrane Image: Select membrane layer
- DNA Image: Select DNA layer
- Pixel size: Enter your pixel size (e.g., 0.065 ΞΌm/pixel) (optional)
- Classify cell cycle: Check this box
- Model: Select "S.aureus DNA+Membrane Epi"
- Click Run
This will add statistical measurements to the Labels layer properties. For the purpose of this tutorial, leave all other parameters as default.
Step 5: View Results¶
After analysis completes, you can:
- View cell statistics: Check the layer properties panel
- Filter cells: Use
Plugins > napari-mAIcrobe > Filter cells - Generate reports: Enable "Generate Report" in Step 4
π Next Steps¶
Now that you've completed your first analysis:
- Segmentation Guide - Choose the optimal segmentation method
- Cell Analysis Guide - Comprehensive analysis workflows
- Cell Classification Guide - Cell classification in detail
- API Reference - Programmatic usage
Tip: Building your own classifier? Export per-cell training pickles via Plugins > mAIcrobe > Compute pickles. Provide a Labels layer, a Points layer named with the class id (e.g., "1"), select one/two channels, and choose an output folder. See the Cell Classification Guide for details.
π€ Getting Help¶
If you encounter issues:
- Check this documentation and troubleshooting guides
- Search GitHub Issues
- Include error messages, napari version, and system details
Welcome to the mAIcrobe community! π¬