Make a ppt with good number of slides for ent pgs

Reading File
Reading File
Reading File
Running Command

cd /home/daytona/workspace/attachments/1d006435-4e94-4042-9d92-b4f4dfe6ab1e && p…

Running Command

cd /home/daytona/workspace/attachments/1d006435-4e94-4042-9d92-b4f4dfe6ab1e && p…

Running Command

cd /home/daytona/workspace/attachments/1d006435-4e94-4042-9d92-b4f4dfe6ab1e && p…

Reading File
Running Command

python3 -c " import pytesseract from pdf2image import convert_from_path import s…

Running Command

python3 -c " import pytesseract from pdf2image import convert_from_path pdf_pat…

Running Command

mkdir -p /home/daytona/workspace/vestibular-physiology-ppt

Writing File

~/vestibular-physiology-ppt/create_ppt.js

const pptxgen = require("pptxgenjs");

const pres = new pptxgen();
pres.layout = "LAYOUT_WIDE"; // 13.3" x 7.5"
pres.title = "Principles of Applied Vestibular Physiology";
pres.author = "ENT Postgraduate Teaching";

// ─────────────────────────────────────────
// THEME COLORS  (deep navy + teal + amber)
// ─────────────────────────────────────────
const C = {
  navy:    "0A1628",
  teal:    "0D7377",
  tealLt:  "14A7AD",
  amber:   "F4A020",
  white:   "FFFFFF",
  offWhite:"F0F4F8",
  silver:  "CBD5E0",
  darkBg:  "0D1B2A",
  midGray: "718096",
  lightTeal: "E6F7F8",
};

// ─────────────────────────────────────────
// HELPER: add a section-header slide
// ─────────────────────────────────────────
function sectionSlide(title, subtitle) {
  const s = pres.addSlide();
  s.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 13.3, h: 7.5, fill: { color: C.navy } });
  s.addShape(pres.ShapeType.rect, { x: 0, y: 3.2, w: 13.3, h: 0.06, fill: { color: C.amber } });
  s.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 0.18, h: 7.5, fill: { color: C.teal } });

  s.addText(title, {
    x: 0.5, y: 2.4, w: 12.3, h: 1.2,
    fontSize: 40, bold: true, color: C.white, align: "center", fontFace: "Calibri"
  });
  if (subtitle) {
    s.addText(subtitle, {
      x: 0.5, y: 3.7, w: 12.3, h: 0.8,
      fontSize: 20, color: C.tealLt, align: "center", italic: true, fontFace: "Calibri"
    });
  }
  return s;
}

// ─────────────────────────────────────────
// HELPER: content slide (title bar + body)
// ─────────────────────────────────────────
function contentSlide(title, bullets, opts = {}) {
  const s = pres.addSlide();
  // Background
  s.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 13.3, h: 7.5, fill: { color: C.offWhite } });
  // Top bar
  s.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 13.3, h: 1.05, fill: { color: C.navy } });
  // Accent stripe
  s.addShape(pres.ShapeType.rect, { x: 0, y: 1.05, w: 13.3, h: 0.07, fill: { color: C.amber } });
  // Left accent
  s.addShape(pres.ShapeType.rect, { x: 0, y: 1.12, w: 0.1, h: 6.38, fill: { color: C.teal } });

  // Slide title
  s.addText(title, {
    x: 0.3, y: 0.08, w: 12.7, h: 0.9,
    fontSize: 26, bold: true, color: C.white, fontFace: "Calibri", valign: "middle"
  });

  // Body bullets
  const bodyX = opts.twoCol ? 0.3 : 0.3;
  const bodyW = opts.twoCol ? 6.2 : 12.7;
  const bodyY = 1.35;
  const bodyH = 5.8;

  const textArr = bullets.map((b, i) => {
    if (b.startsWith("##")) {
      return {
        text: b.replace("##", "").trim(),
        options: {
          bullet: false, bold: true, fontSize: 16, color: C.teal,
          breakLine: i < bullets.length - 1
        }
      };
    }
    if (b.startsWith("  -")) {
      return {
        text: b.replace("  -", "").trim(),
        options: {
          bullet: { type: "number", style: "arabicPeriod", indent: 30 },
          fontSize: 14, color: "2D3748", indentLevel: 1,
          breakLine: i < bullets.length - 1
        }
      };
    }
    return {
      text: b.replace(/^- /, "").trim(),
      options: {
        bullet: { type: "bullet", characterCode: "25CF", indent: 15 },
        fontSize: 15, color: "1A202C",
        breakLine: i < bullets.length - 1
      }
    };
  });

  s.addText(textArr, {
    x: bodyX, y: bodyY, w: bodyW, h: bodyH,
    fontFace: "Calibri", valign: "top", paraSpaceBefore: 4
  });

  // Optional right column
  if (opts.rightBullets) {
    const right = opts.rightBullets.map((b, i) => {
      if (b.startsWith("##")) {
        return { text: b.replace("##","").trim(), options: { bullet:false, bold:true, fontSize:16, color: C.teal, breakLine: i < opts.rightBullets.length-1 }};
      }
      return { text: b.replace(/^- /,"").trim(), options: { bullet:{type:"bullet",characterCode:"25CF",indent:15}, fontSize:15, color:"1A202C", breakLine: i < opts.rightBullets.length-1 }};
    });
    s.addShape(pres.ShapeType.rect, { x: 6.75, y: 1.12, w: 0.04, h: 6.38, fill: { color: C.silver } });
    s.addText(right, { x: 6.9, y: bodyY, w: 6.1, h: bodyH, fontFace:"Calibri", valign:"top", paraSpaceBefore:4 });
  }

  // Page number
  s.addText("Cummings ORL Ch.165", {
    x: 9.5, y: 7.1, w: 3.6, h: 0.35,
    fontSize: 9, color: C.midGray, align: "right", fontFace: "Calibri", italic: true
  });

  return s;
}

