PupilMetrics is a mobile Flutter application that implements Professor Bryan K. Marcia, Ph.D. clinical pupillary research protocols.

The goal is to recreate and improve the functionality of the legacy Bexel Irina and Russian Iridodiagnostic software in a modern mobile platform for pupil analysis and research/educational/clinical purposes.

Core Algorithm Components

  1. Iris Detection
  • Uses grayscale image processing to locate the iris boundary
  • Employs a circle-scoring algorithm that searches for the strongest edge gradient
  • Two-pass detection: coarse search followed by fine refinement
  • Returns center coordinates, radius, and confidence score
  1. Pupil Detection
  • Searches within the inner portion of the detected iris
  • Uses adaptive thresholding based on the darkest 30% of pixels
  • Fits an ellipse to the dark region using covariance matrix eigenvalue decomposition
  • Extracts boundary points by ray-casting from center outward
  • Returns center, major/minor axes, orientation angle, and boundary points
  1. Pupil Boundary Analysis
  • Analyzes 72 boundary points (every 5 degrees) around the pupil edge
  • Calculates deviation from the average radius at each clock position
  • Groups deviations by clock hour (12 zones)
  • Identifies flattenings (inward deviations) and protrusions (outward deviations)
  1. ANW (Autonomic Nerve Wreath) Detection
  • Searches for gradient changes between pupil edge and mid-iris
  • Identifies the collarette boundary
  • Calculates ANW ratio relative to iris diameter

Key Measurements Produced

Parameter Description Normal Range
P/I Ratio Pupil diameter as % of iris diameter 20-30%
Ellipseness Minor/major axis ratio >95% normal
Circularity How circular the pupil boundary is >95% normal
Decentralization Pupil center offset from iris center <5% normal
Deformation Maximum boundary deviation <5% normal
ANW Ratio Autonomic nerve wreath position 25-35% normal
     

 Clinical Interpretation Features

Pupil Form Types (PupilMetrics Neuro)

  • Circle – Normal
  • Oval-Vertical – Circulatory cerebral disturbances with danger of hemorrhage
  • Oval-Horizontal – Depressive states, atherosclerosis, asthma predisposition
  • Oval-Diagonal – Urogenital system disturbances
  • Left Oblique Ellipse – Urogenital weakness, possible left side paralysis
  • Unilateral Ellipse – Nervous asthma, bronchus difficulties
  • Ventral Diverging Ellipse – Leg motility issues, nervous system disturbances
  • Frontal Diverging Ellipse – Brain insult risk, anxiety, muscle spasms

Decentration Patterns

  • Frontal – Mental/cerebral issues
  • Basal – Leg motility, nervous system
  • Nasal – Lung pathology (right eye) / Cardiac issues (left eye)
  • Temporal – Nephritis, orchitis, salpingitis
  • Middle-Nasal – Oxygen deficiency, cardiospastic risk
  • Upper-Nasal – Mental disorders, spinal irritation
  • And 8 more directional patterns…

Zone-Specific Organ Associations

Each of the 8 pupil zones has specific organ associations for:

  • Flattenings – Indicating hypofunction/weakness
  • Protrusions – Indicating hyperfunction/irritation

Associations differ between right eye (OD) and left eye (OS) per CNRI protocols.

Application Features

Analysis Screen

  • Real-time eye validation before analysis
  • Progress indicator during processing
  • Displays all measurements with color-coded status
  • Shows organ associations for detected anomalies
  • Full descriptions for Pupil Form and Decentration Patterns

  Reports Generated

  1. On-Screen Results – Interactive cards with expandable details
  2. TXT Report – Plain text with Bexel-style diagnosis section
  3. JSON Report – Structured data for integration/archival
  4. PDF Report – Professional formatted document with images

Additional Features

  • Anisocoria detection with TBI (Traumatic Brain Injury) indicator (Neuro-Version)
  • Age-based pupil size assessment
  • Bilateral comparison between eyes
  • Scan history with database storage
  • PLR (Pupillary Light Reflex) analysis

All Metrics Now Displayed (Research Version):

Metric Description

P/I Ratio          Pupil/Iris ratio with status (Normal/Miosis/Mydriasis)

Ellipseness      With status (Normal/Elliptical)

Circularity      With status (Regular/Irregular)

Decentration   With status (Normal/Offset)

Deformation   Pupil border deformation %

Confidence     Detection confidence with label

ANW Ratio     If detected

Pupil Form      Circle/Oval/Chord/Irregular

Deformation Angle     In degrees with zone

Zone Info Box Zone name + organ association

Flattenings      Each zone with %, severity color, organ

Protrusions      Each zone with %, severity color, organ

On the camera mode selector screen, tap the small graphic icon button in the top-right corner to import eye images. You can import both eyes at the same time. Important: Do not capture eyes from a computer screen! Always use live eyes or imported eye images only. Capturing from screens introduces noise, confuses the detection algorithm, and can lead to inconsistent results.

PLR Analysis

PLR (Pupillary Light Reflex) video scan PLR analysis reveals autonomic nervous system imbalances (parasympathetic/sympathetic), aiding in detecting neurodegenerative diseases (e.g., Parkinson’s), concussion/mild TBI, fatigue, or effects of substances (e.g., alcohol, opioids). It also serves as a biomarker for conditions like multiple sclerosis or diabetic retinopathy. Video still-frames can also be downloaded to users gallery for importing into static pupil analysis.

PLR Metrics Applied

| Metric | Description | Normal Range |

|——–|————-|————–|

| **Baseline Diameter** | Resting pupil size before stimulus | 3-5mm |

| **Latency** | Time from light onset to constriction start | 180-300ms |

| **Constriction Velocity** | Rate of pupil constriction | 3-5 mm/sec |

| **Max Constriction %** | Percentage reduction from baseline | 30-50% |

| **Minimum Diameter** | Smallest pupil size achieved | – |

| **Time to Minimum** | Duration to reach max constriction | 0.5-1.0 sec |

| **Dilation Velocity** | Rate of return to baseline | 1-2 mm/sec |

| **75% Recovery Time** | Time to recover 75% of baseline | 2-5 sec |

| **PIPR (Post-Illumination)** | Sustained constriction after light off | Melanopsin indicator |

Download Android Version: