Femur bone anatomy detail notes slide

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

ls /home/daytona/workspace/ 2>/dev/null || echo "workspace empty"

Running Command

mkdir -p /home/daytona/workspace/femur-anatomy && ls /home/daytona/workspace/fem…

Writing File

~/femur-anatomy/build.js

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

// Fetch images as base64
const imageUrls = [
  "https://cdn.orris.care/cdss_images/33bb93211c375763f18a8869cd47af110a614e8375bd5d77caf7051d95ea7528.png",  // proximal femur labeled
  "https://cdn.orris.care/cdss_images/6b95e6dce583049d98c3acf695615756b8de3c7b4586fd8bfcf72c4f6ab6f38e.png",  // hip joint
  "https://cdn.orris.care/cdss_images/4e60f401560046e93f0a4c1920ce39c578f3c19d992d6292fcfb54dda6cf70f6.png",  // ligaments
  "https://cdn.orris.care/cdss_images/c22999d20c2a123a85cd6b090c58e9a257cf4c33ba4cd69639ee74a4b2e0472a.png",  // head neck trochanter
];

let images = [];
try {
  images = JSON.parse(
    execSync(
      `node /home/daytona/skills/shared/scripts/fetch_images.js ${imageUrls.map(u => `"${u}"`).join(" ")}`
    ).toString()
  );
} catch(e) {
  console.error("Image fetch error:", e.message);
  images = imageUrls.map(u => ({ url: u, base64: null, error: e.message }));
}

const pres = new pptxgen();
pres.layout = "LAYOUT_16x9";
pres.title = "Femur Bone Anatomy";
pres.author = "Medical Education";

// ─── COLOR PALETTE ───────────────────────────────────────────────────────────
const DARK_BG   = "1A2340";   // deep navy
const MID_BG    = "22304F";   // slightly lighter navy for section slides
const GOLD      = "C9A84C";   // bone/gold accent
const WHITE     = "FFFFFF";
const LIGHT_BLU = "A8C8F0";
const TEAL      = "4FC3C3";
const PALE      = "E8F0FB";   // card backgrounds

// ─── HELPER FUNCTIONS ────────────────────────────────────────────────────────
function sectionBanner(slide, topColor) {
  slide.addShape(pres.ShapeType.rect, {
    x: 0, y: 0, w: 10, h: 1.0,
    fill: { color: GOLD },
    line: { color: GOLD }
  });
}

function bottomBar(slide) {
  slide.addShape(pres.ShapeType.rect, {
    x: 0, y: 5.3, w: 10, h: 0.325,
    fill: { color: GOLD },
    line: { color: GOLD }
  });
  slide.addText("Femur Bone Anatomy  |  Medical Education", {
    x: 0.2, y: 5.3, w: 9.6, h: 0.325,
    fontSize: 9, color: DARK_BG, bold: false, valign: "middle", align: "right", margin: 0
  });
}

// ═══════════════════════════════════════════════════════════════════════════════
// SLIDE 1 — TITLE
// ═══════════════════════════════════════════════════════════════════════════════
{
  const slide = pres.addSlide();
  slide.background = { color: DARK_BG };

  // Diagonal accent shape
  slide.addShape(pres.ShapeType.rect, {
    x: 6.8, y: 0, w: 3.2, h: 5.625,
    fill: { color: MID_BG },
    line: { color: MID_BG }
  });

  // Gold vertical stripe
  slide.addShape(pres.ShapeType.rect, {
    x: 6.7, y: 0, w: 0.12, h: 5.625,
    fill: { color: GOLD },
    line: { color: GOLD }
  });

  // Title text
  slide.addText("FEMUR", {
    x: 0.5, y: 0.7, w: 6.0, h: 1.0,
    fontSize: 64, fontFace: "Arial", bold: true,
    color: GOLD, align: "left", margin: 0, charSpacing: 8
  });
  slide.addText("BONE ANATOMY", {
    x: 0.5, y: 1.65, w: 6.0, h: 0.65,
    fontSize: 28, fontFace: "Arial", bold: false,
    color: WHITE, align: "left", margin: 0, charSpacing: 4
  });

  // Subtitle line
  slide.addShape(pres.ShapeType.rect, {
    x: 0.5, y: 2.45, w: 4.0, h: 0.04,
    fill: { color: GOLD }, line: { color: GOLD }
  });

  slide.addText("Detail Notes", {
    x: 0.5, y: 2.6, w: 5.5, h: 0.45,
    fontSize: 18, color: LIGHT_BLU, italic: true, align: "left", margin: 0
  });

  // Overview bullets
  slide.addText([
    { text: "Longest & strongest bone in the body", options: { bullet: true, breakLine: true } },
    { text: "Components: Head · Neck · Shaft · Condyles", options: { bullet: true, breakLine: true } },
    { text: "Proximal = cancellous; Shaft = cortical bone", options: { bullet: true, breakLine: true } },
    { text: "Carries full body weight to the lower limb", options: { bullet: true } }
  ], {
    x: 0.5, y: 3.2, w: 6.0, h: 1.8,
    fontSize: 13, color: PALE, lineSpacingMultiple: 1.4
  });

  // Side image if available
  if (images[0] && !images[0].error) {
    slide.addImage({ data: images[0].base64, x: 7.0, y: 0.3, w: 2.7, h: 5.0, sizing: { type: "contain", w: 2.7, h: 5.0 } });
  }

  bottomBar(slide);
}