// ─────────────────────────────────────────
// HELPER: box-highlight slide (key points in colored boxes)
// ─────────────────────────────────────────
function keyPointsSlide(title, points) {
  const s = pres.addSlide();
  s.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 13.3, h: 7.5, fill: { color: C.darkBg } });
  s.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 13.3, h: 0.07, fill: { color: C.amber } });

  s.addText(title, {
    x: 0.4, y: 0.18, w: 12.5, h: 0.75,
    fontSize: 28, bold: true, color: C.white, fontFace: "Calibri"
  });

  const boxColors = [C.teal, "1B5E8B", "7B3FA0", "C0392B", "1E7D4A", "E67E22", "1B5E8B"];
  const cols = 3;
  const boxW = 3.9;
  const boxH = 1.5;
  const gapX = 0.25;
  const gapY = 0.22;
  const startX = 0.3;
  const startY = 1.15;

  points.forEach((pt, i) => {
    const col = i % cols;
    const row = Math.floor(i / cols);
    const x = startX + col * (boxW + gapX);
    const y = startY + row * (boxH + gapY);
    const color = boxColors[i % boxColors.length];

    s.addShape(pres.ShapeType.roundRect, {
      x, y, w: boxW, h: boxH,
      fill: { color },
      line: { color: C.white, width: 0.5 },
      rectRadius: 0.12
    });

    const num = String(i + 1).padStart(2, "0");
    s.addText(num, {
      x: x + 0.12, y: y + 0.1, w: 0.5, h: 0.4,
      fontSize: 14, bold: true, color: "FFFFFF99", fontFace: "Calibri"
    });
    s.addText(pt, {
      x: x + 0.15, y: y + 0.4, w: boxW - 0.3, h: boxH - 0.5,
      fontSize: 13, color: C.white, fontFace: "Calibri", valign: "top", wrap: true
    });
  });

  s.addText("Cummings ORL Ch.165", {
    x: 9.5, y: 7.15, w: 3.6, h: 0.3,
    fontSize: 9, color: C.midGray, align: "right", fontFace: "Calibri", italic: true
  });
  return s;
}

// ─────────────────────────────────────────
// HELPER: table slide
// ─────────────────────────────────────────
function tableSlide(title, headers, rows) {
  const s = pres.addSlide();
  s.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 13.3, h: 7.5, fill: { color: C.offWhite } });
  s.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 13.3, h: 1.05, fill: { color: C.navy } });
  s.addShape(pres.ShapeType.rect, { x: 0, y: 1.05, w: 13.3, h: 0.07, fill: { color: C.amber } });

  s.addText(title, {
    x: 0.3, y: 0.08, w: 12.7, h: 0.9,
    fontSize: 26, bold: true, color: C.white, fontFace: "Calibri", valign: "middle"
  });

  const tableData = [
    headers.map(h => ({ text: h, options: { bold: true, color: C.white, fill: C.teal, fontSize: 14, align: "center" } })),
    ...rows.map(row => row.map(cell => ({ text: cell, options: { fontSize: 13, color: "1A202C", fill: C.white } })))
  ];

  s.addTable(tableData, {
    x: 0.3, y: 1.25, w: 12.7,
    border: { pt: 0.5, color: C.silver },
    rowH: 0.55,
    fontFace: "Calibri"
  });

  s.addText("Cummings ORL Ch.165", {
    x: 9.5, y: 7.1, w: 3.6, h: 0.35,
    fontSize: 9, color: C.midGray, align: "right", fontFace: "Calibri", italic: true
  });
  return s;
}

// ═══════════════════════════════════════════════════════════════════
// SLIDE 1 — TITLE
// ═══════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  s.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 13.3, h: 7.5, fill: { color: C.navy } });
  // decorative teal band
  s.addShape(pres.ShapeType.rect, { x: 0, y: 5.3, w: 13.3, h: 2.2, fill: { color: C.teal } });
  s.addShape(pres.ShapeType.rect, { x: 0, y: 5.2, w: 13.3, h: 0.15, fill: { color: C.amber } });
  // circle accent
  s.addShape(pres.ShapeType.ellipse, { x: 9.5, y: -1.0, w: 5.5, h: 5.5, fill: { color: "122244" }, line: { color: C.tealLt, width: 2 } });

  s.addText("PRINCIPLES OF APPLIED", {
    x: 0.6, y: 1.1, w: 10, h: 0.7,
    fontSize: 22, color: C.tealLt, fontFace: "Calibri", charSpacing: 5
  });
  s.addText("VESTIBULAR PHYSIOLOGY", {
    x: 0.6, y: 1.7, w: 11, h: 1.6,
    fontSize: 52, bold: true, color: C.white, fontFace: "Calibri"
  });
  s.addText("Chapter 165 | Cummings Otolaryngology, 7th Edition", {
    x: 0.6, y: 3.4, w: 10, h: 0.5,
    fontSize: 16, color: C.silver, fontFace: "Calibri", italic: true
  });
  s.addText("For ENT Postgraduate Teaching", {
    x: 0.6, y: 5.6, w: 9, h: 0.5,
    fontSize: 17, bold: true, color: C.white, fontFace: "Calibri"
  });
  s.addText("Authors: John P. Carey | Charles C. Della Santina", {
    x: 0.6, y: 6.2, w: 9, h: 0.4,
    fontSize: 13, color: C.offWhite, fontFace: "Calibri"
  });
}

// ═══════════════════════════════════════════════════════════════════
// SLIDE 2 — KEY POINTS (overview)
// ═══════════════════════════════════════════════════════════════════
keyPointsSlide("Key Points at a Glance", [
  "Vestibular system drives reflexes to maintain stable vision and posture",
  "Semicircular canals encode head rotation via baseline firing modulation",
  "Otolith organs encode linear acceleration and static tilt",
  "Canal stimulation produces eye movements in the plane of that canal",
  "High-acceleration excitatory rotation > same in inhibitory direction",
  "Brainstem velocity storage extends low-frequency VOR performance",
  "Utricle senses tilt & translation; loss mimics tilt to opposite side",
  "Sudden saccular changes evoke postural tone alterations",
  "Vestibular adaptation may be slow and susceptible to decompensation"
]);

