Create a professional 15-slide PowerPoint presentation for MBBS students on the topic “Diaphragm Anatomy”. Presentation should have a clean medical design with blue and white theme, labeled anatomical diagrams, clinical images, and concise academic points. Add medical illustrations, cadaveric anatomy images, nerve supply diagrams, thoracic cavity diagrams, and clinical correlation images from standard anatomy references. Mention at the end of every slide footer: “Made by Darshan Benke”. Slide 1 – Title Slide Title: “Diaphragm Anatomy” Subtitle: Structure, Attachments, Openings & Clinical Importance Add detailed anatomical diagram of diaphragm Footer: Made by Darshan Benke Slide 2 – Introduction Definition of diaphragm Dome-shaped musculotendinous partition Separates thoracic and abdominal cavities Primary muscle of respiration Add simple thorax-abdomen separation diagram Slide 3 – Parts of Diaphragm Sternal part Costal part Lumbar part Central tendon Add labeled anatomical illustration Slide 4 – Origin and Attachments Xiphoid process Lower six ribs and costal cartilages Lumbar vertebrae Crura of diaphragm Add origin and insertion diagram Slide 5 – Central Tendon Shape and location Fusion with fibrous pericardium Function Add superior view diagram Slide 6 – Openings of Diaphragm Caval opening (T8) Esophageal opening (T10) Aortic hiatus (T12) Structures passing through each opening Add labeled openings diagram Slide 7 – Blood Supply Inferior phrenic arteries Pericardiophrenic arteries Musculophrenic arteries Venous drainage Add vascular diagram Slide 8 – Nerve Supply Phrenic nerve (C3, C4, C5) Sensory and motor supply Peripheral sensory supply Add phrenic nerve pathway diagram Slide 9 – Embryological Development Septum transversum Pleuroperitoneal membranes Dorsal mesentery of esophagus Muscular ingrowth Add embryology flowchart Slide 10 – Movements During Respiration Action in inspiration Action in expiration Changes in thoracic volume Add respiratory movement diagram Slide 11 – Relations of Diaphragm Thoracic surface relations Abdominal surface relations Liver, stomach, spleen, lungs Add superior and inferior view images Slide 12 – Histology of Diaphragm Skeletal muscle fibers Tendinous tissue Microscopic appearance Add histology slide image Slide 13 – Applied Anatomy Diaphragmatic hernia Hiatal hernia Eventration of diaphragm Phrenic nerve palsy Add clinical radiology images Slide 14 – Imaging and Diagnosis X-ray appearance CT scan of diaphragm Ultrasound uses MRI overview Add radiological comparison images Slide 15 – Conclusion & References Summary of important points Importance in respiration and surgery Add references: Gray’s Anatomy Netter Atlas Snell Clinical Anatomy Final note: “Thank You” Footer: Made by Darshan Benke

Reading File
Reading File
Reading File
Searching Images

diaphragm anatomy labeled diagram superior view

Searching Images

phrenic nerve pathway diagram cervical spine C3 C4 C5

Searching Images

diaphragmatic hernia hiatal hernia chest X-ray CT scan

Searching Images

diaphragm openings caval esophageal aortic hiatus labeled

Searching Images

diaphragm respiration inspiration expiration movement thoracic volume

Searching Images

diaphragm blood supply inferior phrenic artery vascular anatomy

Searching Images

diaphragm embryology development septum transversum pleuroperitoneal membrane

Running Command

ls -la /home/daytona/workspace/ 2>/dev/null || echo "workspace does not exist"

Running Command

mkdir -p /home/daytona/workspace/diaphragm-anatomy && echo "Directory created"

Add Web images

Searching the Web

diaphragm anatomy labeled diagram superior view wikimedia commons

Searching the Web

phrenic nerve anatomy diagram C3 C4 C5 labeled wikimedia

Searching the Web

diaphragm openings T8 T10 T12 labeled anatomy diagram wikimedia

Searching Images

diaphragm anatomy parts sternal costal lumbar central tendon labeled illustration

Searching Images

diaphragm CT scan MRI X-ray radiology normal appearance

Writing File

~/diaphragm-anatomy/create_presentation.js

const pptxgen = require("pptxgenjs");
const { execSync } = require("child_process");

