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

  1. Instrument Selection — Choose from 69 instruments across 19 manufacturers
  2. Specimen / Phantom Selection — Pick from 18 specimen types or 28 anatomical phantoms
  3. Parameter Configuration — Set magnification, illumination, stain, modality-specific controls
  4. Physics Rendering — Engine applies optical/imaging physics to generate the simulated view
  5. Image Delivery — Base64-encoded PNG returned via REST API to the web viewer

Module Map

ModulePathPurpose
InstrumentRegistrymicro/instruments/registry.pyLoads and indexes all instrument JSON files from data/instruments/
SpecimenRegistrymicro/specimens/registry.pyManages specimen type definitions with stains and characteristics
PhantomRegistrymicro/phantoms/registry.pyAnatomical phantoms for medical imaging simulation
MicroscopeSimulatormicro/instruments/microscope.pyBrightfield, darkfield, phase contrast, fluorescence rendering
ImagingSimulatormicro/instruments/imaging.pyCT, MRI, Ultrasound, X-ray, Mammography, PET rendering
ImageLibrarymicro/images/library.pyAI-generated image lookup with procedural fallback
Flask Servermicro/web/server.pyWeb 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

CategoryCountDescription
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

ModeTechniqueBest For
BrightfieldTransmitted light, absorption-based contrastStained tissue sections, blood smears
DarkfieldOblique illumination, scattered lightUnstained specimens, crystals, live cells
Phase ContrastPhase shifts converted to amplitude differencesTransparent/live specimens
FluorescenceExcitation/emission wavelength filteringImmunofluorescence, 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

ModalityPhysics ModelKey Parameters
CTX-ray attenuation (Hounsfield units), beam hardeningkVp, mA, slice thickness, window/level
MRIProton density, T1/T2 relaxation, field strength effectsSequence (T1W, T2W, FLAIR), TR/TE, field strength
UltrasoundAcoustic impedance, speckle noise, depth attenuationFrequency, depth, gain, TGC
X-rayRadiographic absorption, scatter, noisekVp, mAs, SID, grid
MammographySoft tissue contrast, compression, doseTarget/filter, kVp, compression
PETFDG uptake distribution, scatter, attenuation correctionTracer, 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

StainApplicationKey Features
H&EGeneral histologyNuclei blue-purple, cytoplasm pink
GramBacteriologyGram+ purple, Gram− pink
GiemsaHematology, parasitologyWBC differential, malaria parasites
WrightBlood filmsRomanowsky-type polychromatic stain
PASGlycogen, mucinsMagenta for polysaccharides
SilverReticulin, nerve fibersBlack deposits on target structures
TrichromeConnective tissueCollagen blue/green, muscle red
DAPIFluorescence microscopyBlue 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)

RoutePageDescription
/homeHomeLanding page with KPI overview and quick navigation
/dashboardDashboardPlatform dashboard with statistics and recent activity
/instrumentsInstrumentsFilterable grid of all instruments with category/manufacturer filters
/instruments/<mfr>/<model>Instrument DetailFull specification sheet for a single instrument
/specimensSpecimensSpecimen library browser with category filtering
/specimens/<id>Specimen DetailSpecimen image library with upload, AI generation, filters
/specimens/imagesSpecimen ImagesBrowse all specimen images across all types
/phantomsPhantomsAnatomical phantom library browser
/phantoms/<id>Phantom DetailPhantom image library with modality filtering
/viewer/microscopeMicroscope ViewerInteractive microscopy simulator with image library sidebar
/viewer/imagingImaging ViewerMedical imaging simulator with modality-specific controls
/viewer/3d3D ViewerThree.js interactive 3D model viewer
/viewer/dicomDICOM ViewerDICOM study viewer with cine playback and region zoom
/dicomDICOM StudiesDICOM study browser with study cards
/threed3D Models3D model library browser
/threed/<model_id>3D Model Detail3D model detail with file management
/trainingTrainingTraining module listing with progress tracking
/training/notesTraining NotesNote-taking system for training modules
/training/<module>Training ModuleModule detail with lesson list
/training/<module>/<lesson>LessonIndividual lesson content with navigation
/projectsProjectsProject tracking page
/securitySecuritySecurity overview page
/backlogBacklogFeature request backlog with expandable detail rows
/documentationDocumentationThis page — system reference
/documents/designDesign DocumentSystem design documentation
/documents/integrationIntegration DocumentREST API specification and integration guide
/documents/architectureArchitecture DocumentDeployment topology, tech stack, security architecture
/buildsBuildsBuild history with release changelogs
/test-reportTest ReportAutomated test results
/usersUsersUser management admin panel
/bugsBugsBug tracker

REST API (25 Endpoints)