// ═══════════════════════════════════════════════════════════════════════════════
// SLIDE 2 — OVERVIEW & GENERAL FEATURES
// ═══════════════════════════════════════════════════════════════════════════════
{
  const slide = pres.addSlide();
  slide.background = { color: DARK_BG };

  sectionBanner(slide, GOLD);
  slide.addText("GENERAL FEATURES", {
    x: 0.4, y: 0.08, w: 9.2, h: 0.82,
    fontSize: 22, bold: true, color: DARK_BG, valign: "middle", margin: 0
  });

  // Left content
  const items = [
    ["Classification", "Long bone; largest & strongest in body"],
    ["Length", "Approx. 45 cm in adults (¼ of body height)"],
    ["Orientation", "Oblique shaft — brings knee under body CoG"],
    ["Cross-section (mid-shaft)", "Triangular: medial, lateral & posterior surfaces"],
    ["Bone type", "Cancellous at head/neck/intertrochanteric; cortical at shaft; widens at distal metaphysis"],
    ["Articulations", "Proximal: hip joint (acetabulum)  |  Distal: knee joint (tibia + patella)"],
    ["Angle of Inclination", "Neck-shaft angle ≈ 125° in adults (coxa valga >135°, vara <120°)"],
    ["Angle of Anteversion", "Normal ≈ 10–15° anterior tilt of femoral neck relative to shaft axis"],
  ];

  items.forEach((item, i) => {
    const y = 1.1 + i * 0.56;
    slide.addShape(pres.ShapeType.rect, {
      x: 0.3, y: y, w: 2.2, h: 0.45,
      fill: { color: GOLD }, line: { color: GOLD }
    });
    slide.addText(item[0], { x: 0.3, y: y, w: 2.2, h: 0.45, fontSize: 10, bold: true, color: DARK_BG, align: "center", valign: "middle", margin: 0 });
    slide.addText(item[1], { x: 2.6, y: y, w: 4.6, h: 0.45, fontSize: 10, color: PALE, valign: "middle", margin: 2 });
  });

  // Image on right
  if (images[0] && !images[0].error) {
    slide.addImage({ data: images[0].base64, x: 7.3, y: 0.95, w: 2.5, h: 4.2, sizing: { type: "contain", w: 2.5, h: 4.2 } });
    slide.addText("Proximal Femur — Labeled Anatomy", {
      x: 7.1, y: 5.2, w: 2.7, h: 0.3, fontSize: 8, color: TEAL, italic: true, align: "center"
    });
  }

  bottomBar(slide);
}

// ═══════════════════════════════════════════════════════════════════════════════
// SLIDE 3 — PROXIMAL FEMUR
// ═══════════════════════════════════════════════════════════════════════════════
{
  const slide = pres.addSlide();
  slide.background = { color: DARK_BG };

  sectionBanner(slide, GOLD);
  slide.addText("PROXIMAL FEMUR", {
    x: 0.4, y: 0.08, w: 9.2, h: 0.82,
    fontSize: 22, bold: true, color: DARK_BG, valign: "middle", margin: 0
  });

  // Two-column layout
  const leftParts = [
    { label: "Femoral Head", desc: "2/3-sphere; covered with hyaline cartilage (except fovea capitis). Articulates with acetabulum. Fovea = attachment site of ligamentum teres carrying artery of Ligamentum Teres." },
    { label: "Femoral Neck", desc: "Oblique strut between pelvis (horizontal) and shaft (vertical). Predominantly cancellous bone — vulnerable to torsional & shear forces. Anteversion ≈ 10–15°." },
    { label: "Greater Trochanter", desc: "Large lateral prominence. Insertion: gluteus medius & minimus, piriformis, obturator internus/externus, gemelli. Palpable landmark laterally." },
    { label: "Lesser Trochanter", desc: "Posteromedial prominence at junction of neck and shaft. Insertion of iliopsoas (primary hip flexor)." },
    { label: "Intertrochanteric Line", desc: "Anterior ridge — capsule attachment; weight-bearing line." },
    { label: "Intertrochanteric Crest", desc: "Posterior; connects the two trochanters. Contains quadrate tubercle (insertion of quadratus femoris)." },
    { label: "Calcar Femorale", desc: "Dense vertical plate of cortical bone inside femoral neck. Resists compressive loads. Important landmark in hip arthroplasty." },
  ];

  leftParts.forEach((p, i) => {
    const y = 1.1 + i * 0.62;
    slide.addShape(pres.ShapeType.rect, {
      x: 0.25, y: y, w: 0.08, h: 0.45,
      fill: { color: GOLD }, line: { color: GOLD }
    });
    slide.addText(p.label + ": ", {
      x: 0.42, y: y, w: 1.9, h: 0.45, fontSize: 10, bold: true, color: TEAL, valign: "top", margin: 2
    });
    slide.addText(p.desc, {
      x: 2.25, y: y, w: 4.95, h: 0.45, fontSize: 9.5, color: PALE, valign: "top", margin: 2
    });
  });

  // Image
  if (images[1] && !images[1].error) {
    slide.addImage({ data: images[1].base64, x: 7.35, y: 0.95, w: 2.45, h: 4.3, sizing: { type: "contain", w: 2.45, h: 4.3 } });
    slide.addText("Hip Joint: Head, Neck & Trochanters", {
      x: 7.1, y: 5.25, w: 2.7, h: 0.25, fontSize: 7.5, color: TEAL, italic: true, align: "center"
    });
  }

  bottomBar(slide);
}