// ─── Fetch images as base64 ──────────────────────────────────────────────────
const imageUrls = {
  title:       "https://upload.wikimedia.org/wikipedia/commons/7/70/1113_The_Diaphragm.jpg",
  diaphSuperior: "https://cdn.orris.care/cdss_images/pmc_clinical_VQA_8ab8f155a63410adca459d09626372fa974bb3339d44cec0d0e62f0656daf25f.jpg",
  diaphInferior: "https://cdn.orris.care/cdss_images/pmc_clinical_VQA_acaebe8de7739161e48420770bf6aa8c88635dea40c460f7db0a8ea9ab27a8b7.jpg",
  diaphParts:  "https://cdn.orris.care/cdss_images/pmc_clinical_VQA_563a8c4d6a1ebadde47973c57dae8b3a97d5082ef06f10d741ba043ce4806116.jpg",
  diaphOrigin: "https://upload.wikimedia.org/wikipedia/commons/f/fa/Diaphragma.jpg",
  centralTendon: "https://cdn.orris.care/cdss_images/pmc_clinical_VQA_2d936a66e71d007eb2ec287f231de65e3b4c6101a059fed9186209291784cc16.jpg",
  openings:    "https://admin.anatomy.app/Media/images/respiratory-system-thorax-muscles-diaphragm-openings_20250618044507_large.jpg",
  bloodSupply: "https://cdn.orris.care/cdss_images/pmc_clinical_VQA_83760d4f3c0a8b659bdeff0c885120a7ec543953d9ba3522134461021bd07a7e.jpg",
  nerveSupply: "https://wikism.org/w/images/b/b2/Illustration_of_the_phrenic_nerve.jpg",
  embryology:  "https://cdn.orris.care/cdss_images/pmc_clinical_VQA_4fdedb94a711fd5a434b4955eb59519f4cfa958672b53d2ec2615636f34245d9.jpg",
  respiration: "https://cdn.orris.care/cdss_images/pmc_clinical_VQA_9f55543b972bfa7bf92d56129175cc376ab6c4766ac02aeeda18f3964b1fc099.jpg",
  relations:   "https://cdn.orris.care/cdss_images/pmc_clinical_VQA_4a7bce2c816beb466dddd06b2399918f780504af8fe3132f60347bca7d71764a.jpg",
  histology:   "https://cdn.orris.care/cdss_images/pmc_clinical_VQA_563a8c4d6a1ebadde47973c57dae8b3a97d5082ef06f10d741ba043ce4806116.jpg",
  clinicalXray:"https://cdn.orris.care/cdss_images/pmc_clinical_VQA_feaf1342ee851ba168b7fa5655ad01419962dbf2b6a9e8b4babd9175deea483a.jpg",
  imaging:     "https://cdn.orris.care/cdss_images/pmc_clinical_VQA_4a7bce2c816beb466dddd06b2399918f780504af8fe3132f60347bca7d71764a.jpg",
  herniaTypes: "https://cdn.orris.care/cdss_images/BAILY_1760530385228_a92e5653-8d3e-4ea0-a8e4-0d3ebd91ea8e.png",
};

console.log("Fetching images...");
let images = {};
try {
  const urlList = Object.values(imageUrls).map(u => `"${u}"`).join(" ");
  const result = execSync(
    `node /home/daytona/skills/shared/scripts/fetch_images.js ${urlList}`,
    { maxBuffer: 100 * 1024 * 1024, timeout: 120000 }
  ).toString();
  const fetched = JSON.parse(result);
  const keys = Object.keys(imageUrls);
  keys.forEach((k, i) => {
    if (fetched[i] && !fetched[i].error && fetched[i].base64) {
      images[k] = fetched[i].base64;
    } else {
      console.log(`  WARN: failed to fetch image for key="${k}": ${fetched[i]?.error}`);
      images[k] = null;
    }
  });
} catch (e) {
  console.error("Image fetch error:", e.message);
}
console.log("Images fetched. Building presentation...");

// ─── Color Palette ────────────────────────────────────────────────────────────
const C = {
  navyBg:     "0D2B55",   // deep navy – slide background
  headerBg:   "1B4F8A",   // royal blue – title bars
  accentBlue: "2980B9",   // mid blue – accents / bullets
  lightBlue:  "D6E8F7",   // pale blue – side panel / highlights
  white:      "FFFFFF",
  offWhite:   "F0F6FC",
  gold:       "F5A623",   // accent / underline
  textDark:   "0A1E3A",   // body text on light bg
  subText:    "4A6FA5",
};

// ─── Helpers ─────────────────────────────────────────────────────────────────
function addBackground(slide, color = C.offWhite) {
  slide.background = { color: color };
}

function addHeader(slide, title, subtitle = null) {
  // Header bar
  slide.addShape("rect", { x: 0, y: 0, w: "100%", h: 1.15, fill: { color: C.headerBg } });
  // Gold accent line
  slide.addShape("rect", { x: 0, y: 1.15, w: "100%", h: 0.06, fill: { color: C.gold } });
  // Title text
  slide.addText(title, {
    x: 0.3, y: 0.08, w: 9.2, h: 0.72,
    fontSize: 26, bold: true, color: C.white, fontFace: "Calibri", align: "left",
    margin: 0,
  });
  if (subtitle) {
    slide.addText(subtitle, {
      x: 0.3, y: 0.80, w: 9.2, h: 0.35,
      fontSize: 13, color: C.lightBlue, fontFace: "Calibri", align: "left",
      margin: 0, italic: true,
    });
  }
}

function addFooter(slide) {
  slide.addShape("rect", { x: 0, y: 5.35, w: "100%", h: 0.275, fill: { color: C.headerBg } });
  slide.addText("Made by Darshan Benke", {
    x: 0.3, y: 5.36, w: 9.4, h: 0.25,
    fontSize: 9, color: C.lightBlue, fontFace: "Calibri", align: "center",
    margin: 0, italic: true,
  });
}

function bulletList(items, opts = {}) {
  return items.map((t, i) => ({
    text: t,
    options: { bullet: { type: "bullet" }, breakLine: i < items.length - 1, ...opts },
  }));
}