EndpointMethodDescription
/api/instrumentsGETList all instruments (filterable by category, manufacturer)
/api/searchGETSearch instruments by query string
/api/statsGETPlatform statistics (counts, categories)
/api/specimensGETList all specimen types
/api/specimensPOSTCreate new specimen type
/api/specimens/<id>PUTUpdate specimen metadata
/api/specimen-imagesGETList all specimen images
/api/specimen-images/uploadPOSTUpload specimen image with metadata
/api/specimen-images/ai-generatePOSTGenerate specimen image via OpenAI
/api/specimen-images/<id>PUTUpdate specimen image metadata
/api/specimen-images/<id>DELETEDelete a specimen image
/api/phantomsGETList all anatomical phantoms
/api/phantom-images/uploadPOSTUpload phantom image with metadata
/api/phantom-images/ai-generatePOSTGenerate phantom image via AI
/api/phantom-images/<id>PUTUpdate phantom image metadata
/api/phantom-images/<id>DELETEDelete a phantom image
/api/threedGETList all 3D models
/api/threed-files/uploadPOSTUpload 3D model file
/api/threed-files/<id>PUTUpdate 3D model file metadata
/api/threed-files/<id>DELETEDelete a 3D model file
/api/dicom/<study_id>PUTUpdate DICOM study metadata
/api/dicom/<study_id>DELETEDelete a DICOM study
/api/render/microscopePOSTRender a microscopy image (JSON body)
/api/render/imagingPOSTRender a medical image (JSON body)
/api/chatPOSTAI 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

  1. Prompt Catalog — 51 curated prompts (22 microscopy, 29 imaging) in data/image_prompts/catalog.json
  2. Image Generatorgenerate_images.py sends prompts to OpenAI API (gpt-image-1 or dall-e-3)
  3. Image Librarymicro/images/library.py indexes generated images by specimen+stain or phantom+modality
  4. 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 prompts
  • python generate_images.py --dry-run — Preview without generating
  • python generate_images.py --scope microscopy — Generate only microscopy images
  • python 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

ModuleCategoryDifficultyLessonsDuration
Getting Started with MICROPlatformBeginner855 min
Introduction to MicroscopyFundamentalsBeginner745 min
Specimen PreparationLab TechniquesBeginner860 min
Electron MicroscopyAdvanced ImagingIntermediate790 min
Medical Imaging ProtocolsClinical ImagingIntermediate775 min
X-Ray Microscopy & Micro-CTAdvanced TechniquesIntermediate660 min
Digital PathologyDiagnosticsIntermediate550 min
Dental RadiographyClinical ImagingBeginner655 min
Laboratory Safety ProtocolsSafetyBeginner540 min
Dental Anatomy & Imaging InterpretationClinical ImagingBeginner550 min
CT Scanning: Technology & ApplicationsDevice TrainingIntermediate7120 min
MRI: Physics, Sequences & ApplicationsDevice TrainingAdvanced7150 min
Ultrasound: Physics & ApplicationsDevice TrainingIntermediate6110 min
X-Ray & Fluoroscopy: DiagnosticsDevice TrainingBeginner590 min
Nuclear Medicine: PET, SPECT & RadionuclideDevice TrainingAdvanced4100 min
Mammography: Technology & Breast ImagingDevice TrainingIntermediate480 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

ComponentDetails
ModelOpenAI GPT-4o-mini
EndpointPOST /api/chat
Max Tokens1,024 per response
Context WindowLast 20 messages maintained
System PromptScoped 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

SourceBadgeMethod
Downloaded GreenCurated images from Wikimedia Commons and other open sources
AI Generated PurpleGenerated via OpenAI gpt-image-1 with detailed microscopy prompts
Uploaded GrayUser-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

  • Metadatadata/specimens/images/<specimen_id>.json and data/phantoms/images/<phantom_id>.json
  • Image Filesdata/generated_images/microscopy/ and data/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
TermDefinition
BrightfieldStandard light microscopy technique where specimen is illuminated from below and observed in transmitted light. Contrast comes from absorption by stained structures.
DarkfieldIllumination technique using oblique light so only scattered light from the specimen reaches the objective. Background appears dark, structures appear bright.
Phase ContrastOptical technique that converts phase shifts (from differences in refractive index) into amplitude differences visible to the eye. Ideal for unstained, transparent specimens.
FluorescenceMicroscopy using specific excitation wavelengths to cause fluorescent molecules (fluorophores) in the specimen to emit light at longer wavelengths.
H&E StainHematoxylin 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(θ).
PhantomA physical or virtual model that simulates human anatomy and tissue properties for imaging system testing and calibration.
T1/T2 RelaxationMRI 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.