// ═══════════════════════════════════════════════════════════════════════════════
// SLIDE 4 — FEMORAL SHAFT
// ═══════════════════════════════════════════════════════════════════════════════
{
  const slide = pres.addSlide();
  slide.background = { color: DARK_BG };

  sectionBanner(slide, GOLD);
  slide.addText("FEMORAL SHAFT (DIAPHYSIS)", {
    x: 0.4, y: 0.08, w: 9.2, h: 0.82,
    fontSize: 22, bold: true, color: DARK_BG, valign: "middle", margin: 0
  });

  // Card layout
  const cards = [
    {
      title: "Structure",
      pts: [
        "Thick cortical bone — requires high force to fracture",
        "Bowed anteriorly (important for nail insertion)",
        "Subtrochanteric region: highest cortical stress concentrations",
        "Mid-shaft: triangular cross-section",
      ]
    },
    {
      title: "Surfaces",
      pts: [
        "Anterior surface: smooth, convex",
        "Posteromedial surface: smooth",
        "Posterolateral surface: smooth",
        "Posterior border: forms the linea aspera",
      ]
    },
    {
      title: "Linea Aspera",
      pts: [
        "Broad roughened posterior crest running along shaft",
        "Widens proximally → gluteal tuberosity (lateral) + pectineal line (medial)",
        "Widens distally → medial & lateral supracondylar lines",
        "Attachment for adductors, quadriceps, hamstrings, vastus lateralis/medialis",
      ]
    },
    {
      title: "Nutrient Foramen",
      pts: [
        "Posterior surface of mid-shaft near linea aspera",
        "Opens distally ('flees the knee') — aids bone siding",
        "Transmits nutrient artery supplying cortical bone",
      ]
    },
    {
      title: "Muscle Compartments",
      pts: [
        "Anterior: extensors of knee (quadriceps) — femoral nerve",
        "Posterior: extensors of hip & flexors of knee (hamstrings) — sciatic nerve",
        "Medial: adductors — obturator nerve",
      ]
    },
    {
      title: "Clinical Points",
      pts: [
        "Femoral shaft fractures require high-energy trauma in young adults",
        "Atypical femur fractures (bisphosphonate use): transverse, subtrochanteric/diaphyseal",
        "Intramedullary nailing is gold-standard fixation",
      ]
    },
  ];

  const cols = 3;
  const rows = 2;
  const cardW = 3.1;
  const cardH = 2.15;
  const startX = 0.22;
  const startY = 1.08;
  const gapX = 0.08;
  const gapY = 0.06;

  cards.forEach((card, i) => {
    const col = i % cols;
    const row = Math.floor(i / cols);
    const x = startX + col * (cardW + gapX);
    const y = startY + row * (cardH + gapY);

    slide.addShape(pres.ShapeType.rect, {
      x, y, w: cardW, h: cardH,
      fill: { color: MID_BG }, line: { color: GOLD, pt: 1 }
    });
    slide.addShape(pres.ShapeType.rect, {
      x, y, w: cardW, h: 0.32,
      fill: { color: GOLD }, line: { color: GOLD }
    });
    slide.addText(card.title, {
      x, y, w: cardW, h: 0.32,
      fontSize: 11, bold: true, color: DARK_BG, align: "center", valign: "middle", margin: 0
    });
    slide.addText(card.pts.map(p => ({ text: p, options: { bullet: { type: "bullet" }, breakLine: true } })), {
      x: x + 0.08, y: y + 0.36, w: cardW - 0.16, h: cardH - 0.42,
      fontSize: 9, color: PALE, lineSpacingMultiple: 1.25
    });
  });

  bottomBar(slide);
}