// ═══════════════════════════════════════════════════════════════════
// SLIDE 3 — OVERVIEW / CHAPTER OUTLINE
// ═══════════════════════════════════════════════════════════════════
contentSlide("Chapter Overview", [
  "## Part of: Section 7 – Vestibular Disorders, Cummings ORL 7th Ed",
  "- Provides clinical understanding of vestibular anatomy, physiology & reflexes",
  "- Foundation for evaluating & managing vestibular disorders in practice",
  "- 12 principles systematically explained with clinical correlates",
  "",
  "## Topics Covered",
  "- Vestibular end organs: anatomy & transduction",
  "- Semicircular canal mechanics & otolith organ physiology",
  "- Vestibuloocular reflex (VOR): anatomy, circuitry & clinical tests",
  "- Otolith reflexes & saccular physiology (VEMP)",
  "- Velocity storage, neural integration & central processing",
  "- Vestibular adaptation & compensation"
]);

// ═══════════════════════════════════════════════════════════════════
// SLIDE 4 — ANATOMY OF VESTIBULAR END ORGANS
// ═══════════════════════════════════════════════════════════════════
sectionSlide("ANATOMY", "Vestibular End Organs & Peripheral Architecture");

contentSlide("Vestibular End Organs – Anatomy", [
  "## Five End Organs in Each Inner Ear",
  "- Three semicircular canals: Superior (anterior), Posterior, Lateral (horizontal)",
  "- Two otolith organs: Utricle & Saccule",
  "",
  "## Key Anatomical Structures",
  "- Crista ampullaris: sensory epithelium within the ampulla of each SCC",
  "- Cupula: gelatinous membrane spanning the ampulla lumen",
  "- Macula: sensory epithelium of utricle & saccule",
  "- Otoconial membrane: dense crystalline layer overlying the macula",
  "",
  "## Innervation",
  "- Superior vestibular nerve: superior ampullary + lateral ampullary + utricular branches",
  "- Inferior vestibular nerve: posterior ampullary + saccular branches",
  "- Cell bodies in Scarpa's ganglion → CN VIII → brainstem vestibular nuclei"
]);

// ═══════════════════════════════════════════════════════════════════
// SLIDE 6 — HAIR CELL TRANSDUCTION
// ═══════════════════════════════════════════════════════════════════
contentSlide("Hair Cell Sensory Transduction", [
  "## Mechanoelectrical Transduction Process",
  "- Hair cells bear stereocilia arranged in rows of increasing height",
  "- Kinocilium: tallest; defines the 'on' direction of deflection",
  "- Tip links: mechanically gate cationic channels in stereocilia membranes",
  "",
  "## Sequence of Events",
  "- (A) Baseline glutamate release at rest → tonic afferent firing",
  "- (B) Deflection toward kinocilium → depolarization (K⁺ influx)",
  "- (C) Tip links stretch open cationic channels → K⁺ enters hair cell",
  "- (D) ↑ Membrane potential activates voltage-sensitive Ca²⁺ channels",
  "- (E) ↑ Glutamate release → ↑ afferent firing rate",
  "",
  "## Inhibitory Direction",
  "- Deflection away from kinocilium → hyperpolarization → ↓ glutamate → ↓ firing rate",
  "- This bidirectional modulation about a baseline enables encoding of both directions"
]);

// ═══════════════════════════════════════════════════════════════════
// SLIDE 7 — SEMICIRCULAR CANAL MECHANICS
// ═══════════════════════════════════════════════════════════════════
sectionSlide("SEMICIRCULAR CANALS", "Mechanics, Canal Planes & Encoding of Rotation");

contentSlide("Semicircular Canal – Torsional Pendulum Model", [
  "## Physical Concept",
  "- Each SCC acts as a fluid-filled torsional pendulum",
  "- Head rotation → endolymph lags behind due to inertia",
  "- Relative endolymph flow deflects the elastic cupula",
  "",
  "## Equation of Motion: K·θ + B·θ̇ + I·θ̈ = I·Ḧ",
  "  - K = elastic restoring force (cupular stiffness)",
  "  - B = viscous drag coefficient",
  "  - I = moment of inertia of endolymph + cupula",
  "  - H = head angular position",
  "",
  "## Operating Range",
  "- For natural head movements (0.1–15 Hz): viscous term dominates → B·θ̇ ≈ I·Ḧ",
  "- Cupular deflection ∝ head velocity (not acceleration) in this range",
  "- Canal acts as angular velocity transducer over physiologic frequencies",
  "",
  "## Time Constant",
  "- Calculated mechanical TC (~5 s) extended to ~20 s by brainstem velocity storage"
]);

// ═══════════════════════════════════════════════════════════════════
// SLIDE 9 — CANAL PLANES & ORIENTATION
// ═══════════════════════════════════════════════════════════════════
contentSlide("Canal Planes & Orientation (Principle 3)", [
  "## Horizontal (Lateral) Canal",
  "- Tilted ~20° upward at its anterior end from true horizontal",
  "- Co-planar pair: Left HC ↔ Right HC (push-pull pair)",
  "",
  "## Vertical Canals",
  "- Oriented ~45° from the midsagittal plane",
  "- Right Anterior Canal (AC) co-planar with Left Posterior Canal (PC) → RALP plane",
  "- Left Anterior Canal co-planar with Right Posterior Canal → LARP plane",
  "",
  "## Clinical Significance",
  "- Canal planes define the coordinate system for VOR output",
  "- Minimises brainstem computation needed to compensate head movement",
  "- VOR latency = ~7 ms (only 3 synapses) — critical for gaze stabilisation",
  "- BPPV canal identification relies on understanding canal plane orientations",
  "",
  "## LARP Plane & Extraocular Muscles",
  "- Left AC–Right PC plane aligns with Left SR/IR and Right SO/IO muscles",
  "- Evolutionary adaptation: extraocular muscles evolved to pull in canal planes"
]);

