Generate a presentation covering X-ray tube components and function for exam

Reading File
Reading File
Reading File
Finding Sources
Finding Sources
Finding Sources
Reading File
Reading File
Loading Image
Finding Sources
Finding Sources
Running Command

ls -la /home/daytona/workspace/ 2>/dev/null || echo "workspace empty or doesn't …

Running Command

mkdir -p /home/daytona/workspace/xray-tube-pptx && echo "done"

Writing File

~/xray-tube-pptx/build.js

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

// Fetch the X-ray tube diagram from textbook
const imgData = JSON.parse(execSync(
  `node /home/daytona/skills/shared/scripts/fetch_images.js "https://cdn.orris.care/cdss_images/a36c8f17d2dec7736684023857ea143a29e19678e8db5d5147f4592eb832cb82.png"`
).toString());
const tubeImg = imgData[0].base64;

let pres = new pptxgen();
pres.layout = "LAYOUT_16x9";
pres.title = "X-Ray Tube: Components & Function";

// ─── Color palette ───────────────────────────────────────────────
const DARK  = "0D1B2A";   // deep navy (bg dominant)
const MID   = "1B3A5C";   // mid navy
const ACCENT= "00B4D8";   // sky blue accent
const GOLD  = "F4A261";   // warm gold
const WHITE = "FFFFFF";
const LGREY = "D0E8F2";   // light blue-grey text
const RED   = "E63946";   // highlight red

// ─── Helper: dark slide background ───────────────────────────────
function darkBg(slide) {
  slide.addShape(pres.ShapeType.rect, { x:0, y:0, w:10, h:5.625, fill:{color:DARK} });
}

// ─── Helper: accent bar across top ───────────────────────────────
function accentBar(slide, label) {
  slide.addShape(pres.ShapeType.rect, { x:0, y:0, w:10, h:0.55, fill:{color:ACCENT} });
  slide.addText(label, { x:0.3, y:0, w:9.4, h:0.55, fontSize:13, bold:true, color:DARK, valign:"middle", margin:0 });
}

// ─── Helper: section label pill ──────────────────────────────────
function pill(slide, txt, x, y, w) {
  slide.addShape(pres.ShapeType.roundRect, { x, y, w, h:0.32, fill:{color:ACCENT}, rectRadius:0.12 });
  slide.addText(txt, { x, y, w, h:0.32, fontSize:10, bold:true, color:DARK, align:"center", valign:"middle", margin:0 });
}

// ─── Helper: icon box ────────────────────────────────────────────
function iconBox(slide, icon, label, desc, x, y) {
  // box
  slide.addShape(pres.ShapeType.roundRect, { x, y, w:2.1, h:1.5, fill:{color:MID}, line:{color:ACCENT, width:1.2}, rectRadius:0.15 });
  // icon
  slide.addText(icon, { x, y:y+0.05, w:2.1, h:0.55, fontSize:22, align:"center", valign:"middle" });
  // label
  slide.addText(label, { x, y:y+0.58, w:2.1, h:0.3, fontSize:11, bold:true, color:ACCENT, align:"center", valign:"middle", margin:0 });
  // desc
  slide.addText(desc, { x:x+0.08, y:y+0.88, w:1.94, h:0.6, fontSize:8.5, color:LGREY, align:"center", valign:"top", wrap:true });
}

// ═══════════════════════════════════════════════════════════════
// SLIDE 1 — Title slide
// ═══════════════════════════════════════════════════════════════
{
  let s = pres.addSlide();
  darkBg(s);
  // Background gradient strip
  s.addShape(pres.ShapeType.rect, { x:0, y:3.5, w:10, h:2.125, fill:{color:MID} });
  s.addShape(pres.ShapeType.rect, { x:0, y:3.5, w:10, h:0.05, fill:{color:ACCENT} });

  // Main title
  s.addText("X-RAY TUBE", {
    x:0.5, y:0.7, w:9, h:1.4, fontSize:64, bold:true, color:WHITE,
    align:"center", charSpacing:8
  });
  // Subtitle
  s.addText("Components & Function", {
    x:0.5, y:2.1, w:9, h:0.6, fontSize:26, color:ACCENT,
    align:"center", charSpacing:2
  });
  // Tag line
  s.addText("Exam Preparation Guide  |  Diagnostic Radiology", {
    x:0.5, y:3.7, w:9, h:0.45, fontSize:13, color:LGREY,
    align:"center", italic:true
  });
  // Source
  s.addText("Source: Gray's Anatomy for Students", {
    x:0.5, y:5.1, w:9, h:0.35, fontSize:9, color:"6699AA", align:"center"
  });
}

// ═══════════════════════════════════════════════════════════════
// SLIDE 2 — Historical context + overview
// ═══════════════════════════════════════════════════════════════
{
  let s = pres.addSlide();
  darkBg(s);
  accentBar(s, "SLIDE 2  /  Historical Context & Overview");

  s.addText("From Roentgen to Modern Radiology", {
    x:0.4, y:0.65, w:9.2, h:0.5, fontSize:22, bold:true, color:WHITE
  });

  // Timeline strip
  const events = [
    { year:"1895", evt:"Roentgen discovers X-rays using cathode ray tube" },
    { year:"1913", evt:"Coolidge tube introduced — modern hot-cathode design" },
    { year:"1920s", evt:"Rotating anode developed to manage heat load" },
    { year:"Today", evt:"High-speed rotating anodes, digital detectors" },
  ];
  events.forEach((e, i) => {
    let x = 0.4 + i * 2.35;
    s.addShape(pres.ShapeType.rect, { x, y:1.25, w:2.1, h:0.38, fill:{color:ACCENT} });
    s.addText(e.year, { x, y:1.25, w:2.1, h:0.38, fontSize:13, bold:true, color:DARK, align:"center", valign:"middle" });
    s.addShape(pres.ShapeType.rect, { x:x+0.9, y:1.63, w:0.05, h:0.3, fill:{color:ACCENT} });
    s.addShape(pres.ShapeType.roundRect, { x, y:1.93, w:2.1, h:0.9, fill:{color:MID}, rectRadius:0.1 });
    s.addText(e.evt, { x:x+0.07, y:1.93, w:1.96, h:0.9, fontSize:8.5, color:LGREY, wrap:true, valign:"middle", align:"center" });
  });

  // Key concept box
  s.addShape(pres.ShapeType.roundRect, { x:0.4, y:3.05, w:9.2, h:2.3, fill:{color:MID}, line:{color:GOLD, width:1.5}, rectRadius:0.18 });
  s.addText("What is an X-Ray Tube?", { x:0.6, y:3.12, w:8.8, h:0.38, fontSize:14, bold:true, color:GOLD });
  const points = [
    "A vacuum-sealed glass envelope that converts electrical energy into X-radiation",
    "Contains two electrodes: the cathode (−) that emits electrons, and the anode (+) that receives them",
    "Only ~1% of kinetic electron energy converts to X-rays; the remaining 99% becomes heat",
    "Operates under high voltage (40–150 kV) to accelerate electrons across the tube",
  ];
  s.addText(points.map(p => ({ text: p, options: { bullet:{indent:15}, color:LGREY, breakLine:true } })),
    { x:0.6, y:3.52, w:8.8, h:1.75, fontSize:10.5, lineSpacingMultiple:1.3 }
  );
}

// ═══════════════════════════════════════════════════════════════
// SLIDE 3 — Tube Diagram (textbook image)
// ═══════════════════════════════════════════════════════════════
{
  let s = pres.addSlide();
  darkBg(s);
  accentBar(s, "SLIDE 3  /  X-Ray Tube Anatomy (Labeled Diagram)");

  // Textbook diagram
  s.addImage({ data: tubeImg, x:0.3, y:0.65, w:5.5, h:4.7 });

  // Labels panel
  s.addShape(pres.ShapeType.roundRect, { x:5.9, y:0.65, w:3.8, h:4.7, fill:{color:MID}, rectRadius:0.15 });
  s.addText("Key Components", { x:6.1, y:0.75, w:3.4, h:0.4, fontSize:14, bold:true, color:ACCENT });

  const comps = [
    { c:"Glass Envelope", d:"Vacuum-sealed; maintains low pressure for electron flow", col:WHITE },
    { c:"Cathode (−)", d:"Houses tungsten filament + focusing cup; source of electrons", col:ACCENT },
    { c:"Anode (+)", d:"Tungsten target on rotating disk; receives electrons, emits X-rays", col:GOLD },
    { c:"Focusing Cup", d:"Molybdenum cup that directs the electron beam onto the focal spot", col:WHITE },
    { c:"Tungsten Filament", d:"Heated wire; thermionic emission releases electrons", col:WHITE },
    { c:"Tungsten Target", d:"High Z, high melting point; X-rays produced here", col:WHITE },
  ];
  comps.forEach((c, i) => {
    let y = 1.22 + i * 0.67;
    s.addText(`• ${c.c}`, { x:6.1, y, w:3.4, h:0.28, fontSize:10.5, bold:true, color:c.col, margin:0 });
    s.addText(c.d, { x:6.2, y:y+0.26, w:3.3, h:0.36, fontSize:8.5, color:LGREY, wrap:true, margin:0 });
  });

  s.addText("Gray's Anatomy for Students, Fig. 1.2", {
    x:0.3, y:5.3, w:5.5, h:0.25, fontSize:8, color:"6699AA", italic:true, align:"center"
  });
}

// ═══════════════════════════════════════════════════════════════
// SLIDE 4 — Cathode in detail
// ═══════════════════════════════════════════════════════════════
{
  let s = pres.addSlide();
  darkBg(s);
  accentBar(s, "SLIDE 4  /  The Cathode — Electron Source");

  s.addText("Cathode (Negative Electrode)", {
    x:0.4, y:0.65, w:9.2, h:0.45, fontSize:20, bold:true, color:ACCENT
  });

  // Left column
  s.addShape(pres.ShapeType.roundRect, { x:0.4, y:1.18, w:4.5, h:4.1, fill:{color:MID}, rectRadius:0.15 });
  s.addText("Structure", { x:0.6, y:1.28, w:4.1, h:0.34, fontSize:13, bold:true, color:GOLD });
  const struct = [
    ["Tungsten Filament", "Coiled wire, ~2,000°C operating temperature"],
    ["Focusing Cup", "Molybdenum cup surrounds filament to shape electron beam"],
    ["Filament Size", "Small filament → small focal spot → better image sharpness"],
    ["Dual Filament", "Some tubes have large + small filament for different applications"],
  ];
  struct.forEach(([title, desc], i) => {
    s.addText(title, { x:0.6, y:1.68 + i*0.8, w:4.1, h:0.28, fontSize:10.5, bold:true, color:WHITE, margin:0 });
    s.addText(desc, { x:0.6, y:1.96 + i*0.8, w:4.1, h:0.46, fontSize:9, color:LGREY, wrap:true, margin:0 });
  });

  // Right column
  s.addShape(pres.ShapeType.roundRect, { x:5.1, y:1.18, w:4.5, h:4.1, fill:{color:MID}, rectRadius:0.15 });
  s.addText("Thermionic Emission", { x:5.3, y:1.28, w:4.1, h:0.34, fontSize:13, bold:true, color:GOLD });
  s.addText([
    { text: "When the filament is heated by passing an electric current through it, electrons gain enough energy to escape the metal surface — this is thermionic emission.\n\n", options:{color:LGREY} },
    { text: "Filament Current → Heat → Electron Cloud (Space Charge)\n\n", options:{color:WHITE, bold:true} },
    { text: "Key relationships:\n", options:{color:LGREY} },
    { text: "• mA (tube current) ", options:{color:ACCENT, bold:true} },
    { text: "controls the NUMBER of electrons → determines X-ray quantity (dose)\n", options:{color:LGREY} },
    { text: "• kV (tube voltage) ", options:{color:GOLD, bold:true} },
    { text: "controls the SPEED of electrons → determines X-ray energy (penetration/quality)\n\n", options:{color:LGREY} },
    { text: "Exam tip: ", options:{color:RED, bold:true} },
    { text: "mA × time = mAs = total exposure / dose", options:{color:WHITE} },
  ], { x:5.3, y:1.68, w:4.1, h:3.5, fontSize:9.5, lineSpacingMultiple:1.35, wrap:true });
}

// ═══════════════════════════════════════════════════════════════
// SLIDE 5 — Anode in detail
// ═══════════════════════════════════════════════════════════════
{
  let s = pres.addSlide();
  darkBg(s);
  accentBar(s, "SLIDE 5  /  The Anode — X-Ray Production Site");

  s.addText("Anode (Positive Electrode)", {
    x:0.4, y:0.65, w:9.2, h:0.45, fontSize:20, bold:true, color:GOLD
  });

  // Stationary vs Rotating
  const cols = [
    {
      title: "Stationary Anode",
      color: LGREY,
      items: [
        "Used in dental / low-power units",
        "Tungsten block embedded in copper",
        "Copper conducts heat away",
        "Limited heat dissipation → suitable for low output only",
        "Target angle: 15–20°",
      ]
    },
    {
      title: "Rotating Anode ★",
      color: ACCENT,
      items: [
        "Used in diagnostic radiology",
        "Tungsten-rhenium disk spins at 3,000–10,000 RPM",
        "Distributes heat over a large target area (annular track)",
        "Allows higher mA + shorter exposure times",
        "Anode heat capacity = major design limiting factor",
      ]
    }
  ];
  cols.forEach((col, ci) => {
    let x = 0.4 + ci*5.0;
    s.addShape(pres.ShapeType.roundRect, { x, y:1.18, w:4.6, h:2.3, fill:{color:MID}, line:{color:col.color, width:1.2}, rectRadius:0.15 });
    s.addText(col.title, { x:x+0.2, y:1.25, w:4.2, h:0.38, fontSize:13, bold:true, color:col.color });
    s.addText(col.items.map(t => ({ text:t, options:{bullet:{indent:12}, color:LGREY, breakLine:true} })),
      { x:x+0.2, y:1.63, w:4.2, h:1.8, fontSize:9, lineSpacingMultiple:1.3 });
  });

  // Tungsten properties box
  s.addShape(pres.ShapeType.roundRect, { x:0.4, y:3.65, w:9.2, h:1.7, fill:{color:MID}, line:{color:GOLD, width:1.2}, rectRadius:0.15 });
  s.addText("Why Tungsten (W) as Target Material?", { x:0.6, y:3.73, w:8.8, h:0.35, fontSize:13, bold:true, color:GOLD });
  const tungsten = [
    "High atomic number (Z = 74) → efficient X-ray production (Bremsstrahlung + characteristic radiation)",
    "Very high melting point (3,422°C) → withstands intense heat at focal spot",
    "High thermal conductivity → dissipates heat rapidly to the anode disc",
    "Rhenium (3–10%) added to improve ductility and resistance to surface cracking",
  ];
  s.addText(tungsten.map(t => ({ text:t, options:{bullet:{indent:12}, color:LGREY, breakLine:true} })),
    { x:0.6, y:4.1, w:8.8, h:1.2, fontSize:9.5, lineSpacingMultiple:1.3 });
}