function addBulletBox(slide, items, x, y, w, h, titleText = null, fontSize = 13) {
  if (titleText) {
    slide.addText(titleText, {
      x, y, w, h: 0.35,
      fontSize: 12, bold: true, color: C.accentBlue, fontFace: "Calibri",
      margin: [2, 4, 2, 4],
    });
    y += 0.35;
    h -= 0.35;
  }
  slide.addShape("rect", { x, y, w, h, fill: { color: C.lightBlue }, line: { color: C.accentBlue, pt: 1 } });
  slide.addText(bulletList(items, { color: C.textDark, fontFace: "Calibri", fontSize }), {
    x: x + 0.08, y: y + 0.05, w: w - 0.16, h: h - 0.1,
    fontSize, color: C.textDark, fontFace: "Calibri", valign: "top",
    margin: [4, 4, 4, 8],
  });
}

function addImage(slide, key, x, y, w, h) {
  if (images[key]) {
    try {
      slide.addImage({ data: images[key], x, y, w, h, sizing: { type: "contain", w, h } });
    } catch (e) {
      console.log(`Image render warning [${key}]:`, e.message);
    }
  }
}

function addImageWithBorder(slide, key, x, y, w, h, label = null) {
  // Border box
  slide.addShape("rect", { x: x - 0.05, y: y - 0.05, w: w + 0.1, h: h + (label ? 0.35 : 0.1),
    fill: { color: C.white }, line: { color: C.accentBlue, pt: 1.5 } });
  addImage(slide, key, x, y, w, h);
  if (label) {
    slide.addText(label, {
      x: x - 0.05, y: y + h, w: w + 0.1, h: 0.3,
      fontSize: 9, color: C.subText, fontFace: "Calibri", align: "center", italic: true,
      margin: 0,
    });
  }
}

// ─── Presentation ─────────────────────────────────────────────────────────────
const pres = new pptxgen();
pres.layout = "LAYOUT_16x9";
pres.title = "Diaphragm Anatomy";
pres.author = "Darshan Benke";

// ════════════════════════════════════════════════════════════════════════
// SLIDE 1 – Title
// ════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  // Full navy background
  s.background = { color: C.navyBg };

  // Left decorative stripe
  s.addShape("rect", { x: 0, y: 0, w: 0.18, h: "100%", fill: { color: C.gold } });

  // Title block
  s.addText("DIAPHRAGM ANATOMY", {
    x: 0.55, y: 0.55, w: 5.8, h: 0.9,
    fontSize: 38, bold: true, color: C.white, fontFace: "Calibri",
    charSpacing: 2,
  });
  s.addShape("rect", { x: 0.55, y: 1.45, w: 5.8, h: 0.05, fill: { color: C.gold } });
  s.addText("Structure, Attachments, Openings & Clinical Importance", {
    x: 0.55, y: 1.52, w: 5.8, h: 0.5,
    fontSize: 16, italic: true, color: C.lightBlue, fontFace: "Calibri",
  });
  s.addText("For MBBS Students  |  Gross Anatomy", {
    x: 0.55, y: 2.12, w: 5.8, h: 0.4,
    fontSize: 13, color: C.gold, fontFace: "Calibri",
  });

  // Right image panel
  s.addShape("rect", { x: 6.5, y: 0.3, w: 3.2, h: 4.6, fill: { color: C.headerBg }, line: { color: C.gold, pt: 2 } });
  addImage(s, "title", 6.55, 0.35, 3.1, 4.5);

  // Caption under image
  s.addText("OpenStax Anatomy & Physiology", {
    x: 6.5, y: 4.85, w: 3.2, h: 0.25,
    fontSize: 8, color: C.subText, fontFace: "Calibri", align: "center", italic: true,
  });

  // Bottom info bar
  s.addShape("rect", { x: 0, y: 5.1, w: "100%", h: 0.525, fill: { color: C.headerBg } });
  s.addText("Gray's Anatomy  •  Netter Atlas  •  Snell Clinical Anatomy  |  Made by Darshan Benke", {
    x: 0.3, y: 5.1, w: 9.4, h: 0.525,
    fontSize: 10, color: C.lightBlue, fontFace: "Calibri", align: "center", italic: true, valign: "middle",
  });
}

// ════════════════════════════════════════════════════════════════════════
// SLIDE 2 – Introduction
// ════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  addBackground(s);
  addHeader(s, "Introduction to the Diaphragm");

  addBulletBox(s, [
    "Dome-shaped musculotendinous partition",
    "Separates thoracic cavity (superior) from abdominal cavity (inferior)",
    "Formed by skeletal muscle fibres + central aponeurotic tendon",
    "Primary muscle of respiration – responsible for ~80% of tidal breathing",
    "Asymmetric: right dome higher (T8/9) due to liver; left dome at T9/10",
    "Superior surface = floor of thoracic cavity; inferior surface = roof of abdominal cavity",
    "Innervated exclusively (motor) by phrenic nerve (C3, C4, C5)",
  ], 0.3, 1.28, 5.8, 3.85, null, 12.5);

  addImageWithBorder(s, "relations", 6.25, 1.28, 3.45, 3.8, "CT: Diaphragm separating cavities");
  addFooter(s);
}

// ════════════════════════════════════════════════════════════════════════
// SLIDE 3 – Parts of Diaphragm
// ════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  addBackground(s);
  addHeader(s, "Parts of the Diaphragm");

  // Four labelled info boxes
  const parts = [
    { title: "① Sternal Part", items: ["Two small slips", "Arise from posterior xiphoid process", "Narrowest portion of diaphragm"] },
    { title: "② Costal Part", items: ["Six slips from lower 6 ribs & costal cartilages", "Largest portion", "Interdigitates with transversus abdominis"] },
    { title: "③ Lumbar Part", items: ["Two crura (right & left)", "Right crus: L1–L3 vertebral bodies", "Left crus: L1–L2 vertebral bodies", "Median & medial arcuate ligaments"] },
    { title: "④ Central Tendon", items: ["Trifoliate (trefoil) aponeurosis", "No bony insertion – fibres converge here", "Fused superiorly with fibrous pericardium", "Contains caval opening (T8)"] },
  ];

  const boxW = 2.2, boxH = 1.75;
  const xs = [0.25, 2.55, 4.85, 7.15];
  parts.forEach((p, i) => {
    s.addShape("rect", { x: xs[i], y: 1.28, w: boxW, h: boxH, fill: { color: C.headerBg }, line: { color: C.gold, pt: 1.5 } });
    s.addText(p.title, { x: xs[i] + 0.08, y: 1.3, w: boxW - 0.16, h: 0.32,
      fontSize: 11.5, bold: true, color: C.gold, fontFace: "Calibri", margin: 0 });
    s.addText(bulletList(p.items, { color: C.white, fontSize: 10.5, fontFace: "Calibri" }), {
      x: xs[i] + 0.08, y: 1.62, w: boxW - 0.16, h: boxH - 0.36,
      fontSize: 10.5, color: C.white, fontFace: "Calibri", valign: "top", margin: [2, 2, 2, 6],
    });
  });

  addImageWithBorder(s, "diaphSuperior", 0.25, 3.15, 4.6, 1.9, "Superior view – sternal, costal & lumbar parts");
  addImageWithBorder(s, "diaphParts", 4.95, 3.15, 4.75, 1.9, "Gross specimen – central tendon visible");
  addFooter(s);
}

// ════════════════════════════════════════════════════════════════════════
// SLIDE 4 – Origin and Attachments
// ════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  addBackground(s);
  addHeader(s, "Origin & Attachments of the Diaphragm");

  addBulletBox(s, [
    "Sternal: Posterior surface of xiphoid process (two muscular slips)",
    "Costal: Inner surfaces of lower 6 ribs & their costal cartilages (ribs 7–12)",
    "Vertebral: Bodies of L1–L3 (right crus) and L1–L2 (left crus)",
    "Median arcuate ligament: Crosses anterior aorta at T12",
    "Medial arcuate ligament: Over psoas major (L1 transverse process → L1 body)",
    "Lateral arcuate ligament: Over quadratus lumborum (rib 12 → L1 transverse process)",
    "All fibres converge centrally → Insert into CENTRAL TENDON",
  ], 0.3, 1.28, 5.5, 3.85, "Peripheral Attachments", 12);

  addImageWithBorder(s, "diaphOrigin", 5.95, 1.28, 3.75, 3.8, "Gray's Anatomy: Diaphragm attachments");
  addFooter(s);
}

// ════════════════════════════════════════════════════════════════════════
// SLIDE 5 – Central Tendon
// ════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  addBackground(s);
  addHeader(s, "Central Tendon");

  // Left info panel
  addBulletBox(s, [
    "Trifoliate (trefoil / clover-leaf) shaped fibrous aponeurosis",
    "Located near centre of diaphragm but slightly anterior",
    "Three leaflets: anterior, right lateral & left lateral",
    "Right leaflet is largest – supports the liver",
    "No bony attachment – all muscle fibres converge here",
    "Fused superiorly with the fibrous pericardium of the heart",
    "IVC passes through central tendon at T8",
    "Relatively fixed during respiration; phrenic centres terminate here",
  ], 0.3, 1.28, 5.3, 3.85, "Key Features", 12.5);

  addImageWithBorder(s, "centralTendon", 5.75, 1.28, 3.95, 3.8, "Surgical anatomy: central tendon & phrenic nerves");
  addFooter(s);
}