// ═══════════════════════════════════════════════════════════════════
// SLIDE 10 — PRINCIPLE 4: EXCITATORY DIRECTION
// ═══════════════════════════════════════════════════════════════════
contentSlide("Principle 4: Excitatory Direction of Semicircular Canals", [
  "## Rule",
  "- A SCC is excited by head rotation that brings the forehead toward the IPSILATERAL side",
  "",
  "## Horizontal Canal",
  "- Excited by ipsilateral head turn (e.g., left HC excited by leftward rotation)",
  "- Endolymph flow → ampullopetal (toward ampulla) in horizontal canal = excitatory",
  "",
  "## Vertical Canals",
  "- Superior (anterior) canal: excited by pitching nose down + rolling head toward ipsilateral side",
  "- Posterior canal: excited by rolling head toward ipsilateral side (ear-down position)",
  "",
  "## BPPV Application",
  "- In posterior canal BPPV: Dix-Hallpike aligns PC with gravity",
  "- Canalith falls → ampullopetal endolymph flow → PC excitation",
  "- Excitatory rotation perceived → compensatory nystagmus: upbeat + torsional (toward affected ear)",
  "",
  "## Mnemonic for BPPV Nystagmus Direction",
  "- Nystagmus direction = opposite to the slow phase = toward excited canal plane"
]);

// ═══════════════════════════════════════════════════════════════════
// SLIDE 11 — PRINCIPLE 5: EWALD'S LAWS
// ═══════════════════════════════════════════════════════════════════
contentSlide("Principle 5: Ewald's Laws & Nystagmus Direction", [
  "## Ewald's First Law",
  "- Stimulation of a SCC produces eye movements in the PLANE of that canal",
  "- Quick phases directed toward the excited canal (slow phases opposite)",
  "- Nystagmus from canal dysfunction has a fixed axis & direction w.r.t. head",
  "",
  "## Slow Phases vs Quick Phases",
  "- Slow phases: vestibularly driven, compensatory (diagnostically important)",
  "- Quick phases: resetting saccades (describe nystagmus direction by convention)",
  "- Focus on SLOW PHASE to minimise mental inversions when localising pathology",
  "",
  "## Canal–Eye Movement Mapping",
  "- Left HC excitation → rightward slow phase (horizontal nystagmus)",
  "- Left anterior canal excitation → upward + clockwise slow phase",
  "- Left posterior canal excitation → downward + clockwise slow phase",
  "",
  "## Clinical Pearl: Superior Canal Dehiscence Syndrome",
  "- Pressure/sound stimulates superior canal via third window",
  "- Eye movement in the plane of the superior canal = diagnostic clue"
]);

// ═══════════════════════════════════════════════════════════════════
// SLIDE 12 — VESTIBULO-OCULAR REFLEX
// ═══════════════════════════════════════════════════════════════════
sectionSlide("VESTIBULOOCULAR REFLEX (VOR)", "Neural Circuitry, Testing & Clinical Significance");

contentSlide("VOR – Neural Circuitry (Three-Neuron Arc)", [
  "## First-Order Neurons",
  "- Vestibular hair cells → type I & II hair cells in crista → CN VIII afferents",
  "- Scarpa's ganglion → superior/inferior vestibular nerve",
  "",
  "## Second-Order Neurons (Vestibular Nuclei)",
  "- Medial & Superior vestibular nuclei receive canal afferents",
  "- Cross midline to contralateral abducens nucleus (VI) & ipsilateral oculomotor (III)",
  "",
  "## Three-Neuron Arc for Horizontal VOR",
  "- Left HC excited → Left vestibular nucleus → Right VI (lateral rectus) + Left III (medial rectus)",
  "- Simultaneously inhibits left VI (ipsilateral LR) + right III (contralateral MR) — reciprocal",
  "- Eyes move rightward as head turns left: gaze stabilisation achieved",
  "",
  "## Key Features",
  "- Only 3 synapses → latency ≈ 7 ms (fastest reflexive eye movement)",
  "- Gain = eye velocity / head velocity ≈ 1 in normal subjects",
  "- Cerebellum fine-tunes gain; failure → oscillopsia, imbalance"
]);

// ═══════════════════════════════════════════════════════════════════
// SLIDE 14 — VOR GAIN, HEAD THRUST TEST
// ═══════════════════════════════════════════════════════════════════
contentSlide("Head Thrust Test (HTT) – Principle 6 & Clinical Tool", [
  "## Principle 6: Ewald's Second Law",
  "- High-acceleration excitatory rotation → GREATER response than same inhibitory rotation",
  "- Baseline firing rate can be reduced to zero (floor effect) in inhibitory direction",
  "- Excitatory direction: firing rate can increase many-fold above baseline",
  "",
  "## Head Impulse/Thrust Test (HIT/HTT) – Halmagyi-Curthoys",
  "- Examiner rapidly rotates head ~10–15° at acceleration ≥ 3000°/s²",
  "- Peak velocity: 150–300°/s; completed in ~10 ms",
  "- Patient fixes gaze on examiner's nose",
  "",
  "## Interpretation",
  "- NORMAL: eyes remain on target throughout — VOR gain ≈ 1",
  "- ABNORMAL (positive): eyes deviate with head; CATCH-UP SACCADE after head stops",
  "- Positive HTT = hypofunction of the ipsilateral canal being tested",
  "",
  "## Sensitivity",
  "- Tests high-frequency range (3–5 Hz) — complements caloric (0.004 Hz)",
  "- Can identify which of the 6 canals is affected with 3D head thrusts"
]);