// ═══════════════════════════════════════════════════════════════════════════════
// SLIDE 5 — DISTAL FEMUR
// ═══════════════════════════════════════════════════════════════════════════════
{
  const slide = pres.addSlide();
  slide.background = { color: DARK_BG };

  sectionBanner(slide, GOLD);
  slide.addText("DISTAL FEMUR", {
    x: 0.4, y: 0.08, w: 9.2, h: 0.82,
    fontSize: 22, bold: true, color: DARK_BG, valign: "middle", margin: 0
  });

  const parts = [
    ["Medial Condyle", "Large articular surface on medial side. Projects more distally than lateral condyle — compensates for femoral obliquity. Bears greater compressive load."],
    ["Lateral Condyle", "Articular surface on lateral side. More posterior extension. Lateral lip of patellar surface is raised to prevent patellar dislocation."],
    ["Intercondylar Fossa", "Deep groove separating condyles posteriorly. Contains ACL & PCL attachments. Floor = popliteal surface."],
    ["Patellar Articular Surface", "Smooth anterior surface. Trochlear groove for patella gliding. Lateral lip elevated to guard against lateral patellar dislocation."],
    ["Medial Epicondyle", "Prominence on medial surface of medial condyle. Attachment: tibial (medial) collateral ligament, medial head of gastrocnemius."],
    ["Lateral Epicondyle", "Prominence on lateral condyle. Attachment: fibular (lateral) collateral ligament, lateral head of gastrocnemius, popliteus tendon."],
    ["Adductor Tubercle", "Small prominence at superior medial condyle where medial supracondylar line terminates. Adductor magnus tendon attachment."],
    ["Popliteal Surface", "Posterior triangular area between supracondylar lines. Floor of popliteal fossa."],
  ];

  parts.forEach((p, i) => {
    const col = i < 4 ? 0 : 1;
    const row = i < 4 ? i : i - 4;
    const x = 0.28 + col * 4.85;
    const y = 1.08 + row * 1.05;

    slide.addShape(pres.ShapeType.rect, {
      x, y, w: 4.7, h: 0.95,
      fill: { color: MID_BG }, line: { color: GOLD, pt: 0.75 }
    });
    slide.addShape(pres.ShapeType.rect, {
      x, y, w: 0.07, h: 0.95,
      fill: { color: GOLD }, line: { color: GOLD }
    });
    slide.addText(p[0], {
      x: x + 0.14, y: y + 0.04, w: 4.45, h: 0.28,
      fontSize: 10.5, bold: true, color: TEAL, margin: 2, valign: "top"
    });
    slide.addText(p[1], {
      x: x + 0.14, y: y + 0.3, w: 4.45, h: 0.6,
      fontSize: 9, color: PALE, margin: 2, valign: "top"
    });
  });

  bottomBar(slide);
}

// ═══════════════════════════════════════════════════════════════════════════════
// SLIDE 6 — BLOOD SUPPLY & NERVE SUPPLY
// ═══════════════════════════════════════════════════════════════════════════════
{
  const slide = pres.addSlide();
  slide.background = { color: DARK_BG };

  sectionBanner(slide, GOLD);
  slide.addText("BLOOD SUPPLY & NERVE SUPPLY", {
    x: 0.4, y: 0.08, w: 9.2, h: 0.82,
    fontSize: 22, bold: true, color: DARK_BG, valign: "middle", margin: 0
  });

  // Blood supply section
  slide.addText("ARTERIAL SUPPLY", {
    x: 0.3, y: 1.05, w: 4.4, h: 0.3,
    fontSize: 11, bold: true, color: GOLD, align: "left", margin: 0
  });

  const arteries = [
    ["Femoral Head & Neck", "Medial & lateral circumflex femoral aa. (branches of femoral/profunda femoris). Form extracapsular arterial ring at femoral neck → retinacular vessels ascend to head."],
    ["Ligamentum Teres", "Artery of lig. teres (from obturator a.) — minor contributor in adults; more significant in children."],
    ["Femoral Shaft", "Profunda femoris (deep femoral artery) — predominantly responsible. Runs posterolaterally; branches supply hamstrings and adductors."],
    ["Superficial Femoral A.", "Passes anteromedially → through adductor hiatus → becomes popliteal artery. Vascular supply to distal thigh."],
    ["External Iliac → Common Femoral", "Passes under inguinal ligament. Located midway between ASIS and pubic symphysis."],
  ];

  arteries.forEach((a, i) => {
    const y = 1.42 + i * 0.72;
    slide.addShape(pres.ShapeType.rect, {
      x: 0.25, y, w: 2.2, h: 0.6,
      fill: { color: "8B1A1A" }, line: { color: GOLD, pt: 0.5 }
    });
    slide.addText(a[0], { x: 0.25, y, w: 2.2, h: 0.6, fontSize: 9, bold: true, color: GOLD, align: "center", valign: "middle", margin: 3 });
    slide.addText(a[1], { x: 2.55, y, w: 4.55, h: 0.6, fontSize: 9, color: PALE, valign: "middle", margin: 2 });
  });

  // Nerve supply — right column
  slide.addShape(pres.ShapeType.rect, {
    x: 7.2, y: 1.0, w: 2.6, h: 4.35,
    fill: { color: MID_BG }, line: { color: GOLD, pt: 1 }
  });
  slide.addText("NERVE SUPPLY", {
    x: 7.2, y: 1.0, w: 2.6, h: 0.32,
    fontSize: 11, bold: true, color: DARK_BG, align: "center", valign: "middle", margin: 0,
    fill: { color: GOLD }
  });
  slide.addShape(pres.ShapeType.rect, {
    x: 7.2, y: 1.0, w: 2.6, h: 0.32,
    fill: { color: GOLD }, line: { color: GOLD }
  });
  slide.addText("NERVE SUPPLY", {
    x: 7.2, y: 1.0, w: 2.6, h: 0.32,
    fontSize: 11, bold: true, color: DARK_BG, align: "center", valign: "middle", margin: 0
  });

  const nerves = [
    ["Femoral Nerve (L2-L4)", "Largest lumbar plexus branch. Enters under inguinal lig. lateral to femoral artery. Innervates: quadriceps (knee extension), pectineus, sartorius."],
    ["Sciatic Nerve (L4-S3)", "Largest peripheral nerve. Exits via greater sciatic foramen inferior to piriformis. Innervates: hamstrings, adductor magnus. Divides at popliteal fossa → tibial + common peroneal."],
    ["Obturator Nerve (L2-L4)", "Innervates medial compartment (adductors). Sensory to medial thigh."],
    ["Lateral Cutaneous n. of Thigh", "L2-L3; pure sensory to lateral thigh surface."],
  ];

  nerves.forEach((n, i) => {
    const y = 1.4 + i * 0.98;
    slide.addText(n[0], { x: 7.26, y, w: 2.48, h: 0.28, fontSize: 9, bold: true, color: TEAL, margin: 3 });
    slide.addText(n[1], { x: 7.26, y: y + 0.28, w: 2.48, h: 0.62, fontSize: 8.5, color: PALE, margin: 3 });
  });

  // Ligaments image
  if (images[2] && !images[2].error) {
    // no room — skip or overlay very small
  }

  bottomBar(slide);
}