// ════════════════════════════════════════════════════════════════════════
// SLIDE 6 – Openings of Diaphragm
// ════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  addBackground(s);
  addHeader(s, "Openings of the Diaphragm", "Mnemonic: I8 (IVC – 8 letters), OEsophagus (10 letters), AOrtic (12 letters)");

  // Three coloured cards
  const oData = [
    {
      level: "T8", name: "Caval Opening",
      loc: "Central tendon – right of median plane",
      pass: ["Inferior Vena Cava (IVC)", "Right phrenic nerve"],
      color: "1A6B3C",
    },
    {
      level: "T10", name: "Esophageal Hiatus",
      loc: "Muscular part – right crus surrounds it",
      pass: ["Esophagus", "Left & Right vagus nerves", "Esophageal branches of left gastric vessels"],
      color: C.headerBg,
    },
    {
      level: "T12", name: "Aortic Hiatus",
      loc: "Behind diaphragm – between two crura",
      pass: ["Descending aorta", "Thoracic duct", "Azygos vein (sometimes)"],
      color: "7B1A1A",
    },
  ];

  const cardW = 2.9, cardH = 2.6;
  const xs = [0.25, 3.3, 6.35];
  oData.forEach((o, i) => {
    s.addShape("rect", { x: xs[i], y: 1.28, w: cardW, h: cardH, fill: { color: o.color }, line: { color: C.gold, pt: 1.5 } });
    s.addText(`T${o.level.replace("T","")}`, { x: xs[i] + 0.1, y: 1.3, w: cardW - 0.2, h: 0.42,
      fontSize: 22, bold: true, color: C.gold, fontFace: "Calibri" });
    s.addText(o.name, { x: xs[i] + 0.1, y: 1.72, w: cardW - 0.2, h: 0.32,
      fontSize: 13, bold: true, color: C.white, fontFace: "Calibri" });
    s.addShape("rect", { x: xs[i] + 0.1, y: 2.04, w: cardW - 0.2, h: 0.03, fill: { color: C.gold } });
    s.addText(`📍 ${o.loc}`, { x: xs[i] + 0.1, y: 2.08, w: cardW - 0.2, h: 0.32,
      fontSize: 10, italic: true, color: C.lightBlue, fontFace: "Calibri" });
    s.addText("Transmits:", { x: xs[i] + 0.1, y: 2.42, w: cardW - 0.2, h: 0.22,
      fontSize: 10, bold: true, color: C.gold, fontFace: "Calibri" });
    s.addText(bulletList(o.pass, { color: C.white, fontSize: 10 }), {
      x: xs[i] + 0.1, y: 2.62, w: cardW - 0.2, h: 1.2,
      fontSize: 10, color: C.white, fontFace: "Calibri", valign: "top", margin: [2, 2, 2, 6],
    });
  });

  addImageWithBorder(s, "openings", 0.25, 4.0, 9.2, 1.1, "Diaphragm openings – inferior view");
  addFooter(s);
}

// ════════════════════════════════════════════════════════════════════════
// SLIDE 7 – Blood Supply
// ════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  addBackground(s);
  addHeader(s, "Blood Supply of the Diaphragm");

  addBulletBox(s, [
    "ARTERIAL – Superior surface:",
    "  • Pericardiophrenic arteries (from internal thoracic arteries)",
    "  • Musculophrenic arteries (from internal thoracic arteries)",
    "  • Superior phrenic arteries (from thoracic aorta)",
    "ARTERIAL – Inferior surface:",
    "  • Inferior phrenic arteries (first branches of abdominal aorta)",
    "  • These are the dominant supply",
    "VENOUS DRAINAGE:",
    "  • Superior: pericardiophrenic & musculophrenic veins → internal thoracic veins",
    "  • Inferior: inferior phrenic veins → IVC (right) or left suprarenal/renal vein (left)",
  ], 0.3, 1.28, 5.5, 3.85, null, 11.5);

  addImageWithBorder(s, "bloodSupply", 5.95, 1.28, 3.75, 3.8, "Cadaveric dissection: inferior phrenic artery");
  addFooter(s);
}

// ════════════════════════════════════════════════════════════════════════
// SLIDE 8 – Nerve Supply
// ════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  addBackground(s);
  addHeader(s, "Nerve Supply of the Diaphragm");

  // Left panel
  addBulletBox(s, [
    "MOTOR (Entire diaphragm):",
    "  • Phrenic nerve (C3, C4, C5) – bilateral",
    "  • Mnemonic: C3,4,5 keeps the diaphragm alive",
    "SENSORY – Central diaphragm:",
    "  • Phrenic nerve (C3, C4, C5) → referred pain to shoulder tip (C4 dermatome)",
    "SENSORY – Peripheral diaphragm:",
    "  • Lower 6 intercostal nerves (T7–T12)",
    "  • Subcostal nerve (T12)",
    "CLINICAL NOTE:",
    "  • Phrenic nerve palsy → paradoxical diaphragm movement",
    "  • Kehr's sign: diaphragmatic irritation → shoulder pain",
  ], 0.3, 1.28, 5.5, 3.85, null, 11.5);

  addImageWithBorder(s, "nerveSupply", 5.95, 1.28, 3.75, 3.8, "Phrenic nerve pathway – neck to diaphragm");
  addFooter(s);
}