// ═══════════════════════════════════════════════════════════════
// SLIDE 6 — X-Ray Production Mechanisms
// ═══════════════════════════════════════════════════════════════
{
  let s = pres.addSlide();
  darkBg(s);
  accentBar(s, "SLIDE 6  /  Mechanisms of X-Ray Production");

  s.addText("Two Types of X-Radiation Produced", {
    x:0.4, y:0.65, w:9.2, h:0.45, fontSize:20, bold:true, color:WHITE
  });

  // Bremsstrahlung
  s.addShape(pres.ShapeType.roundRect, { x:0.4, y:1.2, w:4.5, h:4.15, fill:{color:MID}, line:{color:ACCENT, width:1.5}, rectRadius:0.15 });
  pill(s, "80–90% of X-Ray Output", 0.7, 1.22, 3.9);
  s.addText("Bremsstrahlung\n(Braking Radiation)", { x:0.6, y:1.58, w:4.1, h:0.6, fontSize:15, bold:true, color:ACCENT, align:"center" });
  s.addText([
    { text: "German: ", options:{color:LGREY} },
    { text: '"braking radiation"\n\n', options:{color:WHITE, italic:true} },
    { text: "Mechanism: ", options:{color:ACCENT, bold:true} },
    { text: "Electrons decelerate when they pass close to the positive tungsten nucleus. The kinetic energy lost is emitted as an X-ray photon.\n\n", options:{color:LGREY} },
    { text: "Key Features:\n", options:{color:WHITE, bold:true} },
    { text: "• Continuous spectrum of photon energies\n• Max photon energy = max kV applied\n• Majority of clinically useful X-rays\n• Occurs for all Z > 1 target materials", options:{color:LGREY} },
  ], { x:0.6, y:2.18, w:4.1, h:3.1, fontSize:9.5, lineSpacingMultiple:1.35, wrap:true });

  // Characteristic
  s.addShape(pres.ShapeType.roundRect, { x:5.1, y:1.2, w:4.5, h:4.15, fill:{color:MID}, line:{color:GOLD, width:1.5}, rectRadius:0.15 });
  pill(s, "10–20% of X-Ray Output", 5.4, 1.22, 3.9);
  s.addText("Characteristic\nRadiation", { x:5.3, y:1.58, w:4.1, h:0.6, fontSize:15, bold:true, color:GOLD, align:"center" });
  s.addText([
    { text: "Mechanism: ", options:{color:GOLD, bold:true} },
    { text: "Incoming electron ejects an inner-shell electron from tungsten. An outer-shell electron drops in to fill the vacancy, releasing a photon of characteristic energy.\n\n", options:{color:LGREY} },
    { text: "Key Features:\n", options:{color:WHITE, bold:true} },
    { text: "• Discrete (line) spectrum — fixed energies\n• Specific to target material (tungsten: K-shell ~59–69 keV)\n• Only produced above threshold kV (~70 kV for tungsten K-shell)\n• Adds useful peaks to the X-ray spectrum", options:{color:LGREY} },
  ], { x:5.3, y:2.18, w:4.1, h:3.1, fontSize:9.5, lineSpacingMultiple:1.35, wrap:true });
}