// ═══════════════════════════════════════════════════════════════════
// SLIDE 15 — CALORIC TEST
// ═══════════════════════════════════════════════════════════════════
contentSlide("Caloric Testing (Principle 5 Application)", [
  "## Principle",
  "- Thermal stimulus creates a convection current in the horizontal SCC",
  "- Warm water/air (44°C): endolymph convects toward ampulla → excitation",
  "- Cool water/air (30°C): endolymph convects away → inhibition",
  "",
  "## COWS Mnemonic",
  "- Cold Opposite, Warm Same (direction of quick phases of nystagmus)",
  "- Warm irrigation → nystagmus fast phase toward SAME side",
  "- Cool irrigation → nystagmus fast phase toward OPPOSITE side",
  "",
  "## Equivalent Stimulus",
  "- ~5–10°/s² sustained horizontal rotation at ~50–100°/s → 0.004 Hz",
  "- Well below physiologic operating range of SCC",
  "",
  "## Advantages",
  "- Only test that truly isolates one labyrinth at a time",
  "- Identifies unilateral canal paresis",
  "",
  "## Limitations",
  "- Tests only horizontal SCC; no information about vertical canals or otoliths",
  "- Affected by canal patency, middle ear status, patient cooperation"
]);

// ═══════════════════════════════════════════════════════════════════
// SLIDE 16 — PRINCIPLE 7: LINEAR SUPERPOSITION
// ═══════════════════════════════════════════════════════════════════
contentSlide("Principle 7: Linear Superposition of Canal Signals", [
  "## The Principle",
  "- Response to simultaneous canal stimuli ≈ sum of responses to each stimulus alone",
  "- Canal signals are linearly combined to produce a net eye movement",
  "",
  "## Basis",
  "- Cohen, Suzuki et al. (cats) — EMG & cineolculography during ampullary nerve stimulation",
  "- Individual canal stimulation → eye movements in plane of stimulated canal",
  "- Combined stimulation → vector summation of individual responses",
  "",
  "## Vector Representation",
  "- Each canal has a SENSITIVITY AXIS perpendicular to its plane",
  "- Head velocity projected onto each canal's sensitivity axis = driving stimulus",
  "- 3D eye movement = vector sum of all canal contributions",
  "",
  "## Clinical Application",
  "- Axis of observed nystagmus reveals which canal(s) are excited/inhibited",
  "- Pure horizontal nystagmus: horizontal canal pathology",
  "- Horizontal + torsional: unilateral labyrinthine irritation (e.g., early Ménière's, viral labyrinthitis)"
]);

// ═══════════════════════════════════════════════════════════════════
// SLIDE 17 — OTOLITH ORGANS
// ═══════════════════════════════════════════════════════════════════
sectionSlide("OTOLITH ORGANS", "Utricle, Saccule & Linear Acceleration Sensing");

contentSlide("Otolith Organs – Structure & Function", [
  "## Utricle",
  "- Located in the vestibule; macula oriented approximately in the horizontal plane",
  "- Anterior end curves upward; sensitive to nasooccipital & interaural linear acceleration",
  "- Hair cells sense gravity when head tilts: shear force on stereocilia",
  "",
  "## Saccule",
  "- Located in the vestibule; macula oriented approximately in the sagittal plane",
  "- Sensitive to superoinferior & nasooccipital linear acceleration",
  "- VEMP generator (see Principle 11)",
  "",
  "## Otoconial Membrane",
  "- Dense otoconial (calcium carbonate crystite) layer on stiff mesh layer on elastic gel",
  "- Higher density than endolymph → lags behind head during acceleration",
  "- Shear force on hair cells encodes linear acceleration",
  "",
  "## Striola",
  "- Central reversal line on macula",
  "- Utricle: hair cells polarized toward striola",
  "- Saccule: hair cells polarized away from striola",
  "- Creates complex excitation/inhibition patterns for directionality"
]);

// ═══════════════════════════════════════════════════════════════════
// SLIDE 19 — TILT-TRANSLATION AMBIGUITY
// ═══════════════════════════════════════════════════════════════════
contentSlide("Principle 10: Utricular Tilt vs Translation Ambiguity", [
  "## The Problem (Einstein's Equivalence Principle)",
  "- Shear force on utricular hair cells is identical whether caused by:",
  "  - HEAD TILT (gravity component) — expected response: compensatory tilt reflex",
  "  - LINEAR TRANSLATION (inertial force) — expected response: translational VOR",
  "",
  "## Brain's Interpretation",
  "- 3:1 predominance of afferents from the MEDIAL utricle (sensitive to ipsilateral tilt)",
  "- Tonic increase in firing from one utricle → perceived as otoconial mass shifting ipsilaterally",
  "- Unilateral utricular loss → brain perceives tilt toward OPPOSITE (intact) side",
  "",
  "## Clinical Consequence: Ocular Tilt Reaction (OTR)",
  "- Triad: Head tilt + Skew deviation + Ocular torsion (toward lesion side)",
  "- Seen in unilateral utricular deafferentation",
  "- Gradually corrects with vestibular compensation over ~1 week (faster than SCC compensation)",
  "",
  "## Resolution Mechanism",
  "- Semicircular canals sense head rotation and provide context",
  "- Brain integrates canal (rotation) + otolith (total linear force) → resolves ambiguity",
  "- Failure → mal de débarquement, chronic subjective dizziness"
]);