// ═══════════════════════════════════════════════════════════════════════════════
// SLIDE 7 — MUSCLE ATTACHMENTS
// ═══════════════════════════════════════════════════════════════════════════════
{
  const slide = pres.addSlide();
  slide.background = { color: DARK_BG };

  sectionBanner(slide, GOLD);
  slide.addText("MUSCLE ATTACHMENTS", {
    x: 0.4, y: 0.08, w: 9.2, h: 0.82,
    fontSize: 22, bold: true, color: DARK_BG, valign: "middle", margin: 0
  });

  const table = [
    // [Region, Muscle, Action, Note]
    ["Greater\nTrochanter", "Gluteus medius & minimus\nPiriformis\nObturator internus & externus\nGemellus superior & inferior", "Hip abduction / medial rotation\nExternal rotation\nExternal rotation\nExternal rotation", "Key stabilisers during gait; trendelenburg sign if weak"],
    ["Lesser\nTrochanter", "Iliopsoas (iliacus + psoas major)", "Hip flexion & external rotation", "Primary hip flexor; inserts via iliopsoas tendon"],
    ["Gluteal\nTuberosity", "Gluteus maximus", "Hip extension & external rotation", "Proximal-lateral femoral shaft, posterior"],
    ["Pectineal\nLine", "Pectineus", "Hip flexion, adduction & medial rotation", "Posteromedial proximal shaft below lesser trochanter"],
    ["Linea Aspera\n(medial lip)", "Adductors (longus, brevis, magnus)\nVastus medialis", "Adduction\nKnee extension", "Major adductor group from pubis"],
    ["Linea Aspera\n(lateral lip)", "Vastus lateralis\nShort head of biceps femoris", "Knee extension\nKnee flexion", "Quadriceps attachment"],
    ["Adductor\nTubercle", "Adductor magnus (tendinous part)", "Hip adduction & extension", "Distal medial supracondylar line terminus"],
    ["Lateral Condyle", "Lateral head of gastrocnemius\nPopliteus", "Plantar flexion\nKnee unlocking", "Posterior knee musculature"],
    ["Medial Condyle", "Medial head of gastrocnemius", "Plantar flexion", "Attachment above medial epicondyle"],
  ];

  const colWidths = [1.25, 2.2, 2.0, 2.0];
  const headers = ["Region", "Muscle", "Action", "Clinical Note"];
  const startX = 0.28;
  const startY = 1.08;

  // Header row
  let cx = startX;
  headers.forEach((h, i) => {
    slide.addShape(pres.ShapeType.rect, {
      x: cx, y: startY, w: colWidths[i], h: 0.32,
      fill: { color: GOLD }, line: { color: GOLD }
    });
    slide.addText(h, { x: cx, y: startY, w: colWidths[i], h: 0.32, fontSize: 9.5, bold: true, color: DARK_BG, align: "center", valign: "middle", margin: 0 });
    cx += colWidths[i] + 0.025;
  });

  table.forEach((row, r) => {
    cx = startX;
    const y = startY + 0.33 + r * 0.46;
    const bgColor = r % 2 === 0 ? MID_BG : "1E2B46";
    row.forEach((cell, c) => {
      slide.addShape(pres.ShapeType.rect, {
        x: cx, y, w: colWidths[c], h: 0.44,
        fill: { color: bgColor }, line: { color: "2A3860", pt: 0.5 }
      });
      slide.addText(cell, {
        x: cx + 0.04, y: y + 0.02, w: colWidths[c] - 0.08, h: 0.4,
        fontSize: 8.2, color: c === 0 ? GOLD : (c === 1 ? TEAL : PALE),
        bold: c === 0,
        valign: "middle", margin: 0
      });
      cx += colWidths[c] + 0.025;
    });
  });

  // Right panel: ligaments image
  if (images[2] && !images[2].error) {
    slide.addImage({ data: images[2].base64, x: 7.8, y: 1.05, w: 2.0, h: 4.0, sizing: { type: "contain", w: 2.0, h: 4.0 } });
    slide.addText("Hip Ligaments\n(Ant. & Post. Views)", {
      x: 7.7, y: 5.08, w: 2.2, h: 0.3, fontSize: 7.5, color: TEAL, italic: true, align: "center"
    });
  }

  bottomBar(slide);
}