// ════════════════════════════════════════════════════════════════════════
// SLIDE 9 – Embryological Development
// ════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  addBackground(s);
  addHeader(s, "Embryological Development of the Diaphragm");

  // Flowchart style boxes
  const steps = [
    { num: "①", title: "Septum Transversum", detail: "Forms central tendon\nWeek 4: from mesoderm of cervical somites (C3-C5)\nExplains phrenic nerve origin", color: C.headerBg },
    { num: "②", title: "Pleuroperitoneal Membranes", detail: "Close pleuroperitoneal canals by week 6\nFailure → Bochdalek hernia\nLeft side closes later → more often affected", color: "1A6B3C" },
    { num: "③", title: "Dorsal Mesentery of Oesophagus", detail: "Forms the crura of diaphragm\nMedian portion between two crura\nAortic hiatus formed here", color: "7B1A1A" },
    { num: "④", title: "Muscular Ingrowth from Body Wall", detail: "Body wall myoblasts invade the membranous diaphragm\nForms peripheral muscular portion\nComplete by 8–10 weeks", color: "4A3080" },
  ];

  const bW = 2.2, bH = 1.75;
  const xs = [0.25, 2.55, 4.85, 7.15];
  steps.forEach((st, i) => {
    s.addShape("rect", { x: xs[i], y: 1.28, w: bW, h: bH, fill: { color: st.color }, line: { color: C.gold, pt: 1.5 } });
    s.addText(st.num + " " + st.title, { x: xs[i] + 0.08, y: 1.3, w: bW - 0.16, h: 0.38,
      fontSize: 11, bold: true, color: C.gold, fontFace: "Calibri", margin: 0 });
    s.addText(st.detail, { x: xs[i] + 0.08, y: 1.68, w: bW - 0.16, h: bH - 0.4,
      fontSize: 10, color: C.white, fontFace: "Calibri", valign: "top", margin: [2, 2, 2, 4] });
  });

  addImageWithBorder(s, "embryology", 0.25, 3.15, 5.5, 1.9, "CDH embryology: septum transversum & pleuroperitoneal folds");
  addBulletBox(s, [
    "Diaphragm develops from C3-C5 level → descends with phrenic nerve",
    "4 contributions fuse by wk 8-10; failure → congenital defects",
  ], 5.85, 3.15, 3.85, 1.9, "Key Points", 11);
  addFooter(s);
}

// ════════════════════════════════════════════════════════════════════════
// SLIDE 10 – Movements During Respiration
// ════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  addBackground(s);
  addHeader(s, "Movements During Respiration");

  // Two side-by-side cards
  const cards = [
    {
      title: "INSPIRATION", color: "1A6B3C",
      items: [
        "Diaphragm contracts → domes flatten & descend",
        "Vertical diameter of thorax increases by ~1.5 cm",
        "Intra-thoracic pressure decreases → air flows in",
        "Abdominal viscera pushed downward & forward",
        "Phrenic nerve (C3,4,5) fires → diaphragm contracts",
        "Contribution: ~75% of tidal volume in quiet breathing",
      ],
    },
    {
      title: "EXPIRATION (quiet)", color: "7B1A1A",
      items: [
        "Diaphragm relaxes → elastic recoil of lungs",
        "Domes rise back to resting position",
        "Thoracic volume decreases → air expelled",
        "Passive process in quiet breathing",
        "Forced expiration: abdominal muscles contract",
        "Internal intercostals assist in forced expiration",
      ],
    },
  ];

  cards.forEach((c, i) => {
    const x = 0.25 + i * 4.75;
    s.addShape("rect", { x, y: 1.28, w: 4.5, h: 0.38, fill: { color: c.color } });
    s.addText(c.title, { x, y: 1.28, w: 4.5, h: 0.38, fontSize: 14, bold: true,
      color: C.white, fontFace: "Calibri", align: "center", valign: "middle" });
    s.addShape("rect", { x, y: 1.66, w: 4.5, h: 1.85, fill: { color: C.lightBlue }, line: { color: c.color, pt: 1.5 } });
    s.addText(bulletList(c.items, { color: C.textDark, fontSize: 11 }), {
      x: x + 0.1, y: 1.7, w: 4.3, h: 1.78, fontSize: 11,
      color: C.textDark, fontFace: "Calibri", valign: "top", margin: [2, 2, 2, 6],
    });
  });

  addImageWithBorder(s, "respiration", 0.25, 3.6, 9.2, 1.55, "Respiratory mechanics: diaphragm movement, pump-handle & bucket-handle");
  addFooter(s);
}

// ════════════════════════════════════════════════════════════════════════
// SLIDE 11 – Relations of the Diaphragm
// ════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  addBackground(s);
  addHeader(s, "Relations of the Diaphragm");

  addBulletBox(s, [
    "SUPERIOR (Thoracic surface):",
    "  • Heart & fibrous pericardium (central tendon)",
    "  • Lungs & pleurae",
    "  • Phrenic nerves & pericardiophrenic vessels",
    "INFERIOR (Abdominal surface):",
    "  • Right lobe of liver (right dome) & left lobe (left dome)",
    "  • Stomach (left dome)",
    "  • Spleen (left dome)",
    "  • Right & left suprarenal glands",
    "  • Upper pole of both kidneys",
    "POSTERIOR:",
    "  • Abdominal aorta, thoracic duct, azygos vein",
    "  • Psoas major (under medial arcuate ligament)",
    "  • Quadratus lumborum (under lateral arcuate ligament)",
  ], 0.3, 1.28, 5.3, 3.85, null, 11);

  addImageWithBorder(s, "relations", 5.75, 1.28, 3.95, 3.8, "CT sagittal: liver & spleen under diaphragm");
  addFooter(s);
}

// ════════════════════════════════════════════════════════════════════════
// SLIDE 12 – Histology
// ════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  addBackground(s);
  addHeader(s, "Histology of the Diaphragm");

  addBulletBox(s, [
    "SKELETAL MUSCLE FIBRES:",
    "  • Striated (voluntary) type – cross-striations visible",
    "  • Rich mitochondrial content → fatigue-resistant (Type I fibres dominant)",
    "  • High capillary density – reflects high O₂ demand",
    "  • Fibres radiate from periphery toward central tendon",
    "CENTRAL TENDON (Fibrous Component):",
    "  • Dense regular connective tissue (collagen type I)",
    "  • Interwoven collagen bundles – no muscle fibres",
    "  • Merges with fibrous pericardium superiorly",
    "NEUROMUSCULAR JUNCTIONS:",
    "  • En-plaque type (typical of skeletal muscle)",
    "  • Rich innervation from phrenic nerve terminals",
  ], 0.3, 1.28, 5.5, 3.85, null, 11.5);

  addImageWithBorder(s, "diaphParts", 5.95, 1.28, 3.75, 3.8, "Gross specimen: muscle periphery & central tendon");
  addFooter(s);
}