// ═══════════════════════════════════════════════════════════════════
// SLIDE 20 — SACCULE & VEMP (PRINCIPLE 11)
// ═══════════════════════════════════════════════════════════════════
contentSlide("Principle 11: Saccular Activity & Postural Tone (VEMP)", [
  "## Saccule Function",
  "- Primarily oriented in the sagittal plane; sensitive to vertical linear acceleration",
  "- Hair cells excited by downward shear (gravitational component when head upright)",
  "- Reflexive response: changes in flexor/extensor muscle tone",
  "",
  "## Vestibular Evoked Myogenic Potential (VEMP)",
  "- Loud sound activates saccular afferents (air-conducted stimulus via oval window)",
  "- Reflex arc: Saccule → inferior vestibular nerve → lateral vestibular nucleus → descending VST",
  "- Cervical VEMP (cVEMP): averaged EMG from tonically contracted SCM → inhibitory p13-n23 complex",
  "",
  "## Clinical Uses of cVEMP",
  "- Assess inferior vestibular nerve & saccular function",
  "- Elevated threshold or absent response = saccular/inferior nerve pathology",
  "- Very sensitive to conductive hearing loss (CHL) — abolished even with mild CHL",
  "- Threshold lowered in Superior Canal Dehiscence Syndrome (SCD) — pathognomonic",
  "",
  "## Drop Attacks (Tumarkin's Crises) – Ménière's Disease",
  "- Sudden loss of postural tone without LOC",
  "- Proposed mechanism: sudden deformation of hydropic saccular macula",
  "- Reflects acute inappropriate saccular discharge"
]);

// ═══════════════════════════════════════════════════════════════════
// SLIDE 21 — AFFERENT FIBER TYPES
// ═══════════════════════════════════════════════════════════════════
contentSlide("Vestibular Afferent Fiber Types", [
  "## Morphologic Classification",
  "- Calyx fibers: innervate type I hair cells with chalice-shaped terminal; arise from central zone",
  "- Dimorphic fibers: innervate both type I & II hair cells; intermediate zone",
  "- Bouton fibers: innervate type II hair cells only; peripheral zone",
  "",
  "## Physiologic Classification",
  "- Regular afferents: constant interspike interval; from peripheral zone; tonic; encode steady stimuli",
  "- Irregular afferents: variable interspike interval; from central zone; phasic; encode rate of change",
  "",
  "## AHP Model (Smith & Goldberg)",
  "- Regular: deep, slow AHP + small EPSPs → deterministic repolarization → regular firing",
  "- Irregular: shallow, fast AHP + larger EPSPs → stochastic depolarization → irregular firing",
  "",
  "## Clinical Relevance",
  "- Irregular fibers have higher sensitivity to galvanic vestibular stimulation",
  "- Regular fibers better encode sustained stimuli (tonic head position)",
  "- Irregular fibers encode high-frequency, high-acceleration transients (head impulse testing)"
], { twoCol: false });

// ═══════════════════════════════════════════════════════════════════
// SLIDE 22 — VELOCITY STORAGE & NEURAL INTEGRATION
// ═══════════════════════════════════════════════════════════════════
sectionSlide("CENTRAL PROCESSING", "Velocity Storage, Neural Integration & Brainstem Circuitry");

contentSlide("Principle 9: Velocity Storage Mechanism", [
  "## The Problem",
  "- Mechanical TC of cupula ~5 s; VOR measured TC ~20 s in humans",
  "- Brainstem 'velocity storage' extends the effective low-frequency performance of the VOR",
  "- Lower corner frequency extended from ~0.3 Hz to ~0.08 Hz",
  "",
  "## Mechanism (Robinson's Model)",
  "- Positive feedback loop within the medial & descending vestibular nuclei",
  "- Axons cross the midline — lesion studies: medial vestibular nucleus neurons",
  "- Stores head velocity signal beyond the time cupula returns to zero",
  "",
  "## Postrotatory Nystagmus",
  "- After constant velocity rotation stops → afterimage of nystagmus in opposite direction",
  "- Decays with TC ~20 s due to velocity storage discharge",
  "- Central lesions → reduced TC (velocity storage failure)",
  "",
  "## Head-Shake Nystagmus (HSN)",
  "- 1–2 Hz horizontal oscillation x 10–20 cycles → observe nystagmus under Frenzel lenses",
  "- Asymmetric vestibular function → HSN post-shake (nystagmus toward intact side)",
  "- Normal subjects: symmetric storage → no HSN"
]);

// ═══════════════════════════════════════════════════════════════════
// SLIDE 24 — NEURAL INTEGRATOR
// ═══════════════════════════════════════════════════════════════════
contentSlide("Neural Integrator – Eye Position Signal", [
  "## Why It's Needed",
  "- Eye muscles must overcome elastic restoring force (proportional to eye POSITION)",
  "- Velocity signal from VOR must be mathematically integrated → position signal",
  "- Oculomotor neuron firing rate = k·E(t) + r·Ė(t) (position + velocity)",
  "",
  "## Site",
  "- Horizontal: Nucleus prepositus hypoglossi + medial vestibular nucleus (NPH-MVN complex)",
  "- Vertical/Torsional: Interstitial nucleus of Cajal (INC)",
  "",
  "## Velocity-to-Position Pathway",
  "- Canal signal → direct path to motor nuclei (velocity) + indirect path via integrator (position)",
  "- Leaky integrator → gaze-evoked nystagmus (fast phase toward eccentric gaze)",
  "",
  "## Clinical Sign",
  "- Gaze-evoked nystagmus: inability to hold eccentric gaze → nystagmus beats toward primary position",
  "- Seen in: alcoholic intoxication, AEDs, brainstem/cerebellar lesions",
  "- Indicates CENTRAL pathology when bilateral"
]);