// ═══════════════════════════════════════════════════════════════════════════════
// SLIDE 8 — CLINICAL CORRELATIONS & FRACTURE ZONES
// ═══════════════════════════════════════════════════════════════════════════════
{
  const slide = pres.addSlide();
  slide.background = { color: DARK_BG };

  sectionBanner(slide, GOLD);
  slide.addText("CLINICAL CORRELATIONS", {
    x: 0.4, y: 0.08, w: 9.2, h: 0.82,
    fontSize: 22, bold: true, color: DARK_BG, valign: "middle", margin: 0
  });

  const zones = [
    {
      zone: "FEMORAL HEAD", color: "5C3317",
      pts: [
        "AVN (osteonecrosis): disruption of retinacular vessels after displaced neck fracture or dislocation",
        "Hip dislocation: posterior most common (dashboard injury) — risk to sciatic nerve",
        "Femoral head fractures (Pipkin classification) occur with hip dislocation",
      ]
    },
    {
      zone: "FEMORAL NECK", color: "7A3B1E",
      pts: [
        "Most common site of osteoporotic fracture in elderly (low-energy falls)",
        "Pauwels classification by angle (I <30°, II 30–70°, III >70°) — higher angle = higher shear",
        "20% mortality in first year post-fracture; 1/3 require institutional care",
        "Blood supply disruption → AVN (15–35% in displaced fractures)",
        "Intracapsular location → no periosteal callus; reliant on endosteal healing",
      ]
    },
    {
      zone: "INTERTROCHANTERIC", color: "2D5A27",
      pts: [
        "Extracapsular — good blood supply → reliable healing",
        "Evans classification; stable vs unstable based on posteromedial cortex integrity",
        "Dynamic hip screw (DHS) or cephalomedullary nail for fixation",
        "Reverse obliquity fractures: more unstable — favour intramedullary nail",
      ]
    },
    {
      zone: "SUBTROCHANTERIC", color: "1E4D6B",
      pts: [
        "High cortical stress concentration — prone to fatigue fractures",
        "Site of atypical femur fractures (bisphosphonate-related): transverse or short oblique",
        "Deforming muscles: abductors + iliopsoas flex/abduct proximal fragment",
        "Cephalomedullary nail (long nail) preferred",
      ]
    },
    {
      zone: "FEMORAL SHAFT", color: "4A1F7A",
      pts: [
        "Cortical bone — requires high-energy trauma (MVC, fall from height) in young",
        "Significant blood loss possible (1–2 L into thigh)",
        "Antegrade intramedullary nailing — gold standard",
        "Risk of missed ipsilateral femoral neck fracture (check with dedicated XR)",
      ]
    },
    {
      zone: "DISTAL FEMUR", color: "5C1B30",
      pts: [
        "Widening distal metaphysis: cortex thins → susceptible to osteoporotic fracture",
        "AO/OTA classification (33-A, B, C) — increasing intra-articular complexity",
        "Retrograde nail or LISS plate depending on pattern",
        "Periprosthetic fractures after TKA: Vancouver/Su classification",
      ]
    },
  ];

  const colW = 3.15;
  const colH = 2.1;
  zones.forEach((z, i) => {
    const col = i % 3;
    const row = Math.floor(i / 3);
    const x = 0.23 + col * (colW + 0.075);
    const y = 1.05 + row * (colH + 0.08);

    slide.addShape(pres.ShapeType.rect, { x, y, w: colW, h: colH, fill: { color: z.color }, line: { color: GOLD, pt: 1 } });
    slide.addShape(pres.ShapeType.rect, { x, y, w: colW, h: 0.3, fill: { color: GOLD }, line: { color: GOLD } });
    slide.addText(z.zone, { x, y, w: colW, h: 0.3, fontSize: 10.5, bold: true, color: DARK_BG, align: "center", valign: "middle", margin: 0 });
    slide.addText(z.pts.map(p => ({ text: p, options: { bullet: { type: "bullet" }, breakLine: true } })), {
      x: x + 0.1, y: y + 0.33, w: colW - 0.2, h: colH - 0.4,
      fontSize: 8.8, color: WHITE, lineSpacingMultiple: 1.3
    });
  });

  bottomBar(slide);
}