// ═══════════════════════════════════════════════════════════════
// SLIDE 7 — Vacuum Envelope & Tube Housing
// ═══════════════════════════════════════════════════════════════
{
  let s = pres.addSlide();
  darkBg(s);
  accentBar(s, "SLIDE 7  /  Vacuum Envelope, Housing & Beam Collimation");

  s.addText("The Complete X-Ray Tube Assembly", {
    x:0.4, y:0.65, w:9.2, h:0.45, fontSize:20, bold:true, color:WHITE
  });

  const boxes = [
    {
      title:"Glass / Metal Envelope",
      icon:"💡",
      col:ACCENT,
      points:[
        "Evacuated to high vacuum (<10⁻⁶ mmHg)",
        "Prevents electron scattering by air molecules",
        "Borosilicate glass or metal-ceramic construction",
        "Insert windows allow X-ray beam exit",
      ]
    },
    {
      title:"Tube Housing",
      icon:"🔒",
      col:GOLD,
      points:[
        "Lead-lined metal casing surrounds glass envelope",
        "Absorbs leakage radiation (must be <1 mGy/hr at 1 m)",
        "Oil-filled for heat dissipation and electrical insulation",
        "Port (window) aligned with useful beam",
      ]
    },
    {
      title:"Beam Collimation",
      icon:"🎯",
      col:LGREY,
      points:[
        "Lead-lined shutters (collimators) narrow the beam",
        "Limit irradiated area to region of interest",
        "Reduce patient dose and image scatter",
        "Light beam localizer shows field before exposure",
      ]
    },
  ];

  boxes.forEach((b, i) => {
    let y = 1.2 + i * 1.43;
    s.addShape(pres.ShapeType.roundRect, { x:0.4, y, w:9.2, h:1.35, fill:{color:MID}, line:{color:b.col, width:1}, rectRadius:0.12 });
    s.addText(b.icon + "  " + b.title, { x:0.6, y:y+0.05, w:4, h:0.38, fontSize:12, bold:true, color:b.col });
    s.addText(b.points.map(p => ({ text:p, options:{bullet:{indent:12}, color:LGREY, breakLine:true} })),
      { x:0.6, y:y+0.43, w:8.8, h:0.88, fontSize:9, lineSpacingMultiple:1.2 });
  });

  // Heat note
  s.addShape(pres.ShapeType.roundRect, { x:0.4, y:5.18, w:9.2, h:0.32, fill:{color:RED}, rectRadius:0.1 });
  s.addText("⚠ Heat Capacity Alert: Only ~1% of energy → X-rays; 99% → heat. Anode cooling is the primary design constraint for high-powered tubes.", {
    x:0.5, y:5.18, w:9.0, h:0.32, fontSize:9, bold:true, color:WHITE, valign:"middle", align:"center"
  });
}

// ═══════════════════════════════════════════════════════════════
// SLIDE 8 — Exposure Parameters (kV, mA, mAs)
// ═══════════════════════════════════════════════════════════════
{
  let s = pres.addSlide();
  darkBg(s);
  accentBar(s, "SLIDE 8  /  Exposure Parameters — kV, mA & mAs");

  s.addText("Controlling X-Ray Output", {
    x:0.4, y:0.65, w:9.2, h:0.45, fontSize:20, bold:true, color:WHITE
  });

  // Table header
  const tCols = [1.5, 3.0, 2.5, 2.0];
  const headers = ["Parameter", "Controls", "Effect on Image", "Effect on Dose"];
  let hx = 0.3;
  headers.forEach((h, i) => {
    s.addShape(pres.ShapeType.rect, { x:hx, y:1.18, w:tCols[i], h:0.38, fill:{color:ACCENT} });
    s.addText(h, { x:hx, y:1.18, w:tCols[i], h:0.38, fontSize:10, bold:true, color:DARK, align:"center", valign:"middle" });
    hx += tCols[i];
  });

  const rows = [
    ["kV (kilovoltage)", "Electron speed → X-ray energy (quality)", "↑ kV → more penetration, less contrast", "↑ kV → slightly ↑ dose"],
    ["mA (tube current)", "Number of electrons → X-ray quantity", "↑ mA → brighter image (more photons)", "↑ mA → ↑ dose proportionally"],
    ["mAs (= mA × s)", "Total exposure charge", "Determines overall image density/exposure", "↑ mAs → ↑ dose proportionally"],
    ["Exposure time (s)", "Duration of X-ray production", "↑ time → risk of motion blur", "↑ time → ↑ dose proportionally"],
  ];
  rows.forEach((row, ri) => {
    let rx = 0.3;
    let bg = ri % 2 === 0 ? MID : "142D4A";
    row.forEach((cell, ci) => {
      s.addShape(pres.ShapeType.rect, { x:rx, y:1.56+ri*0.55, w:tCols[ci], h:0.55, fill:{color:bg} });
      s.addText(cell, { x:rx+0.05, y:1.56+ri*0.55, w:tCols[ci]-0.1, h:0.55, fontSize:9, color:ci===0?GOLD:LGREY, wrap:true, valign:"middle" });
      rx += tCols[ci];
    });
  });

  // Heel effect note
  s.addShape(pres.ShapeType.roundRect, { x:0.4, y:3.88, w:9.2, h:1.5, fill:{color:MID}, line:{color:ACCENT, width:1}, rectRadius:0.12 });
  s.addText("Heel Effect", { x:0.6, y:3.96, w:8.8, h:0.34, fontSize:13, bold:true, color:ACCENT });
  s.addText([
    { text: "X-ray intensity is NOT uniform across the beam. The anode side of the beam is less intense than the cathode side because X-rays produced within the anode are partially absorbed by the anode material (self-filtration).\n\n", options:{color:LGREY} },
    { text: "Clinical use: ", options:{color:GOLD, bold:true} },
    { text: "Place the thicker/denser body part under the cathode end (higher intensity) for more uniform film density — e.g., femur imaging.", options:{color:LGREY} },
  ], { x:0.6, y:4.3, w:8.8, h:1.0, fontSize:9.5, lineSpacingMultiple:1.3, wrap:true });
}