// ═══════════════════════════════════════════════════════════════════
// SLIDE 25 — COMPENSATION & ADAPTATION (PRINCIPLE 12)
// ═══════════════════════════════════════════════════════════════════
contentSlide("Principle 12: Vestibular Adaptation & Compensation", [
  "## Normal Adaptability",
  "- Vestibular system rapidly adjusts reflexes according to context",
  "- VOR suppression during volitional gaze shifts (eye-head gaze saccades)",
  "- Cerebellum modulates VOR gain via Purkinje cells (parallel fiber → climbing fiber learning)",
  "",
  "## After Unilateral Labyrinthectomy",
  "- Static imbalance (spontaneous nystagmus, OTR) compensates within 1–3 weeks",
  "- Dynamic asymmetry (+ HTT toward lesioned side) PERSISTS permanently",
  "- Recovery requires intact brainstem & cerebellum",
  "",
  "## Cerebellar VOR Learning Circuit",
  "- Mossy fibers (vestibular afferents) → granule cells → parallel fibers → Purkinje cells (PK)",
  "- Climbing fibers (inferior olive) carry retinal slip error → complex spikes in PK",
  "- Long-term depression of parallel fiber–Purkinje synapses → changes VOR gain",
  "",
  "## Decompensation",
  "- Central lesions (spinal cord, inferior olive) can cause recurrence of static symptoms",
  "- Drug sedation, dark environment, illness → temporary decompensation",
  "- Basis for vestibular rehabilitation therapy (VRT): promote active head movement"
]);

// ═══════════════════════════════════════════════════════════════════
// SLIDE 26 — CLINICAL CORRELATES TABLE
// ═══════════════════════════════════════════════════════════════════
tableSlide("Clinical Correlates Summary", 
  ["Disorder", "Mechanism", "Key Finding", "Test"],
  [
    ["Posterior Canal BPPV", "Canalith in PC → excitation at Dix-Hallpike", "Upbeat+torsional nystagmus", "Dix-Hallpike"],
    ["Superior Canal Dehiscence", "Third window → pressure/sound stimulates AC", "Eye movement in AC plane; low cVEMP threshold", "HRCT, VEMP"],
    ["Unilateral Labyrinthectomy", "Loss of tonic input → central imbalance", "+ve HTT; static compensation occurs", "Head Impulse Test"],
    ["Ménière's Disease", "Endolymphatic hydrops; saccular deformation", "Fluctuating SNHL, tinnitus, drop attacks", "ECoG, VEMP"],
    ["Viral Labyrinthitis", "Acute unilateral vestibular loss", "Spontaneous nystagmus toward intact side", "Caloric, HTT"],
    ["Brainstem Stroke", "Velocity storage failure; neural integrator lesion", "Gaze-evoked nystagmus, direction-changing nystagmus", "MRI DWI, HINTS"],
  ]
);

// ═══════════════════════════════════════════════════════════════════
// SLIDE 27 — HINTS EXAM & ACUTE VESTIBULAR SYNDROME
// ═══════════════════════════════════════════════════════════════════
contentSlide("HINTS Exam – Differentiating Peripheral vs Central AVS", [
  "## Acute Vestibular Syndrome (AVS)",
  "- Acute onset, continuous vertigo + nausea/vomiting + nystagmus ± gait unsteadiness",
  "- DDx: Vestibular neuritis (peripheral) vs Posterior fossa stroke/TIA (central)",
  "",
  "## HINTS Battery (Kattah et al.)",
  "- H: Head Impulse Test (HImpulseT)",
  "- IN: Nystagmus type (INystagmus)",
  "- TS: Test of Skew (Alternate Cover Test)",
  "",
  "## Peripheral Pattern (HINTS = Reassuring)",
  "- H: Positive HTT (catch-up saccade) — canal hypofunction",
  "- IN: Unidirectional, horizontal, inhibited by fixation",
  "- TS: No skew deviation",
  "",
  "## Central Pattern (HINTS = Dangerous – Stroke Until Proven Otherwise)",
  "- H: Negative HTT (normal VOR gain despite severe vertigo)",
  "- IN: Direction-changing (gaze-evoked) nystagmus OR vertical/purely torsional",
  "- TS: Skew deviation (vertical misalignment)",
  "- HINTS more sensitive than MRI DWI in first 24–48h for posterior fossa stroke"
]);

// ═══════════════════════════════════════════════════════════════════
// SLIDE 28 — BPPV VARIANTS TABLE
// ═══════════════════════════════════════════════════════════════════
tableSlide("BPPV Variants – Canal, Test & Treatment",
  ["Canal", "% of BPPV", "Diagnostic Test", "Nystagmus", "Repositioning"],
  [
    ["Posterior (PC)", "80–90%", "Dix-Hallpike", "Upbeat + ipsilateral torsion", "Epley manoeuvre"],
    ["Horizontal (HC) – Canalolithiasis", "5–15%", "Supine roll (BBQ)", "Geotropic (toward ground)", "Barbecue/Log roll"],
    ["Horizontal (HC) – Cupulolithiasis", "Rare", "Supine roll (BBQ)", "Apogeotropic (away from ground)", "Gufoni manoeuvre"],
    ["Anterior/Superior (AC)", "Very rare", "Dix-Hallpike (contralateral)", "Downbeat + ipsilateral torsion", "Reversed Epley"],
  ]
);

// ═══════════════════════════════════════════════════════════════════
// SLIDE 29 — ROTARY CHAIR TESTING
// ═══════════════════════════════════════════════════════════════════
contentSlide("Rotary Chair (Sinusoidal Harmonic Acceleration) Testing", [
  "## Principle",
  "- Patient rotated sinusoidally in the dark; VOR measured as eye/head velocity ratio",
  "- Tests bilateral horizontal canal function at multiple frequencies (0.01–1 Hz)",
  "",
  "## Parameters Measured",
  "- Gain = peak eye velocity / peak head velocity (normal ≈ 0.6–0.8 at 0.05 Hz)",
  "- Phase = timing difference between eye and head velocity (should be ~0° at high freq)",
  "- Symmetry = comparison of response to leftward vs rightward rotation",
  "",
  "## Normal Findings",
  "- Phase lead at low frequencies (canal limitation; mitigated by velocity storage)",
  "- Gain decreases at very low frequencies and very high frequencies",
  "",
  "## Unilateral Loss",
  "- Gain may be low bilaterally or normal (compensation)",
  "- Phase advance at low frequencies is more robust than gain asymmetry",
  "",
  "## Bilateral Loss",
  "- Gain globally reduced across all frequencies",
  "- Short time constant on velocity step testing"
]);