// ═══════════════════════════════════════════════════════════════════════════════
// SLIDE 9 — ANGLES & RADIOLOGICAL ANATOMY
// ═══════════════════════════════════════════════════════════════════════════════
{
  const slide = pres.addSlide();
  slide.background = { color: DARK_BG };

  sectionBanner(slide, GOLD);
  slide.addText("ANGLES & RADIOLOGICAL ANATOMY", {
    x: 0.4, y: 0.08, w: 9.2, h: 0.82,
    fontSize: 22, bold: true, color: DARK_BG, valign: "middle", margin: 0
  });

  const angles = [
    { name: "Angle of Inclination\n(Neck-Shaft Angle)", normal: "125° (120–135°)", abnormal: "Coxa valga (>135°)\nCoxa vara (<120°)", significance: "Affects femoral neck length & lever arm of abductors. Altered in developmental dysplasia, Paget's, osteomalacia." },
    { name: "Angle of Anteversion\n(Femoral Torsion)", normal: "10–15° anteversion", abnormal: "Increased: in-toeing\nDecreased (retroversion): out-toeing", significance: "Measured by CT or MRI. Important pre-operative parameter for THA and paediatric osteotomy." },
    { name: "Mechanical Axis", normal: "Passes through centre of femoral head to centre of tibial plateau", abnormal: "Varus: axis medial to knee\nValgus: axis lateral to knee", significance: "Key for TKA alignment planning. Normal medial proximal tibial angle (MPTA) ≈ 87°." },
    { name: "Q-Angle (Quadriceps Angle)", normal: "M: ≈ 10–12°, F: ≈ 15–17°", abnormal: ">20° = increased risk of patellar instability", significance: "Line from ASIS to patellar centre, then to tibial tuberosity. Relates to femoral anteversion and tibial torsion." },
    { name: "CE Angle of Wiberg\n(Centre-Edge Angle)", normal: "≥ 25° (adult)", abnormal: "<20° = dysplasia (undercoverage)", significance: "Measures acetabular coverage of femoral head. Reduced in DDH. Assessed on AP pelvis radiograph." },
    { name: "Hilgenreiner-Perkin\nLines (Paediatric)", normal: "Femoral head ossific nucleus: Perkin-inner & Hilgenreiner-below quadrant", abnormal: "Outer/above quadrant = dysplasia or dislocation", significance: "Used in infant hip screening (Graf method, Ortolani/Barlow). Ossific nucleus appears 3–6 months." },
  ];

  const aW = 3.1;
  const aH = 2.1;
  angles.forEach((a, i) => {
    const col = i % 3;
    const row = Math.floor(i / 3);
    const x = 0.22 + col * (aW + 0.1);
    const y = 1.05 + row * (aH + 0.08);

    slide.addShape(pres.ShapeType.rect, { x, y, w: aW, h: aH, fill: { color: MID_BG }, line: { color: GOLD, pt: 1 } });
    slide.addShape(pres.ShapeType.rect, { x, y, w: aW, h: 0.3, fill: { color: TEAL }, line: { color: TEAL } });
    slide.addText(a.name, { x, y, w: aW, h: 0.3, fontSize: 9.5, bold: true, color: DARK_BG, align: "center", valign: "middle", margin: 0 });

    slide.addText("Normal: ", { x: x + 0.08, y: y + 0.33, w: 0.6, h: 0.22, fontSize: 8.5, bold: true, color: GOLD, margin: 0 });
    slide.addText(a.normal, { x: x + 0.65, y: y + 0.33, w: aW - 0.73, h: 0.22, fontSize: 8.5, color: PALE, margin: 0 });

    slide.addText("Abnormal: ", { x: x + 0.08, y: y + 0.56, w: 0.72, h: 0.32, fontSize: 8.5, bold: true, color: "FF9999", margin: 0, valign: "top" });
    slide.addText(a.abnormal, { x: x + 0.78, y: y + 0.56, w: aW - 0.86, h: 0.32, fontSize: 8.2, color: PALE, margin: 0, valign: "top" });

    slide.addText("Significance: ", { x: x + 0.08, y: y + 0.9, w: 0.9, h: 0.2, fontSize: 8.2, bold: true, color: LIGHT_BLU, margin: 0 });
    slide.addText(a.significance, { x: x + 0.08, y: y + 1.1, w: aW - 0.16, h: aH - 1.17, fontSize: 8, color: PALE, margin: 0, valign: "top" });
  });

  bottomBar(slide);
}