// ═══════════════════════════════════════════════════════════════
// SLIDE 9 — Focal Spot & Geometric Factors
// ═══════════════════════════════════════════════════════════════
{
  let s = pres.addSlide();
  darkBg(s);
  accentBar(s, "SLIDE 9  /  Focal Spot, Geometry & Image Quality");

  s.addText("Focal Spot & Geometric Unsharpness", {
    x:0.4, y:0.65, w:9.2, h:0.45, fontSize:20, bold:true, color:WHITE
  });

  // Left: focal spot box
  s.addShape(pres.ShapeType.roundRect, { x:0.4, y:1.18, w:4.5, h:4.15, fill:{color:MID}, rectRadius:0.15, line:{color:ACCENT, width:1} });
  s.addText("Focal Spot", { x:0.6, y:1.26, w:4.1, h:0.36, fontSize:14, bold:true, color:ACCENT });

  s.addText([
    { text: "Actual focal spot: ", options:{color:WHITE, bold:true} },
    { text: "Area on anode where electrons hit (real)\n\n", options:{color:LGREY} },
    { text: "Effective focal spot: ", options:{color:ACCENT, bold:true} },
    { text: "Projected area seen from the film/detector (apparent) — smaller due to anode angle\n\n", options:{color:LGREY} },
    { text: "Line Focus Principle:\n", options:{color:GOLD, bold:true} },
    { text: "Angling the anode face (10–20°) makes the effective focal spot much smaller than the actual focal spot → improved resolution without overloading one tiny area\n\n", options:{color:LGREY} },
    { text: "Focal spot sizes:\n", options:{color:WHITE, bold:true} },
    { text: "• Small (0.1–0.6 mm): magnification views, fine detail\n• Large (0.6–1.2 mm): routine work, tolerates higher mA\n", options:{color:LGREY} },
  ], { x:0.6, y:1.65, w:4.1, h:3.5, fontSize:9.5, lineSpacingMultiple:1.35, wrap:true });

  // Right: geometry factors
  s.addShape(pres.ShapeType.roundRect, { x:5.1, y:1.18, w:4.5, h:4.15, fill:{color:MID}, rectRadius:0.15, line:{color:GOLD, width:1} });
  s.addText("Geometric Factors", { x:5.3, y:1.26, w:4.1, h:0.36, fontSize:14, bold:true, color:GOLD });

  const gfactors = [
    ["Source-to-Image Distance (SID)", "↑ SID → less magnification, less unsharpness. Standard: 100 cm for chest PA"],
    ["Object-to-Image Distance (OID)", "↓ OID → less magnification, sharper image. Keep receptor close to patient"],
    ["Focal Spot Size", "Smaller focal spot → less geometric unsharpness → sharper image"],
    ["Penumbra / Unsharpness", "Geometric unsharpness ∝ focal spot size × OID / (SID − OID)"],
  ];
  gfactors.forEach(([title, desc], i) => {
    s.addText(title, { x:5.3, y:1.68+i*0.9, w:4.1, h:0.3, fontSize:10.5, bold:true, color:ACCENT, margin:0 });
    s.addText(desc, { x:5.3, y:1.98+i*0.9, w:4.1, h:0.55, fontSize:9, color:LGREY, wrap:true, margin:0 });
  });
}