// ═══════════════════════════════════════════════════════════════════
// SLIDE 30 — POSTURAL CONTROL & VSR
// ═══════════════════════════════════════════════════════════════════
contentSlide("Vestibulospinal Reflex (VSR) & Postural Control", [
  "## Pathway",
  "- Lateral vestibulospinal tract (LVST): ipsilateral; originates Deiter's nucleus → activates ipsilateral limb extensors",
  "- Medial vestibulospinal tract (MVST): bilateral; cervical levels → controls head-neck muscles",
  "",
  "## Function",
  "- Compensates for changes in body orientation relative to gravity",
  "- Acts on trunk & limbs to prevent falls during head movements",
  "",
  "## Dynamic Posturography",
  "- Sensory organisation test (SOT): systematically removes visual and somatosensory input",
  "- Identifies which sensory system is deficient",
  "",
  "## Otolith Contribution",
  "- Utricular reflexes: lateral postural corrections (interaural acceleration)",
  "- Saccular reflexes: anteroposterior postural corrections (vertical acceleration)",
  "",
  "## Clinical Tests",
  "- Romberg test: removes vision → vestibular + proprioceptive",
  "- Fukuda step test: forward stepping with eyes closed → deviation toward vestibular lesion side",
  "- Unterberger test: marching on spot → turning toward weak side"
]);

// ═══════════════════════════════════════════════════════════════════
// SLIDE 31 — SUMMARY OF 12 PRINCIPLES
// ═══════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  s.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 13.3, h: 7.5, fill: { color: C.navy } });
  s.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 13.3, h: 0.08, fill: { color: C.amber } });
  s.addShape(pres.ShapeType.rect, { x: 0, y: 7.42, w: 13.3, h: 0.08, fill: { color: C.teal } });

  s.addText("Summary: 12 Principles of Applied Vestibular Physiology", {
    x: 0.4, y: 0.18, w: 12.5, h: 0.8,
    fontSize: 24, bold: true, color: C.white, fontFace: "Calibri"
  });

  const principles = [
    "1. Vestibular system primarily drives reflexes for stable vision & posture",
    "2. Baseline afferent firing enables bidirectional modulation",
    "3. Canal stimulation → eye movement in the plane of that canal",
    "4. Canal excited by rotation bringing forehead toward ipsilateral side",
    "5. Excitatory stimulus → nystagmus slow phase opposite to excitation",
    "6. High-acceleration excitatory > same in inhibitory direction (Ewald 2)",
    "7. Canal responses summate linearly (vector superposition)",
    "8. Otolith organs: utricle senses tilt & translation (ambiguity problem)",
    "9. Velocity storage extends low-frequency VOR via brainstem feedback",
    "10. Neural integrator converts velocity → position signal (NPH, INC)",
    "11. Saccular activity modulates postural tone (VEMP basis)",
    "12. Vestibular reflexes adaptable; compensation may be slow/reversible"
  ];

  const col1 = principles.slice(0, 6);
  const col2 = principles.slice(6);

  const makeArr = arr => arr.map((t, i) => ({
    text: t,
    options: {
      bullet: false, fontSize: 13.5, color: C.white,
      breakLine: i < arr.length - 1, paraSpaceBefore: 6
    }
  }));

  s.addText(makeArr(col1), { x: 0.4, y: 1.15, w: 6.2, h: 6.0, fontFace: "Calibri", valign: "top" });
  s.addShape(pres.ShapeType.rect, { x: 6.75, y: 1.1, w: 0.04, h: 6.0, fill: { color: C.teal } });
  s.addText(makeArr(col2), { x: 6.9, y: 1.15, w: 6.1, h: 6.0, fontFace: "Calibri", valign: "top" });
}

// ═══════════════════════════════════════════════════════════════════
// SLIDE 32 — THANK YOU / REFERENCES
// ═══════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  s.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 13.3, h: 7.5, fill: { color: C.darkBg } });
  s.addShape(pres.ShapeType.rect, { x: 0, y: 5.6, w: 13.3, h: 1.9, fill: { color: C.teal } });
  s.addShape(pres.ShapeType.rect, { x: 0, y: 5.5, w: 13.3, h: 0.13, fill: { color: C.amber } });

  s.addText("Thank You", {
    x: 0.5, y: 1.5, w: 12.3, h: 1.5,
    fontSize: 60, bold: true, color: C.white, align: "center", fontFace: "Calibri"
  });
  s.addText("Questions & Discussion", {
    x: 0.5, y: 3.0, w: 12.3, h: 0.7,
    fontSize: 22, color: C.tealLt, align: "center", fontFace: "Calibri", italic: true
  });

  s.addText([
    { text: "Primary Reference: ", options: { bold: true, color: C.white, fontSize: 13 } },
    { text: "Carey JP, Della Santina CC. Principles of Applied Vestibular Physiology.", options: { italic: true, color: C.silver, fontSize: 13 } },
    { text: " In: Flint PW, et al., eds. Cummings Otolaryngology – Head & Neck Surgery. 7th ed. Chapter 165. Elsevier; 2021.", options: { color: C.silver, fontSize: 13 } }
  ], { x: 0.6, y: 5.7, w: 12.1, h: 1.5, fontFace: "Calibri" });
}

// ═══════════════════════════════════════════════════════════════════
// WRITE FILE
// ═══════════════════════════════════════════════════════════════════
pres.writeFile({ fileName: "/home/daytona/workspace/vestibular-physiology-ppt/Vestibular_Physiology_ENT_PG.pptx" })
  .then(() => console.log("Done: Vestibular_Physiology_ENT_PG.pptx"))
  .catch(e => { console.error(e); process.exit(1); });
Running Command

cd /home/daytona/workspace/vestibular-physiology-ppt && node create_ppt.js

Your credits are exhausted. Your daily credits reset tomorrow, or you can purchase a top-up for more.
This is a shared conversation. Sign in to Orris to start your own chat.