// ════════════════════════════════════════════════════════════════════════
// SLIDE 13 – Applied Anatomy
// ════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  addBackground(s);
  addHeader(s, "Applied Anatomy – Clinical Correlations");

  const conditions = [
    { title: "Congenital Diaphragmatic Hernia (CDH)", detail: "Failure of pleuroperitoneal membrane to close\nBochdalek (posterolateral) 90% – mostly LEFT\nMorgagni (retrosternal) 10% – RIGHT\nPulmonary hypoplasia – key complication", color: "7B1A1A" },
    { title: "Hiatal Hernia", detail: "Sliding (type I): GEJ herniates above diaphragm\nParaesophageal (type II): fundus herniates\nMost common diaphragmatic hernia in adults\nPresents with GERD, dysphagia", color: C.headerBg },
    { title: "Eventration of Diaphragm", detail: "Failure of muscular development → fibrous sheet\nElevated hemidiaphragm on X-ray\nMay cause respiratory distress in neonates\nOften asymptomatic in adults", color: "1A6B3C" },
    { title: "Phrenic Nerve Palsy", detail: "Causes: malignancy, surgery, trauma, virus\nParadoxical movement on fluoroscopy / sniff test\nElevated hemidiaphragm on CXR\nBilateral → severe respiratory failure", color: "4A3080" },
  ];

  const bW = 2.2, bH = 1.75;
  const xs = [0.25, 2.55, 4.85, 7.15];
  conditions.forEach((c, i) => {
    s.addShape("rect", { x: xs[i], y: 1.28, w: bW, h: bH, fill: { color: c.color }, line: { color: C.gold, pt: 1.5 } });
    s.addText(c.title, { x: xs[i] + 0.08, y: 1.3, w: bW - 0.16, h: 0.38,
      fontSize: 10.5, bold: true, color: C.gold, fontFace: "Calibri", margin: 0 });
    s.addText(c.detail, { x: xs[i] + 0.08, y: 1.68, w: bW - 0.16, h: bH - 0.4,
      fontSize: 10, color: C.white, fontFace: "Calibri", valign: "top", margin: [2, 2, 2, 4] });
  });

  addImageWithBorder(s, "herniaTypes", 0.25, 3.15, 4.5, 1.9, "Hernia sites: Morgagni, Bochdalek, hiatal");
  addImageWithBorder(s, "clinicalXray", 4.85, 3.15, 4.85, 1.9, "CXR + CT: left-sided traumatic diaphragmatic hernia");
  addFooter(s);
}

// ════════════════════════════════════════════════════════════════════════
// SLIDE 14 – Imaging & Diagnosis
// ════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  addBackground(s);
  addHeader(s, "Imaging & Diagnosis of the Diaphragm");

  const modalities = [
    { title: "X-Ray (CXR)", items: ["Domes visible as smooth convex arches", "Right dome at anterior 6th rib / T8-T9", "Left dome ~1.5 cm lower than right", "Normal thickness not assessable", "Elevated dome → paralysis/herniation"] },
    { title: "CT Scan", items: ["Gold standard for diaphragm anatomy", "Thin-slice coronal/sagittal reconstructions", "Identify hernia content, defect size", "CECT for vascular trauma", "Used for surgical planning"] },
    { title: "Ultrasound", items: ["Bedside assessment – ICU use", "Measure excursion & thickness", "M-mode: diaphragm kinetics", "Diagnose paradoxical movement", "Guide phrenic nerve blocks"] },
    { title: "MRI", items: ["Superior soft-tissue contrast", "Assess diaphragmatic invasion (tumour)", "Dynamic MRI: respiratory motion", "No radiation – paediatric advantage", "DW-MRI for liver/diaphragm pathology"] },
  ];

  const bW = 2.2;
  const xs = [0.25, 2.55, 4.85, 7.15];
  modalities.forEach((m, i) => {
    s.addShape("rect", { x: xs[i], y: 1.28, w: bW, h: 0.38, fill: { color: C.headerBg } });
    s.addText(m.title, { x: xs[i], y: 1.28, w: bW, h: 0.38, fontSize: 12, bold: true,
      color: C.gold, fontFace: "Calibri", align: "center", valign: "middle" });
    s.addShape("rect", { x: xs[i], y: 1.66, w: bW, h: 1.75, fill: { color: C.lightBlue }, line: { color: C.accentBlue, pt: 1 } });
    s.addText(bulletList(m.items, { color: C.textDark, fontSize: 10.5 }), {
      x: xs[i] + 0.1, y: 1.7, w: bW - 0.2, h: 1.68, fontSize: 10.5,
      color: C.textDark, fontFace: "Calibri", valign: "top", margin: [2, 2, 2, 6],
    });
  });

  addImageWithBorder(s, "imaging", 0.25, 3.52, 4.5, 1.63, "CT sagittal: normal diaphragm anatomy");
  addImageWithBorder(s, "clinicalXray", 4.85, 3.52, 4.85, 1.63, "CT + CXR: diaphragmatic hernia diagnosis");
  addFooter(s);
}