// ═══════════════════════════════════════════════════════════════
// SLIDE 10 — Radiation Quality & Filtration
// ═══════════════════════════════════════════════════════════════
{
  let s = pres.addSlide();
  darkBg(s);
  accentBar(s, "SLIDE 10  /  Beam Quality, Filtration & HVL");

  s.addText("Beam Quality & Radiation Filtration", {
    x:0.4, y:0.65, w:9.2, h:0.45, fontSize:20, bold:true, color:WHITE
  });

  // Filtration section
  s.addShape(pres.ShapeType.roundRect, { x:0.4, y:1.18, w:9.2, h:2.05, fill:{color:MID}, rectRadius:0.15, line:{color:ACCENT, width:1} });
  s.addText("Beam Filtration", { x:0.6, y:1.26, w:8.8, h:0.34, fontSize:13, bold:true, color:ACCENT });

  const filts = [
    { t:"Inherent Filtration", d:"Glass wall of the tube + insulating oil + exit window. Equivalent ~0.5–1.0 mm Al. Removes the lowest-energy (soft) X-rays.", col:LGREY },
    { t:"Added Filtration", d:"Aluminium (Al) or copper (Cu) sheets placed in the beam path. Required by law: total ≥2.5 mm Al equivalent for >70 kV tubes.", col:LGREY },
    { t:"Total Filtration", d:"Inherent + Added. Removes low-energy photons that only irradiate skin without contributing to the diagnostic image.", col:WHITE },
  ];
  filts.forEach((f, i) => {
    let x = 0.6 + i * 3.0;
    s.addText(f.t, { x, y:1.63, w:2.8, h:0.28, fontSize:10, bold:true, color:GOLD, margin:0 });
    s.addText(f.d, { x, y:1.91, w:2.8, h:1.25, fontSize:8.5, color:f.col, wrap:true, margin:0 });
  });

  // HVL section
  s.addShape(pres.ShapeType.roundRect, { x:0.4, y:3.32, w:4.5, h:2.0, fill:{color:MID}, rectRadius:0.12, line:{color:GOLD, width:1} });
  s.addText("Half-Value Layer (HVL)", { x:0.6, y:3.4, w:4.1, h:0.34, fontSize:13, bold:true, color:GOLD });
  s.addText([
    { text: "The thickness of material needed to reduce beam intensity by 50%.\n\n", options:{color:LGREY} },
    { text: "↑ HVL = harder (more penetrating) beam\n", options:{color:WHITE} },
    { text: "↓ HVL = softer beam (more absorbed)\n\n", options:{color:WHITE} },
    { text: "Clinical: HVL is used to measure beam quality and ensure adequate filtration.", options:{color:LGREY} },
  ], { x:0.6, y:3.76, w:4.1, h:1.5, fontSize:9.5, lineSpacingMultiple:1.35, wrap:true });

  // X-ray spectrum
  s.addShape(pres.ShapeType.roundRect, { x:5.1, y:3.32, w:4.5, h:2.0, fill:{color:MID}, rectRadius:0.12, line:{color:ACCENT, width:1} });
  s.addText("X-Ray Spectrum Summary", { x:5.3, y:3.4, w:4.1, h:0.34, fontSize:13, bold:true, color:ACCENT });
  s.addText([
    { text: "• Continuous (Bremsstrahlung) + discrete peaks (characteristic)\n", options:{color:LGREY} },
    { text: "• Max photon energy (keV) = kVp numerically\n", options:{color:LGREY} },
    { text: "• Mean photon energy ≈ 1/3 kVp\n", options:{color:LGREY} },
    { text: "• Filtration shifts spectrum toward higher energies\n", options:{color:LGREY} },
    { text: "• ↑ kVp broadens & shifts spectrum rightward\n", options:{color:LGREY} },
  ], { x:5.3, y:3.76, w:4.1, h:1.5, fontSize:9.5, lineSpacingMultiple:1.35, wrap:true });
}

// ═══════════════════════════════════════════════════════════════
// SLIDE 11 — Clinical Applications & Modalities
// ═══════════════════════════════════════════════════════════════
{
  let s = pres.addSlide();
  darkBg(s);
  accentBar(s, "SLIDE 11  /  Clinical Applications & Related Modalities");

  s.addText("X-Ray Tube in Clinical Practice", {
    x:0.4, y:0.65, w:9.2, h:0.45, fontSize:20, bold:true, color:WHITE
  });

  const mods = [
    { icon:"🦷", name:"Plain Radiography", kv:"40–120 kV", use:"Chest, bone, abdomen. Static image. Standard imaging workhorse.", col:ACCENT },
    { icon:"🔬", name:"Fluoroscopy", kv:"70–120 kV", use:"Real-time continuous X-ray. Barium studies, angiography, orthopaedic guidance.", col:GOLD },
    { icon:"🫀", name:"Cardiac Cath / Angio", kv:"60–90 kV", use:"High-speed rotating anode. Short exposures (3–6 ms) to freeze cardiac motion.", col:RED },
    { icon:"🧠", name:"CT Scanner", kv:"80–140 kV", use:"X-ray tube rotates around patient. Slip-ring technology. Continuous rotation.", col:WHITE },
    { icon:"🦷", name:"Mammography", kv:"25–35 kV", use:"Low kV, molybdenum/rhodium target for soft-tissue contrast (breast tissue).", col:LGREY },
    { icon:"🦴", name:"Fluoroscopy (Ortho)", kv:"70–120 kV", use:"Image intensifier tube converts X-rays → light → electrons → bright image.", col:ACCENT },
  ];

  mods.forEach((m, i) => {
    let col = i % 3;
    let row = Math.floor(i / 3);
    let x = 0.4 + col * 3.15;
    let y = 1.2 + row * 1.9;
    s.addShape(pres.ShapeType.roundRect, { x, y, w:3.0, h:1.8, fill:{color:MID}, line:{color:m.col, width:1}, rectRadius:0.14 });
    s.addText(m.icon + "  " + m.name, { x:x+0.12, y:y+0.08, w:2.8, h:0.36, fontSize:11, bold:true, color:m.col });
    s.addText("kV: " + m.kv, { x:x+0.12, y:y+0.44, w:2.8, h:0.26, fontSize:9, bold:true, color:GOLD });
    s.addText(m.use, { x:x+0.12, y:y+0.7, w:2.76, h:1.0, fontSize:8.5, color:LGREY, wrap:true });
  });
}

