Documentation
System Documentation
Complete technical reference for the MICRO platform — microscope & medical imaging simulation, instrument database, specimen library, and web interface.
System Architecture
MICRO is a self-contained Flask web application that simulates microscope and medical imaging workflows. The platform combines instrument databases, specimen libraries, and physics-based rendering engines.
Core Pipeline
- Instrument Selection — Choose from 69 instruments across 19 manufacturers
- Specimen / Phantom Selection — Pick from 18 specimen types or 28 anatomical phantoms
- Parameter Configuration — Set magnification, illumination, stain, modality-specific controls
- Physics Rendering — Engine applies optical/imaging physics to generate the simulated view
- Image Delivery — Base64-encoded PNG returned via REST API to the web viewer
Module Map
| Module | Path | Purpose |
|---|---|---|
| InstrumentRegistry | micro/instruments/registry.py | Loads and indexes all instrument JSON files from data/instruments/ |
| SpecimenRegistry | micro/specimens/registry.py | Manages specimen type definitions with stains and characteristics |
| PhantomRegistry | micro/phantoms/registry.py | Anatomical phantoms for medical imaging simulation |
| MicroscopeSimulator | micro/instruments/microscope.py | Brightfield, darkfield, phase contrast, fluorescence rendering |
| ImagingSimulator | micro/instruments/imaging.py | CT, MRI, Ultrasound, X-ray, Mammography, PET rendering |
| ImageLibrary | micro/images/library.py | AI-generated image lookup with procedural fallback |
| Flask Server | micro/web/server.py | Web routes, API endpoints, template rendering |
Instrument Database
The instrument database contains 69 instruments from 19 manufacturers,
organized into JSON files by manufacturer in data/instruments/.
Instrument Categories
| Category | Count | Description |
|---|---|---|
| Angiography | 2 | Angiography instruments |
| Ct | 5 | Computed tomography scanners |
| Dental Xray | 3 | Dental Xray instruments |
| Dexa | 1 | Dexa instruments |
| Mammography | 1 | Breast imaging systems |
| Microscope | 41 | Optical, confocal, and electron microscopes |
| Mri | 6 | Magnetic resonance imaging systems |
| Pet | 2 | Positron emission tomography |
| Spect | 1 | Spect instruments |
| Surgical Xray | 1 | Surgical Xray instruments |
| Ultrasound | 5 | Diagnostic ultrasound systems |
| Xray | 1 | Xray instruments |
JSON Schema
Each instrument file contains an array of instrument objects with these fields:
- manufacturer — Company name (e.g., "Zeiss", "Siemens Healthineers")
- model — Model name/number
- category — Instrument type (microscope, ct, mri, ultrasound, etc.)
- type — Specific subtype (e.g., "confocal", "wide-bore")
- specifications — Category-specific technical parameters
- imaging_modes — Supported imaging modalities
- product_url — Link to manufacturer's product page
Microscope Simulation Engine
The MicroscopeSimulator generates realistic microscopy views by combining specimen data, instrument specifications, and user-controlled optical parameters.
Illumination Modes
| Mode | Technique | Best For |
|---|---|---|
| Brightfield | Transmitted light, absorption-based contrast | Stained tissue sections, blood smears |
| Darkfield | Oblique illumination, scattered light | Unstained specimens, crystals, live cells |
| Phase Contrast | Phase shifts converted to amplitude differences | Transparent/live specimens |
| Fluorescence | Excitation/emission wavelength filtering | Immunofluorescence, GFP-tagged proteins |
Rendering Parameters
- Magnification — Zoom level within instrument's supported range
- Focus — Focal plane position (0.0–1.0)
- Stain — Applied histological stain (H&E, Gram, Giemsa, etc.)
- Brightness / Contrast — Post-processing adjustments
- Pan X / Y — Viewport position on the specimen
Medical Imaging Simulation Engine
The ImagingSimulator renders medical images using anatomical phantoms and modality-specific physics models. Each imaging modality has a dedicated renderer.
Supported Modalities
| Modality | Physics Model | Key Parameters |
|---|---|---|
| CT | X-ray attenuation (Hounsfield units), beam hardening | kVp, mA, slice thickness, window/level |
| MRI | Proton density, T1/T2 relaxation, field strength effects | Sequence (T1W, T2W, FLAIR), TR/TE, field strength |
| Ultrasound | Acoustic impedance, speckle noise, depth attenuation | Frequency, depth, gain, TGC |
| X-ray | Radiographic absorption, scatter, noise | kVp, mAs, SID, grid |
| Mammography | Soft tissue contrast, compression, dose | Target/filter, kVp, compression |
| PET | FDG uptake distribution, scatter, attenuation correction | Tracer, acquisition time, reconstruction |
Anatomical Phantoms
28 anatomical phantoms provide realistic tissue structures for imaging simulation across multiple specialties:
Core Anatomy
- Chest — Lungs, heart, mediastinum, ribs
- Head / Brain — Gray/white matter, ventricles, skull
- Abdomen — Liver, kidneys, spleen, bowel
- Cardiac — Chambers, valves, coronary vessels
- Pelvis — Hip bones, bladder, soft tissue
Musculoskeletal
- Knee (Normal) — Femur, tibia, meniscus, ligaments
- Knee — ACL Tear — Anterior cruciate ligament pathology
- Knee — Meniscus Tear — Medial/lateral meniscus lesions
- Knee — Osteoarthritis — Degenerative joint changes
- Spine — Vertebrae, discs, spinal cord
- Spine — Disc Herniation — Disc protrusion/extrusion
- Spine — Compression Fracture — Vertebral body fracture
- Spine — Stenosis — Spinal canal narrowing
- Cervical Spine — C-spine anatomy
- Shoulder — Rotator cuff, labrum, joint
- Wrist / Hand — Carpal bones, tendons
- Ankle / Foot — Tarsal bones, ligaments
Dental
- Dental Periapical — Single tooth with periapical region
- Dental Panoramic — Full jaw panoramic view
- Dental CBCT — Cone beam computed tomography
- Dental Pathology — Caries, abscesses, periodontal disease
Oncology & Nuclear
- Breast — Fibroglandular tissue, fat, ducts
- Prostate — Zonal anatomy, lesion detection
- Liver Lesions — Hepatic masses and characterization
- Thyroid — Gland anatomy, nodule evaluation
- Whole Body PET — FDG uptake distribution
- Brain PET — Cerebral metabolism mapping
Specimen Library
The specimen library contains 18 specimen types organized into categories, each with supported stains and characteristic features for simulation.
Specimen Categories
- Hematology — Blood smears, bone marrow aspirates
- Histology — Tissue sections (liver, kidney, lung, skin, brain, etc.)
- Microbiology — Bacterial cultures, fungal preparations
- Cytology — Cell preparations, Pap smears
- Pathology — Biopsy specimens, surgical pathology
Staining Techniques
| Stain | Application | Key Features |
|---|---|---|
| H&E | General histology | Nuclei blue-purple, cytoplasm pink |
| Gram | Bacteriology | Gram+ purple, Gram− pink |
| Giemsa | Hematology, parasitology | WBC differential, malaria parasites |
| Wright | Blood films | Romanowsky-type polychromatic stain |
| PAS | Glycogen, mucins | Magenta for polysaccharides |
| Silver | Reticulin, nerve fibers | Black deposits on target structures |
| Trichrome | Connective tissue | Collagen blue/green, muscle red |
| DAPI | Fluorescence microscopy | Blue fluorescent DNA binding |
Web Platform
The web interface is built with Flask, Jinja2 templates, and vanilla JavaScript. It follows a Splunk-inspired dark theme with responsive design.
Page Routes (36)
| Route | Page | Description |
|---|---|---|
/home | Home | Landing page with KPI overview and quick navigation |
/dashboard | Dashboard | Platform dashboard with statistics and recent activity |
/instruments | Instruments | Filterable grid of all instruments with category/manufacturer filters |
/instruments/<mfr>/<model> | Instrument Detail | Full specification sheet for a single instrument |
/specimens | Specimens | Specimen library browser with category filtering |
/specimens/<id> | Specimen Detail | Specimen image library with upload, AI generation, filters |
/specimens/images | Specimen Images | Browse all specimen images across all types |
/phantoms | Phantoms | Anatomical phantom library browser |
/phantoms/<id> | Phantom Detail | Phantom image library with modality filtering |
/viewer/microscope | Microscope Viewer | Interactive microscopy simulator with image library sidebar |
/viewer/imaging | Imaging Viewer | Medical imaging simulator with modality-specific controls |
/viewer/3d | 3D Viewer | Three.js interactive 3D model viewer |
/viewer/dicom | DICOM Viewer | DICOM study viewer with cine playback and region zoom |
/dicom | DICOM Studies | DICOM study browser with study cards |
/threed | 3D Models | 3D model library browser |
/threed/<model_id> | 3D Model Detail | 3D model detail with file management |
/training | Training | Training module listing with progress tracking |
/training/notes | Training Notes | Note-taking system for training modules |
/training/<module> | Training Module | Module detail with lesson list |
/training/<module>/<lesson> | Lesson | Individual lesson content with navigation |
/projects | Projects | Project tracking page |
/security | Security | Security overview page |
/backlog | Backlog | Feature request backlog with expandable detail rows |
/documentation | Documentation | This page — system reference |
/documents/design | Design Document | System design documentation |
/documents/integration | Integration Document | REST API specification and integration guide |
/documents/architecture | Architecture Document | Deployment topology, tech stack, security architecture |
/builds | Builds | Build history with release changelogs |
/test-report | Test Report | Automated test results |
/users | Users | User management admin panel |
/bugs | Bugs | Bug tracker |
REST API (25 Endpoints)
| Endpoint | Method | Description |
|---|---|---|
/api/instruments | GET | List all instruments (filterable by category, manufacturer) |
/api/search | GET | Search instruments by query string |
/api/stats | GET | Platform statistics (counts, categories) |
/api/specimens | GET | List all specimen types |
/api/specimens | POST | Create new specimen type |
/api/specimens/<id> | PUT | Update specimen metadata |
/api/specimen-images | GET | List all specimen images |
/api/specimen-images/upload | POST | Upload specimen image with metadata |
/api/specimen-images/ai-generate | POST | Generate specimen image via OpenAI |
/api/specimen-images/<id> | PUT | Update specimen image metadata |
/api/specimen-images/<id> | DELETE | Delete a specimen image |
/api/phantoms | GET | List all anatomical phantoms |
/api/phantom-images/upload | POST | Upload phantom image with metadata |
/api/phantom-images/ai-generate | POST | Generate phantom image via AI |
/api/phantom-images/<id> | PUT | Update phantom image metadata |
/api/phantom-images/<id> | DELETE | Delete a phantom image |
/api/threed | GET | List all 3D models |
/api/threed-files/upload | POST | Upload 3D model file |
/api/threed-files/<id> | PUT | Update 3D model file metadata |
/api/threed-files/<id> | DELETE | Delete a 3D model file |
/api/dicom/<study_id> | PUT | Update DICOM study metadata |
/api/dicom/<study_id> | DELETE | Delete a DICOM study |
/api/render/microscope | POST | Render a microscopy image (JSON body) |
/api/render/imaging | POST | Render a medical image (JSON body) |
/api/chat | POST | AI chatbot — send message, receive GPT-4o-mini response |
AI Image Generation Pipeline
MICRO includes an AI-powered image generation pipeline that creates realistic specimen and phantom images using OpenAI's image models. The system falls back to procedural rendering when AI images are not available.
Pipeline Architecture
- Prompt Catalog — 51 curated prompts (22 microscopy, 29 imaging) in
data/image_prompts/catalog.json - Image Generator —
generate_images.pysends prompts to OpenAI API (gpt-image-1 or dall-e-3) - Image Library —
micro/images/library.pyindexes generated images by specimen+stain or phantom+modality - Simulator Integration — Both simulators check ImageLibrary first, fall back to procedural if no AI image exists
Usage
python generate_images.py --list— List all available promptspython generate_images.py --dry-run— Preview without generatingpython generate_images.py --scope microscopy— Generate only microscopy imagespython generate_images.py --key <prompt_key>— Generate a specific image
Training System
MICRO includes a comprehensive training curriculum with 16 modules and 97 lessons (~20.5 hours) covering microscopy fundamentals through advanced device-specific training.
Training Modules
| Module | Category | Difficulty | Lessons | Duration |
|---|---|---|---|---|
| Getting Started with MICRO | Platform | Beginner | 8 | 55 min |
| Introduction to Microscopy | Fundamentals | Beginner | 7 | 45 min |
| Specimen Preparation | Lab Techniques | Beginner | 8 | 60 min |
| Electron Microscopy | Advanced Imaging | Intermediate | 7 | 90 min |
| Medical Imaging Protocols | Clinical Imaging | Intermediate | 7 | 75 min |
| X-Ray Microscopy & Micro-CT | Advanced Techniques | Intermediate | 6 | 60 min |
| Digital Pathology | Diagnostics | Intermediate | 5 | 50 min |
| Dental Radiography | Clinical Imaging | Beginner | 6 | 55 min |
| Laboratory Safety Protocols | Safety | Beginner | 5 | 40 min |
| Dental Anatomy & Imaging Interpretation | Clinical Imaging | Beginner | 5 | 50 min |
| CT Scanning: Technology & Applications | Device Training | Intermediate | 7 | 120 min |
| MRI: Physics, Sequences & Applications | Device Training | Advanced | 7 | 150 min |
| Ultrasound: Physics & Applications | Device Training | Intermediate | 6 | 110 min |
| X-Ray & Fluoroscopy: Diagnostics | Device Training | Beginner | 5 | 90 min |
| Nuclear Medicine: PET, SPECT & Radionuclide | Device Training | Advanced | 4 | 100 min |
| Mammography: Technology & Breast Imaging | Device Training | Intermediate | 4 | 80 min |
Lesson Features
- Structured Content — Each lesson contains objectives, key concepts, and step-by-step instruction
- Navigation — Previous/Next lesson navigation within modules
- Progress Tracking — Module completion percentage displayed
- Duration Estimates — Per-lesson time estimates for study planning
- Text-to-Speech — TTS audio playback for lesson content
- Note Taking — Training notes system accessible at
/training/notes
Data Location
Training content is defined in data/training/modules.json and rendered
through the /training, /training/<module>, and
/training/<module>/<lesson> routes.
AI Chatbot Assistant
MICRO includes an AI-powered help assistant accessible from the top navigation bar. The chatbot provides expert answers on microscopy, medical imaging, specimen preparation, and platform usage.
Technical Details
| Component | Details |
|---|---|
| Model | OpenAI GPT-4o-mini |
| Endpoint | POST /api/chat |
| Max Tokens | 1,024 per response |
| Context Window | Last 20 messages maintained |
| System Prompt | Scoped to microscopy & medical imaging expertise |
UI Features
- Slide-out Panel — 400px panel slides in from the right side
- Typing Indicator — Animated dots shown while waiting for AI response
- Conversation History — Messages persist within the session
- Keyboard Support — Enter key sends messages
- Error Handling — Graceful degradation when API key missing or unavailable
Image Library Management
Both specimen and phantom detail pages include full image library management with upload, AI generation, editing, and filtering capabilities.
Image Sources
| Source | Badge | Method |
|---|---|---|
| Downloaded | ● Green | Curated images from Wikimedia Commons and other open sources |
| AI Generated | ● Purple | Generated via OpenAI gpt-image-1 with detailed microscopy prompts |
| Uploaded | ● Gray | User-uploaded images through the web interface |
Image Metadata
Each image stores comprehensive metadata:
- Identification — Unique ID, filename, title, description, date
- Specimen/Stain — Associated specimen ID and staining technique
- Microscope — Type (upright_optical, tem, sem) and model name
- Optical Parameters — Magnification, illumination mode, numerical aperture, focus position
- Source Tracking — Source attribution, source type, AI prompt (if generated)
Filtering
The specimen detail image library supports client-side filtering by:
- Microscope Type — Light Microscope (Upright Optical), TEM, SEM, Electron General
- Magnification Range — 1–10×, 11–40×, 41–100×, 101–1,000×, >1,000× (Electron)
The phantom detail page supports modality-based filtering (CT, MRI, Ultrasound, PET, etc.).
Data Storage
- Metadata —
data/specimens/images/<specimen_id>.jsonanddata/phantoms/images/<phantom_id>.json - Image Files —
data/generated_images/microscopy/anddata/generated_images/imaging/
Backlog & Feature Tracking
The backlog page at /backlog provides a feature request tracking system
with full traceability from description through acceptance criteria and test cases.
Backlog Item Fields
- Title, Description — Feature name and full description
- Priority — Critical, High, Medium, Low
- Status — Proposed, In Build, Testing, Complete, Deferred
- Type — Feature, Enhancement, Bug, Technical Debt
- Acceptance Criteria — Numbered list of pass/fail criteria
- Test Cases — Numbered test cases with expected outcomes
- Traceability — Requester, target build, and unique ID
Expandable Detail Rows
Each backlog item can be expanded to reveal three sections in a responsive grid:
- Full Description — Complete feature narrative
- Acceptance Criteria — Numbered requirements for sign-off
- Test Cases — Validation scenarios with expected results
Data is stored in browser localStorage under the key micro_backlog.
Glossary of Terms
| Term | Definition |
|---|---|
| Brightfield | Standard light microscopy technique where specimen is illuminated from below and observed in transmitted light. Contrast comes from absorption by stained structures. |
| Darkfield | Illumination technique using oblique light so only scattered light from the specimen reaches the objective. Background appears dark, structures appear bright. |
| Phase Contrast | Optical technique that converts phase shifts (from differences in refractive index) into amplitude differences visible to the eye. Ideal for unstained, transparent specimens. |
| Fluorescence | Microscopy using specific excitation wavelengths to cause fluorescent molecules (fluorophores) in the specimen to emit light at longer wavelengths. |
| H&E Stain | Hematoxylin and Eosin — the most common histological stain. Hematoxylin stains nuclei blue-purple; eosin stains cytoplasm and extracellular matrix pink. |
| Hounsfield Unit (HU) | Quantitative scale for CT density. Water = 0 HU, air = −1000 HU, dense bone ≈ +1000 HU. Used for windowing and tissue characterisation. |
| Numerical Aperture (NA) | Measure of the light-gathering ability of a microscope objective. Higher NA = better resolution and brighter image. NA = n × sin(θ). |
| Phantom | A physical or virtual model that simulates human anatomy and tissue properties for imaging system testing and calibration. |
| T1/T2 Relaxation | MRI tissue contrast mechanisms. T1 (spin-lattice) measures longitudinal recovery; T2 (spin-spin) measures transverse decay. Different tissues have characteristic T1/T2 values. |
| Field of View (FOV) | The area of the specimen visible through the microscope at a given magnification. FOV = eyepiece field number ÷ objective magnification. |