// ════════════════════════════════════════════════════════════════════════
// SLIDE 15 – Conclusion & References
// ════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  s.background = { color: C.navyBg };
  s.addShape("rect", { x: 0, y: 0, w: 0.18, h: "100%", fill: { color: C.gold } });

  // Title
  s.addText("Conclusion & References", {
    x: 0.4, y: 0.15, w: 9.2, h: 0.65,
    fontSize: 26, bold: true, color: C.white, fontFace: "Calibri",
  });
  s.addShape("rect", { x: 0.4, y: 0.8, w: 9.2, h: 0.05, fill: { color: C.gold } });

  // Summary box left
  s.addShape("rect", { x: 0.3, y: 0.95, w: 5.5, h: 3.5, fill: { color: C.headerBg }, line: { color: C.gold, pt: 1.5 } });
  s.addText("Key Summary Points", { x: 0.38, y: 0.97, w: 5.3, h: 0.32,
    fontSize: 13, bold: true, color: C.gold, fontFace: "Calibri" });
  s.addText(bulletList([
    "Dome-shaped musculotendinous structure separating thorax & abdomen",
    "3 parts: sternal, costal, lumbar + central tendon (trifoliate)",
    "3 major openings: T8 (IVC), T10 (oesophagus), T12 (aorta)",
    "Sole motor innervation: phrenic nerve (C3,C4,C5)",
    "Blood supply: inferior phrenic aa. (dominant) + pericardiophrenic aa.",
    "Embryology: 4 components – septum transversum, pleuroperitoneal membranes, dorsal mesentery, body-wall muscle",
    "Primary muscle of respiration – 75% tidal volume",
    "Clinical: CDH (Bochdalek), hiatal hernia, eventration, phrenic palsy",
  ], { color: C.white, fontSize: 11 }), {
    x: 0.38, y: 1.3, w: 5.3, h: 3.1, fontSize: 11,
    color: C.white, fontFace: "Calibri", valign: "top", margin: [2, 2, 2, 6],
  });

  // References box right
  s.addShape("rect", { x: 5.95, y: 0.95, w: 3.75, h: 3.5, fill: { color: "0A1E3A" }, line: { color: C.gold, pt: 1.5 } });
  s.addText("📚 References", { x: 6.03, y: 0.97, w: 3.55, h: 0.32,
    fontSize: 13, bold: true, color: C.gold, fontFace: "Calibri" });
  s.addText([
    { text: "Gray's Anatomy, 42nd Ed.", options: { bold: true, color: C.gold, breakLine: true } },
    { text: "  Standring S. (Ed.) Elsevier, 2020\n", options: { color: C.white, fontSize: 10.5, breakLine: true } },
    { text: "Netter's Atlas of Human Anatomy, 7th Ed.", options: { bold: true, color: C.gold, breakLine: true } },
    { text: "  Frank H. Netter. Elsevier, 2019\n", options: { color: C.white, fontSize: 10.5, breakLine: true } },
    { text: "Snell's Clinical Anatomy by Regions, 10th Ed.", options: { bold: true, color: C.gold, breakLine: true } },
    { text: "  Richard Snell. Wolters Kluwer, 2019\n", options: { color: C.white, fontSize: 10.5, breakLine: true } },
    { text: "Clinical Anatomy by Moore & Dalley, 8th Ed.", options: { bold: true, color: C.gold, breakLine: true } },
    { text: "  Moore KL et al. Wolters Kluwer, 2018\n", options: { color: C.white, fontSize: 10.5, breakLine: true } },
    { text: "OpenStax Anatomy & Physiology (CC-BY 4.0)", options: { bold: false, color: C.lightBlue, fontSize: 10, breakLine: true } },
  ], { x: 6.03, y: 1.3, w: 3.55, h: 3.1, fontSize: 11, fontFace: "Calibri", valign: "top", margin: [2, 4, 2, 4] });

  // Thank you
  s.addText("🙏  THANK YOU", {
    x: 0.3, y: 4.6, w: 9.2, h: 0.5,
    fontSize: 22, bold: true, color: C.gold, fontFace: "Calibri", align: "center",
  });

  // Footer
  s.addShape("rect", { x: 0, y: 5.23, w: "100%", h: 0.4, fill: { color: C.headerBg } });
  s.addText("Made by Darshan Benke", {
    x: 0.3, y: 5.25, w: 9.4, h: 0.35,
    fontSize: 10, color: C.lightBlue, fontFace: "Calibri", align: "center", italic: true, valign: "middle",
  });
}

// ─── Write File ───────────────────────────────────────────────────────────────
const outputPath = "/home/daytona/workspace/diaphragm-anatomy/Diaphragm_Anatomy_MBBS.pptx";
pres.writeFile({ fileName: outputPath }).then(() => {
  console.log("✅  Presentation saved to:", outputPath);
}).catch(err => {
  console.error("❌  Error writing file:", err);
  process.exit(1);
});
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.