// ═══════════════════════════════════════════════════════════════
// SLIDE 12 — Exam Summary / Cheat Sheet
// ═══════════════════════════════════════════════════════════════
{
  let s = pres.addSlide();
  darkBg(s);
  s.addShape(pres.ShapeType.rect, { x:0, y:0, w:10, h:0.55, fill:{color:RED} });
  s.addText("EXAM CHEAT SHEET — X-Ray Tube", {
    x:0.3, y:0, w:9.4, h:0.55, fontSize:15, bold:true, color:WHITE, valign:"middle", charSpacing:2, margin:0
  });

  const cols = [
    {
      title:"Component → Function",
      color:ACCENT,
      items:[
        "Cathode = negative electrode; emits electrons via thermionic emission",
        "Tungsten filament = heated to 2000°C; releases electrons",
        "Focusing cup = shapes electron beam onto focal spot",
        "Anode = positive electrode; receives electrons; X-rays produced",
        "Rotating anode = distributes heat; allows high mA",
        "Tungsten target = high Z + high melting point",
        "Glass envelope = maintains vacuum for electron flow",
      ]
    },
    {
      title:"Key Equations & Facts",
      color:GOLD,
      items:[
        "mAs = mA × time → determines dose",
        "kVp → X-ray energy (penetration / quality)",
        "Max photon energy (keV) = kVp",
        "Mean photon energy ≈ kVp / 3",
        "1% electrical energy → X-rays; 99% → heat",
        "HVL: thickness reducing intensity by 50%",
        "Total filtration ≥ 2.5 mm Al equivalent (>70 kV)",
      ]
    },
    {
      title:"Common Exam Traps",
      color:RED,
      items:[
        "Bremsstrahlung = continuous spectrum (NOT discrete)",
        "Characteristic = discrete spectrum; needs threshold kV",
        "Heel effect: cathode side = more intense than anode",
        "↑ SID improves sharpness (less magnification)",
        "Small focal spot = better resolution but less heat tolerance",
        "Rotating anode spins at 3,000–10,000 RPM",
        "Line focus principle: angled anode → smaller effective focal spot",
      ]
    },
  ];

  cols.forEach((col, ci) => {
    let x = 0.3 + ci * 3.25;
    s.addShape(pres.ShapeType.roundRect, { x, y:0.62, w:3.15, h:4.95, fill:{color:MID}, rectRadius:0.13 });
    s.addShape(pres.ShapeType.rect, { x, y:0.62, w:3.15, h:0.36, fill:{color:col.color} });
    s.addText(col.title, { x:x+0.08, y:0.62, w:2.99, h:0.36, fontSize:9.5, bold:true, color:DARK, valign:"middle", margin:0 });
    s.addText(col.items.map(t => ({ text:t, options:{bullet:{indent:10}, color:LGREY, breakLine:true} })),
      { x:x+0.1, y:1.0, w:2.95, h:4.5, fontSize:8.5, lineSpacingMultiple:1.35 });
  });
}

// ─── Write file ──────────────────────────────────────────────
pres.writeFile({ fileName: "/home/daytona/workspace/xray-tube-pptx/XRay_Tube_Components_Function.pptx" })
  .then(() => console.log("DONE"))
  .catch(e => { console.error(e); process.exit(1); });
Running Command

cd /home/daytona/workspace/xray-tube-pptx && node build.js 2>&1

Running Command

ls -lh /home/daytona/workspace/xray-tube-pptx/XRay_Tube_Components_Function.pptx

Your presentation is ready. Here's a summary of what's inside:

X-Ray Tube: Components & Function - Exam Presentation

12 slides | Dark navy/blue design with color-coded sections | Sourced from Gray's Anatomy for Students & Fuster's The Heart

XRay Tube Components Function

Presentation · PPTX


Slide-by-Slide Breakdown

SlideTopic
1Title slide
2Historical context (1895 Roentgen → modern) + What is an X-ray tube?
3Labeled diagram (textbook image from Gray's Anatomy) + component glossary
4Cathode in detail - filament, focusing cup, thermionic emission, mA vs kV
5Anode in detail - stationary vs rotating, tungsten properties
6X-ray production - Bremsstrahlung vs Characteristic radiation
7Vacuum envelope, housing, beam collimation, heat warning
8Exposure parameters (kV, mA, mAs) + Heel Effect
9Focal spot, line focus principle, geometric factors (SID/OID)
10Beam filtration (inherent/added), HVL, X-ray spectrum
11Clinical applications (plain film, fluoroscopy, cardiac cath, CT, mammography)
12Exam Cheat Sheet - components, key equations, and common exam traps
The cheat sheet on slide 12 covers the most-tested points: cathode/anode roles, 99% energy as heat, mAs formula, HVL definition, heel effect, focal spot principles, and the difference between Bremsstrahlung (continuous) vs Characteristic (discrete) radiation.
This is a shared conversation. Sign in to Orris to start your own chat.