// ═══════════════════════════════════════════════════════════════════════════════
// SLIDE 10 — SUMMARY / KEY FACTS
// ═══════════════════════════════════════════════════════════════════════════════
{
  const slide = pres.addSlide();
  slide.background = { color: DARK_BG };

  // Full-width header
  slide.addShape(pres.ShapeType.rect, {
    x: 0, y: 0, w: 10, h: 1.1,
    fill: { color: GOLD }, line: { color: GOLD }
  });
  slide.addText("KEY SUMMARY — FEMUR BONE ANATOMY", {
    x: 0.3, y: 0, w: 9.4, h: 1.1,
    fontSize: 24, bold: true, color: DARK_BG, valign: "middle", align: "center", margin: 0
  });

  const facts = [
    "Longest & strongest bone; bears full body weight during gait",
    "Proximal femur: head (2/3-sphere) + neck (oblique strut, 125° neck-shaft angle, 10-15° anteversion) + greater & lesser trochanters",
    "Blood supply to head: medial > lateral circumflex femoral aa. Disruption → AVN",
    "Cancellous bone: head / neck / intertrochanteric region. Cortical bone: shaft. Mixed: metaphysis",
    "Linea aspera (posterior crest): major muscle attachment line for adductors, quadriceps, hamstrings",
    "Nutrient foramen: posterior mid-shaft near linea aspera — 'flees the knee' (opens distally)",
    "Distal femur: medial & lateral condyles (knee articulation) + epicondyles + intercondylar fossa (ACL/PCL)",
    "Femoral nerve (L2-L4): anterior compartment — quadriceps. Sciatic nerve (L4-S3): posterior compartment — hamstrings",
    "Profunda femoris (deep femoral a.) = main vascular supply to femoral shaft",
    "Coxa valga (>135°) vs coxa vara (<120°). Anteversion >15° = in-toeing gait in children",
    "Fracture risk: neck (osteoporosis/elderly), shaft (high-energy), atypical shaft (bisphosphonates)",
    "Hip dislocation (posterior) risks sciatic nerve. Femoral neck fracture risks AVN + non-union",
  ];

  facts.forEach((f, i) => {
    const col = i < 6 ? 0 : 1;
    const row = i < 6 ? i : i - 6;
    const x = 0.3 + col * 4.85;
    const y = 1.18 + row * 0.7;
    const bulletColors = [GOLD, TEAL, LIGHT_BLU, "FF9999", GOLD, TEAL];

    slide.addShape(pres.ShapeType.rect, {
      x, y, w: 4.65, h: 0.62,
      fill: { color: MID_BG }, line: { color: bulletColors[row % 6], pt: 0.75 }
    });
    slide.addShape(pres.ShapeType.rect, {
      x, y: y + 0.15, w: 0.06, h: 0.3,
      fill: { color: bulletColors[row % 6] }, line: { color: bulletColors[row % 6] }
    });
    slide.addText(f, {
      x: x + 0.15, y, w: 4.45, h: 0.62,
      fontSize: 9.2, color: PALE, valign: "middle", margin: 4
    });
  });

  // Source attribution
  slide.addText("Sources: Rosen's Emergency Medicine 9e | Gray's Anatomy for Students | Forensic Anthropology (Christensen) | Thieme Atlas of Anatomy", {
    x: 0.3, y: 5.3, w: 9.4, h: 0.22,
    fontSize: 7.5, color: "6080A0", italic: true, align: "center"
  });
}

// ─── WRITE FILE ──────────────────────────────────────────────────────────────
pres.writeFile({ fileName: "/home/daytona/workspace/femur-anatomy/Femur_Bone_Anatomy.pptx" })
  .then(() => console.log("DONE: /home/daytona/workspace/femur-anatomy/Femur_Bone_Anatomy.pptx"))
  .catch(err => { console.error("FAILED:", err); process.exit(1); });
Running Command

cd /home/daytona/workspace/femur-anatomy && node build.js 2>&1

Editing File

~/femur-anatomy/build.js

Successfully replaced 1 instance(s) of the string in '/home/daytona/workspace/femur-anatomy/build.js'
Running Command

cd /home/daytona/workspace/femur-anatomy && node build.js 2>&1

Running Command

ls -lh /home/daytona/workspace/femur-anatomy/Femur_Bone_Anatomy.pptx

Your femur anatomy notes slide deck is ready - 2.9 MB, 10 slides with anatomical images embedded.

Femur Bone Anatomy

Presentation · PPTX


What's inside (10 slides, deep navy + gold theme):
SlideContent
1Title with labeled proximal femur diagram
2General Features - classification, dimensions, orientation, bone types, articulations, inclination & anteversion angles
3Proximal Femur - head, neck, greater/lesser trochanters, intertrochanteric line/crest, calcar femorale (with hip joint image)
4Femoral Shaft - 6 content cards covering structure, surfaces, linea aspera, nutrient foramen, muscle compartments, clinical points
5Distal Femur - medial/lateral condyles, intercondylar fossa, patellar surface, epicondyles, adductor tubercle, popliteal surface
6Blood & Nerve Supply - circumflex femoral arteries, profunda femoris, SFA, femoral/sciatic/obturator nerves
7Muscle Attachments - table: region → muscle → action → clinical note (with hip ligament diagram)
8Clinical Correlations - color-coded fracture zones (head, neck, intertrochanteric, subtrochanteric, shaft, distal)
9Angles & Radiological Anatomy - inclination, anteversion, mechanical axis, Q-angle, CE angle, Hilgenreiner-Perkin lines
10Key Summary - 12 high-yield bullet facts with source attribution
Sources drawn from Rosen's Emergency Medicine, Gray's Anatomy for Students, Thieme Atlas of Anatomy, and Forensic Anthropology (Christensen).
This is a shared conversation. Sign in to Orris to start your own chat.