Explain dangerous area of face for my anatomy exam of 1st year MBBS

Reading File
Finding Sources
Finding Sources
Finding Sources
Finding Sources
Reading File
Finding Sources
Reading File
Reading File
Reading File
Loading Image
I now have everything needed for a thorough, exam-ready answer. Here it is:

Dangerous Area of the Face

Definition and Boundaries

The dangerous area of the face (also called the "danger triangle" or "danger zone") is the region bounded by:
  • Upper lip and nose - roughly a triangular zone with its apex at the root of the nose (glabella/nasion) and its base along the upper lip
Some sources extend it slightly to include the nasolabial folds. The key anatomical reason this area is dangerous is the valveless venous communication between the facial veins here and the intracranial cavernous sinus.
"The upper lip and nose are considered the danger area of the face because infections in this region may be transmitted in a retrograde fashion through a valveless venous system to the cavernous sinus."
  • Scott-Brown's Otorhinolaryngology Head & Neck Surgery

Why Is It Dangerous? - The Key Anatomy

The danger arises because infections (boils, furuncles, carbuncles, pimples, cellulitis) in this region can spread retrograde (backwards) through venous channels into the cavernous sinus, causing cavernous sinus thrombosis - a life-threatening complication.

The Critical Venous Pathway

Intracranial venous connections showing the facial vein, deep facial vein, ophthalmic veins, and cavernous sinus
There are two main routes by which infection spreads from this danger area to the cavernous sinus:

Route 1: Via the Angular Vein → Ophthalmic Vein → Cavernous Sinus

  1. Infection from upper lip/nose enters the facial vein
  2. The facial vein originates at the medial corner of the eye as the angular vein (formed by confluence of the supratrochlear and supraorbital veins)
  3. The angular vein communicates with the superior ophthalmic vein
  4. The superior ophthalmic vein drains directly into the cavernous sinus

Route 2: Via the Deep Facial Vein → Pterygoid Plexus → Cavernous Sinus

  1. The facial vein in the cheek communicates with the deep facial vein
  2. The deep facial vein connects with the pterygoid plexus of veins
  3. The pterygoid plexus communicates with the cavernous sinus via emissary veins passing through the foramen ovale and foramen lacerum

Why Can Blood Flow Backwards?

This is the critical point for your exam:
There are NO valves in the facial vein or any other venous channels of the head.
This means blood (and therefore infection) can flow in any direction - including retrograde (backwards) towards the cavernous sinus. Normally blood flows downward, but during infection with increased pressure, septic thrombi can travel upward intracranially.

Anatomy of the Cavernous Sinus (What Makes Its Thrombosis So Serious)

The cavernous sinus lies on either side of the sella turcica and pituitary gland. Its contents explain the catastrophic signs of cavernous sinus thrombosis:
StructureLocation in/near SinusClinical Effect if Involved
Internal carotid arteryPasses through sinusArterial compromise, stroke
Abducent nerve (CN VI)Passes through the interior of the sinusLateral rectus palsy (most sensitive sign - eye cannot abduct)
Oculomotor nerve (CN III)Lateral wall of sinusPtosis, dilated pupil, "down and out" eye
Trochlear nerve (CN IV)Lateral wall of sinusSuperior oblique palsy
Ophthalmic nerve (CN V1)Lateral wall of sinusLoss of sensation over forehead/eye
Maxillary nerve (CN V2)Lateral wall of sinusLoss of sensation over cheek
Memory tip: CN VI is MOST commonly and EARLIEST affected because it lies within the sinus itself (not protected by the wall), making lateral gaze palsy (inability to abduct the eye) the most sensitive sign.

Cavernous Sinus Thrombosis - Clinical Features

When infection spreads from the danger area to the cavernous sinus, the following features appear:
  • Severe constitutional disturbance - high fever, rigors, toxemia
  • Proptosis (forward protrusion of the eyeball) - due to venous obstruction
  • Chemosis (conjunctival edema)
  • Periorbital edema
  • Ophthalmoplegia - paralysis of ocular muscles (squint)
  • Lateral rectus palsy (CN VI affected first - most sensitive sign)
  • Headache, nausea, vomiting
  • Altered consciousness in severe cases
  • Usually becomes bilateral (both sides) - distinguishes from orbital cellulitis
"Diagnosis of such complication is made by noting severe constitutional disturbances, proptosis, squint and paralysis of the ocular muscles, especially the rectus lateralis which is supplied by the abducent nerve."
  • S. Das, A Manual on Clinical Surgery

Key Exam Points Summary

PointDetail
LocationTriangle: apex at root of nose, base at upper lip (upper lip + nose)
Key reasonValveless veins - no valves in facial vein or head veins
Route 1Facial vein → Angular vein → Superior ophthalmic vein → Cavernous sinus
Route 2Facial vein → Deep facial vein → Pterygoid plexus → Cavernous sinus (via foramen ovale/lacerum)
Most dangerous infectionBoil/furuncle on upper lip or nose - do NOT squeeze it
ComplicationCavernous sinus thrombosis (septic)
Earliest sign of CSTLateral rectus palsy (CN VI - abducent nerve)
Why CN VI first?It lies inside the sinus, not in its wall
Classic saying"Never squeeze a pimple in the dangerous area of the face"

Sources: Gray's Anatomy for Students (Gray's, p. 7334-7344); Scott-Brown's Otorhinolaryngology (vol. 1, p. 6419-6429); S. Das Manual on Clinical Surgery (p. 457-471); Color Atlas of Human Anatomy Vol. 2 (p. 1395-1400)

Explain circle of Willis for my 1st year anatomy exam

Finding Sources
Finding Sources
Reading File
Reading File

With its digram and image

Finding Sources
Finding Sources
Reading File
Reading File
Reading File
Reading File
Loading Image
Loading Image
Reading File
Finding Sources
Finding Sources
Reading File
Reading File
I now have rich content and two excellent diagrams. Let me compile the comprehensive exam answer.

Circle of Willis - Complete 1st Year MBBS Anatomy Guide

Introduction

The Circle of Willis (cerebral arterial circle) is a polygonal anastomotic ring of arteries located at the base of the brain, in the interpeduncular cistern of the subarachnoid space. It connects the anterior circulation (from internal carotid arteries) with the posterior circulation (from vertebral-basilar system), providing collateral pathways to protect the brain from ischemia if one vessel is occluded.

Diagrams

Figure 1 - Circle of Willis and all major branches (inferior view of brain):
Circle of Willis and its main branches - inferior view of brain showing all labeled arteries
Figure 2 - Detailed schematic showing relationship to brainstem structures:
Detailed diagram of Circle of Willis showing relationship to optic chiasm, cranial nerves, and brainstem

Blood Supply to the Brain - Two Circulations

The brain receives blood from two sources:
CirculationSource VesselsForms
AnteriorLeft & Right Internal Carotid Arteries (ICA)ACA + MCA
PosteriorLeft & Right Vertebral Arteries → fuse to form Basilar ArteryPCA
Both circulations meet and anastomose to form the Circle of Willis.

Components of the Circle of Willis

The circle has 3 paired vessels and 2 unpaired communicating vessels = 8 vessels total forming the ring:

Anterior Part (from Internal Carotid Arteries)

  1. Anterior Cerebral Artery (ACA) - right and left (paired) - terminal branches of ICA
  2. Anterior Communicating Artery (ACoA) - single, unpaired - connects the two ACAs across the midline

Middle Part (the lateral "struts")

  1. Internal Carotid Artery (ICA) - right and left supraclinoid portions (the "inflow" vessels)
  2. Posterior Communicating Artery (PCoA) - right and left (paired) - links ICA to PCA, joining anterior to posterior circulation

Posterior Part (from Basilar Artery)

  1. Posterior Cerebral Artery (PCA) - right and left (paired) - terminal branches of the basilar artery
"The two anterior cerebral arteries are connected by the anterior communicating artery. The posterior communicating arteries connect the supraclinoid internal carotid arteries with the proximal posterior cerebral arteries."
  • Goldman-Cecil Medicine, 22E

Schematic of the Circle

        ACoA (anterior communicating artery)
          |
  ACA ——[left]——[right]—— ACA
  |                            |
  ICA (left)           ICA (right)
  |                            |
  PCoA (left)         PCoA (right)
  |                            |
  PCA (left) ——Basilar—— PCA (right)
              |
         Vertebral arteries (L + R)
The shape is roughly a hexagon (some say heptagon) when drawn out.

The Three Main Cerebral Arteries and What They Supply

These are the branches that arise FROM the circle and actually supply the brain tissue:

1. Anterior Cerebral Artery (ACA)

  • Passes anteriorly then curves back over the corpus callosum through the interhemispheric fissure
  • Supplies: Medial frontal lobe, medial parietal lobe, sensorimotor cortex for the lower limb
  • Deep branches (lenticulostriate/Heubner's artery): anterior limb of internal capsule, head of caudate, anterior putamen
  • Stroke effect: Contralateral leg weakness/sensory loss (leg cortex is on medial surface)

2. Middle Cerebral Artery (MCA)

  • Largest branch of ICA; passes laterally into the Sylvian (lateral) fissure
  • Supplies: Entire lateral surface of the cerebral hemisphere - face, arm, and trunk sensorimotor cortex; Broca's area (dominant hemisphere); Wernicke's area; visual radiation
  • Deep branches: lenticulostriate arteries supplying internal capsule (posterior limb) and basal ganglia
  • Stroke effect: Contralateral face + arm weakness, aphasia (if dominant side)

3. Posterior Cerebral Artery (PCA)

  • Terminal branch of basilar artery; wraps around the cerebral peduncle
  • Supplies: Occipital lobe (primary visual cortex), medial-inferior temporal lobe, thalamus, midbrain
  • Stroke effect: Contralateral homonymous hemianopia (visual field defect); thalamic infarct

Mnemonic for Branches of ICA (Supraclinoid)

OPAAM
  • O - Ophthalmic artery
  • P - Posterior communicating artery
  • A - Anterior choroidal artery
  • A - Anterior cerebral artery
  • M - Middle cerebral artery

Function of the Circle of Willis

The circle acts as an equalizer and collateral safety net:
  • Under normal conditions, blood from anterior and posterior circulations does not mix (pressures are equal)
  • When one vessel is occluded, the circle allows collateral flow to bypass the blockage
  • In a person with a complete circle of Willis, "the entire intracranial circulation can be supplied by a single patent internal carotid artery or vertebral artery" - Goldman-Cecil Medicine

Important Variations (Exam Favourite)

A complete circle of Willis exists in only ~34% of individuals. Common variants:
VariantDescription
Hypoplastic A1 segmentOne ACA's proximal part is small/absent; both ACAs fed from one ICA
"Fetal" PCAP1 segment absent; PCA territory supplied by ICA via PCoA instead of basilar
Hypoplastic PCoAReduces communication between anterior & posterior circulation

Clinical Importance - Key Exam Points

1. Berry (Saccular) Aneurysms

  • Most common site for intracranial aneurysms
  • Form at bifurcation points of the circle due to haemodynamic stress and congenital medial weakness
  • Common sites: ACoA > PCoA > MCA bifurcation
  • Rupture causes subarachnoid haemorrhage (SAH) - "worst headache of life"

2. PCoA Aneurysm and CN III Palsy

  • An enlarging PCoA aneurysm can compress the oculomotor nerve (CN III) as it passes nearby
  • Signs: ptosis, dilated pupil, "down and out" eye - a neurosurgical emergency

3. Stroke Localization

  • Knowing what each artery supplies allows you to localize a stroke from clinical signs

Summary Table for Quick Revision

VesselOriginSuppliesStroke Deficit
ACAICAMedial frontal/parietal (leg area)Contralateral leg weakness
MCAICALateral hemisphere (face, arm, speech)Face + arm weakness, aphasia
PCABasilarOccipital lobe, thalamusHomonymous hemianopia
ACoABetween ACAsCommunicating vessel onlyAneurysm - SAH, personality change
PCoAICA to PCACommunicating vessel onlyAneurysm - CN III palsy
Sources: Neuroanatomy through Clinical Cases, 3rd Ed. (p. 5772-5817); Goldman-Cecil Medicine, 22E (p. 1861-1883); Miller's Anesthesia, 10E (p. 1655-1665); Gray's Anatomy for Students (eFig. 9.35)

Generate a quick reference PDF of Circle of Willis anatomy for exam prep

Reading File
Running Command

ls -la /home/daytona/workspace/ 2>/dev/null || echo "workspace empty or missing"

Running Command

mkdir -p /home/daytona/workspace/circle-of-willis && python3 -c "import reportlab; print('reportlab ok')"

Writing File

~/circle-of-willis/generate_pdf.py

from reportlab.lib.pagesizes import A4
from reportlab.lib import colors
from reportlab.lib.units import mm, cm
from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle
from reportlab.lib.enums import TA_CENTER, TA_LEFT, TA_JUSTIFY
from reportlab.platypus import (
    SimpleDocTemplate, Paragraph, Spacer, Table, TableStyle,
    HRFlowable, KeepTogether
)
from reportlab.graphics.shapes import Drawing, Circle, Rect, Line, Ellipse, String, Polygon
from reportlab.graphics import renderPDF
from reportlab.platypus import Flowable
import math

OUTPUT = "/home/daytona/workspace/circle-of-willis/Circle_of_Willis_Quick_Reference.pdf"

# ── Colour palette ──────────────────────────────────────────────────────────
DARK_BLUE   = colors.HexColor("#1a2d5a")
MED_BLUE    = colors.HexColor("#2e5fa3")
LIGHT_BLUE  = colors.HexColor("#dce9f7")
ACCENT_RED  = colors.HexColor("#c0392b")
ACCENT_ORG  = colors.HexColor("#e67e22")
ACCENT_GRN  = colors.HexColor("#27ae60")
PALE_GOLD   = colors.HexColor("#fff8e1")
PALE_RED    = colors.HexColor("#fdecea")
PALE_GRN    = colors.HexColor("#e8f5e9")
WHITE       = colors.white
GREY        = colors.HexColor("#555555")
LIGHT_GREY  = colors.HexColor("#f4f4f4")

# ── Styles ───────────────────────────────────────────────────────────────────
styles = getSampleStyleSheet()

def S(name, **kw):
    base = styles.get(name, styles["Normal"])
    return ParagraphStyle(name + str(id(kw)), parent=base, **kw)

title_style = S("Title",
    fontSize=22, textColor=WHITE, alignment=TA_CENTER,
    fontName="Helvetica-Bold", spaceAfter=2)

subtitle_style = S("Normal",
    fontSize=11, textColor=colors.HexColor("#cfe0ff"), alignment=TA_CENTER,
    fontName="Helvetica", spaceAfter=4)

section_style = S("Normal",
    fontSize=12, textColor=WHITE, fontName="Helvetica-Bold",
    backColor=MED_BLUE, leftIndent=6, rightIndent=6,
    spaceBefore=8, spaceAfter=4, borderPad=4)

body_style = S("Normal",
    fontSize=9.5, textColor=colors.HexColor("#1a1a1a"),
    fontName="Helvetica", leading=14, spaceAfter=3, alignment=TA_JUSTIFY)

bullet_style = S("Normal",
    fontSize=9, textColor=colors.HexColor("#222222"),
    fontName="Helvetica", leading=13, leftIndent=12, spaceAfter=2)

bold_style = S("Normal",
    fontSize=9.5, textColor=DARK_BLUE, fontName="Helvetica-Bold",
    leading=13, spaceAfter=2)

small_style = S("Normal",
    fontSize=8, textColor=GREY, fontName="Helvetica",
    leading=11, spaceAfter=1)

caption_style = S("Normal",
    fontSize=8, textColor=GREY, fontName="Helvetica-Oblique",
    alignment=TA_CENTER, spaceAfter=6)

mnemonic_style = S("Normal",
    fontSize=10.5, textColor=DARK_BLUE, fontName="Helvetica-Bold",
    leading=15, leftIndent=8, spaceAfter=2)

# ── Custom flowable: Title banner ─────────────────────────────────────────────
class TitleBanner(Flowable):
    def __init__(self, width, height=60):
        super().__init__()
        self.width  = width
        self.height = height

    def draw(self):
        c = self.canv
        # gradient-like banner (two rects)
        c.setFillColor(DARK_BLUE)
        c.rect(0, 0, self.width, self.height, fill=1, stroke=0)
        c.setFillColor(MED_BLUE)
        c.rect(0, 0, self.width * 0.55, self.height, fill=1, stroke=0)
        # decorative side bar
        c.setFillColor(ACCENT_RED)
        c.rect(0, 0, 6, self.height, fill=1, stroke=0)


# ── Custom flowable: Circle of Willis diagram ─────────────────────────────────
class CircleOfWillisDiagram(Flowable):
    """Schematic diagram of the Circle of Willis."""

    def __init__(self, width=480, height=320):
        super().__init__()
        self.width  = width
        self.height = height

    def draw(self):
        c = self.canv
        w, h = self.width, self.height

        # Background
        c.setFillColor(colors.HexColor("#f0f4fa"))
        c.roundRect(0, 0, w, h, 10, fill=1, stroke=0)

        # Title
        c.setFillColor(DARK_BLUE)
        c.setFont("Helvetica-Bold", 10)
        c.drawCentredString(w / 2, h - 16, "Circle of Willis — Schematic Diagram")

        # Centre reference point
        cx, cy = w / 2, h / 2 - 10

        # ── Draw the vascular "ring" ──────────────────────────────────────
        # We build a polygon path approximating the circle shape:
        # Vessels drawn as thick lines

        arterial = colors.HexColor("#c0392b")
        comm     = colors.HexColor("#e67e22")
        vert     = colors.HexColor("#8e44ad")

        # Coordinates (relative to cx, cy)
        # ACA points (top)
        aca_l  = (cx - 38, cy + 72)
        aca_r  = (cx + 38, cy + 72)
        acoa   = (cx,      cy + 82)   # ACoA label point

        # ICA entry points (mid-lateral)
        ica_l  = (cx - 68, cy + 22)
        ica_r  = (cx + 68, cy + 22)

        # PCoA points (mid)
        pcoa_l = (cx - 62, cy - 22)
        pcoa_r = (cx + 62, cy - 22)

        # PCA points (lower)
        pca_l  = (cx - 48, cy - 62)
        pca_r  = (cx + 48, cy - 62)

        # Basilar / top
        bas_top = (cx, cy - 72)

        def thick_line(x1, y1, x2, y2, col, lw=4.5):
            c.setStrokeColor(col)
            c.setLineWidth(lw)
            c.line(x1, y1, x2, y2)

        def dashed_line(x1, y1, x2, y2, col, lw=3):
            c.setStrokeColor(col)
            c.setLineWidth(lw)
            c.setDash([5, 4])
            c.line(x1, y1, x2, y2)
            c.setDash([])

        # ── Left ICA trunk (enters from bottom-left) ──
        thick_line(cx - 68, cy - 80, ica_l[0], ica_l[1], arterial, 5)
        thick_line(ica_r[0], ica_r[1], cx + 68, cy - 80, arterial, 5)

        # ── ACA segments ──
        thick_line(ica_l[0], ica_l[1], aca_l[0], aca_l[1], arterial)
        thick_line(ica_r[0], ica_r[1], aca_r[0], aca_r[1], arterial)

        # ── ACoA (connects the two ACAs) ──
        thick_line(aca_l[0], aca_l[1], aca_r[0], aca_r[1], comm, 4)

        # ── MCA exits laterally ──
        thick_line(ica_l[0], ica_l[1], cx - 118, cy + 22, arterial, 4)
        thick_line(ica_r[0], ica_r[1], cx + 118, cy + 22, arterial, 4)

        # ── PCoA (ICA → PCA) ──
        dashed_line(ica_l[0], ica_l[1], pcoa_l[0], pcoa_l[1], comm, 3.5)
        dashed_line(ica_r[0], ica_r[1], pcoa_r[0], pcoa_r[1], comm, 3.5)

        # ── PCA ──
        thick_line(pcoa_l[0], pcoa_l[1], pca_l[0], pca_l[1], vert, 4)
        thick_line(pcoa_r[0], pcoa_r[1], pca_r[0], pca_r[1], vert, 4)

        # ── PCA to basilar ──
        thick_line(pca_l[0], pca_l[1], bas_top[0], bas_top[1], vert, 5)
        thick_line(pca_r[0], pca_r[1], bas_top[0], bas_top[1], vert, 5)

        # ── Basilar trunk going down ──
        thick_line(bas_top[0], bas_top[1], cx, cy - 130, vert, 5)

        # ── Vertebral arteries ──
        thick_line(cx - 30, cy - 130, cx, cy - 130, vert, 4)
        thick_line(cx + 30, cy - 130, cx, cy - 130, vert, 4)
        thick_line(cx - 30, cy - 130, cx - 60, cy - 155, vert, 4)
        thick_line(cx + 30, cy - 130, cx + 60, cy - 155, vert, 4)

        # ── ACA continue upward ──
        thick_line(aca_l[0], aca_l[1], cx - 38, cy + 118, arterial, 4)
        thick_line(aca_r[0], aca_r[1], cx + 38, cy + 118, arterial, 4)

        # ── Vessel dots at key junctions ──
        junctions = [ica_l, ica_r, aca_l, aca_r, pca_l, pca_r, pcoa_l, pcoa_r, bas_top]
        for (jx, jy) in junctions:
            c.setFillColor(WHITE)
            c.setStrokeColor(DARK_BLUE)
            c.setLineWidth(1)
            c.circle(jx, jy, 5, fill=1, stroke=1)

        # ── Labels ───────────────────────────────────────────────────────
        def label(text, x, y, col=DARK_BLUE, size=7.5, bold=False, anchor="middle"):
            c.setFillColor(col)
            font = "Helvetica-Bold" if bold else "Helvetica"
            c.setFont(font, size)
            if anchor == "middle":
                c.drawCentredString(x, y, text)
            elif anchor == "left":
                c.drawString(x, y, text)
            else:
                c.drawRightString(x, y, text)

        # Boxes for labels
        def label_box(text, x, y, bg=WHITE, tc=DARK_BLUE, size=7.5, bold=True, w=None):
            c.setFont("Helvetica-Bold" if bold else "Helvetica", size)
            tw = c.stringWidth(text, "Helvetica-Bold" if bold else "Helvetica", size)
            bw = (w or tw) + 8
            bh = size + 5
            c.setFillColor(bg)
            c.setStrokeColor(tc)
            c.setLineWidth(0.5)
            c.roundRect(x - bw/2, y - 3, bw, bh, 3, fill=1, stroke=1)
            c.setFillColor(tc)
            c.drawCentredString(x, y + 1, text)

        # ACoA
        label_box("ACoA", cx, cy + 91, bg=colors.HexColor("#fff3cd"), tc=comm, size=7.5)
        # ACAs
        label_box("ACA (L)", cx - 38, cy + 126, bg=PALE_RED, tc=arterial, size=7)
        label_box("ACA (R)", cx + 38, cy + 126, bg=PALE_RED, tc=arterial, size=7)
        # ICAs
        label_box("ICA (L)", cx - 85, cy - 92, bg=PALE_RED, tc=arterial, size=7)
        label_box("ICA (R)", cx + 85, cy - 92, bg=PALE_RED, tc=arterial, size=7)
        # MCAs
        label_box("MCA (L)", cx - 138, cy + 29, bg=PALE_RED, tc=arterial, size=7)
        label_box("MCA (R)", cx + 138, cy + 29, bg=PALE_RED, tc=arterial, size=7)
        # PCoAs
        label_box("PCoA (L)", cx - 85, cy - 8, bg=colors.HexColor("#fff3cd"), tc=comm, size=7)
        label_box("PCoA (R)", cx + 85, cy - 8, bg=colors.HexColor("#fff3cd"), tc=comm, size=7)
        # PCAs
        label_box("PCA (L)", cx - 62, cy - 72, bg=colors.HexColor("#ede7f6"), tc=vert, size=7)
        label_box("PCA (R)", cx + 62, cy - 72, bg=colors.HexColor("#ede7f6"), tc=vert, size=7)
        # Basilar
        label_box("Basilar A.", cx, cy - 100, bg=colors.HexColor("#ede7f6"), tc=vert, size=7.5)
        # Vertebrals
        label_box("Vertebral A. (L)", cx - 60, cy - 160, bg=colors.HexColor("#ede7f6"), tc=vert, size=7)
        label_box("Vertebral A. (R)", cx + 60, cy - 160, bg=colors.HexColor("#ede7f6"), tc=vert, size=7)

        # ── Legend ────────────────────────────────────────────────────────
        lx, ly = 14, 26
        c.setFont("Helvetica-Bold", 7.5)
        c.setFillColor(DARK_BLUE)
        c.drawString(lx, ly + 28, "Legend:")
        for col, lbl in [(arterial, "Anterior circulation (ICA)"),
                         (comm,     "Communicating arteries"),
                         (vert,     "Posterior circulation (Vertebrobasilar)")]:
            c.setStrokeColor(col); c.setFillColor(col); c.setLineWidth(3)
            c.line(lx, ly + 5, lx + 18, ly + 5)
            c.setFillColor(DARK_BLUE); c.setFont("Helvetica", 7)
            c.drawString(lx + 22, ly + 2, lbl)
            ly -= 13

        # dashed = communicating note
        c.setStrokeColor(comm); c.setLineWidth(2); c.setDash([4,3])
        c.line(lx, ly + 5 + 13 - 2, lx + 18, ly + 5 + 13 - 2)
        c.setDash([])
        c.setFillColor(GREY); c.setFont("Helvetica-Oblique", 6.5)
        c.drawString(lx + 22, ly + 5 + 10, "dashed = communicating arteries")


# ── Build document ────────────────────────────────────────────────────────────
def build():
    doc = SimpleDocTemplate(
        OUTPUT,
        pagesize=A4,
        leftMargin=18*mm, rightMargin=18*mm,
        topMargin=14*mm,  bottomMargin=14*mm,
        title="Circle of Willis - Quick Reference",
        author="Orris Medical"
    )

    W = A4[0] - 36*mm  # usable width
    story = []

    # ── TITLE BANNER ──────────────────────────────────────────────────────────
    story.append(TitleBanner(W, 62))
    # Overlay text via table (hacky but works nicely)
    title_data = [[
        Paragraph("<font color='white'><b>Circle of Willis</b></font>",
                  ParagraphStyle("t", fontSize=21, fontName="Helvetica-Bold",
                                 textColor=WHITE, alignment=TA_CENTER)),
    ]]
    title_tbl = Table(title_data, colWidths=[W])
    title_tbl.setStyle(TableStyle([
        ("BACKGROUND", (0,0), (-1,-1), colors.transparent),
        ("TOPPADDING",  (0,0), (-1,-1), -55),
        ("BOTTOMPADDING", (0,0), (-1,-1), 10),
    ]))
    story.append(title_tbl)

    sub_data = [[
        Paragraph("<font color='#cfe0ff'>Quick Reference for 1st Year MBBS Anatomy Exam</font>",
                  ParagraphStyle("s", fontSize=10, fontName="Helvetica",
                                 textColor=colors.HexColor("#cfe0ff"), alignment=TA_CENTER)),
    ]]
    sub_tbl = Table(sub_data, colWidths=[W])
    sub_tbl.setStyle(TableStyle([
        ("BACKGROUND", (0,0), (-1,-1), DARK_BLUE),
        ("TOPPADDING",  (0,0), (-1,-1), 2),
        ("BOTTOMPADDING", (0,0), (-1,-1), 8),
    ]))
    story.append(sub_tbl)
    story.append(Spacer(1, 6))

    # ── SECTION HELPER ────────────────────────────────────────────────────────
    def section(title):
        data = [[Paragraph(f"<b>{title}</b>",
                           ParagraphStyle("sh", fontSize=10.5, fontName="Helvetica-Bold",
                                          textColor=WHITE))]]
        t = Table(data, colWidths=[W])
        t.setStyle(TableStyle([
            ("BACKGROUND",    (0,0), (-1,-1), MED_BLUE),
            ("TOPPADDING",    (0,0), (-1,-1), 5),
            ("BOTTOMPADDING", (0,0), (-1,-1), 5),
            ("LEFTPADDING",   (0,0), (-1,-1), 8),
        ]))
        return t

    def info_box(paragraphs_list, bg=LIGHT_BLUE, border=MED_BLUE):
        data = [[p] for p in paragraphs_list]
        t = Table(data, colWidths=[W - 4])
        t.setStyle(TableStyle([
            ("BACKGROUND",    (0,0), (-1,-1), bg),
            ("BOX",           (0,0), (-1,-1), 0.8, border),
            ("TOPPADDING",    (0,0), (-1,-1), 3),
            ("BOTTOMPADDING", (0,0), (-1,-1), 3),
            ("LEFTPADDING",   (0,0), (-1,-1), 8),
            ("RIGHTPADDING",  (0,0), (-1,-1), 8),
        ]))
        return t

    # ── 1. DEFINITION ─────────────────────────────────────────────────────────
    story.append(section("1. Definition & Location"))
    story.append(Spacer(1, 4))
    story.append(info_box([
        Paragraph(
            "The <b>Circle of Willis</b> (cerebral arterial circle) is a <b>polygonal "
            "anastomotic ring of arteries</b> located at the <b>base of the brain</b> "
            "in the interpeduncular cistern of the subarachnoid space.",
            body_style),
        Paragraph(
            "It unites the <b>anterior circulation</b> (internal carotid arteries) with "
            "the <b>posterior circulation</b> (vertebral-basilar system), providing "
            "collateral pathways to protect the brain from ischaemia.",
            body_style),
    ]))
    story.append(Spacer(1, 6))

    # ── 2. DIAGRAM ────────────────────────────────────────────────────────────
    story.append(section("2. Schematic Diagram"))
    story.append(Spacer(1, 4))
    story.append(CircleOfWillisDiagram(width=W, height=295))
    story.append(Paragraph(
        "Fig: Schematic of the Circle of Willis. Red = anterior circulation; "
        "Orange = communicating arteries; Purple = posterior (vertebrobasilar) circulation.",
        caption_style))
    story.append(Spacer(1, 4))

    # ── 3. COMPONENTS TABLE ───────────────────────────────────────────────────
    story.append(section("3. Components of the Circle of Willis"))
    story.append(Spacer(1, 4))

    comp_header = ["Vessel", "Paired/Single", "Origin", "Part of Circle"]
    comp_data = [
        comp_header,
        ["Anterior Cerebral A. (ACA)", "Paired (L & R)", "Internal Carotid A.", "Anterior"],
        ["Anterior Communicating A. (ACoA)", "Single (unpaired)", "Between the 2 ACAs", "Anterior (connector)"],
        ["Internal Carotid A. (ICA)", "Paired (L & R)", "Common Carotid A.", "Lateral struts (inflow)"],
        ["Posterior Communicating A. (PCoA)", "Paired (L & R)", "ICA → PCA", "Middle (connector)"],
        ["Posterior Cerebral A. (PCA)", "Paired (L & R)", "Basilar Artery (top)", "Posterior"],
        ["Basilar Artery", "Single", "Union of 2 Vertebral A.", "Posterior inflow"],
    ]

    hdr_style = [
        ("BACKGROUND",   (0,0), (-1,0),  DARK_BLUE),
        ("TEXTCOLOR",    (0,0), (-1,0),  WHITE),
        ("FONTNAME",     (0,0), (-1,0),  "Helvetica-Bold"),
        ("FONTSIZE",     (0,0), (-1,-1), 8.5),
        ("ROWBACKGROUNDS",(0,1),(-1,-1), [WHITE, LIGHT_BLUE]),
        ("GRID",         (0,0), (-1,-1), 0.4, colors.HexColor("#aaaaaa")),
        ("TOPPADDING",   (0,0), (-1,-1), 4),
        ("BOTTOMPADDING",(0,0), (-1,-1), 4),
        ("LEFTPADDING",  (0,0), (-1,-1), 6),
    ]

    col_w = [W*0.32, W*0.17, W*0.25, W*0.26]
    comp_tbl = Table(
        [[Paragraph(str(cell), ParagraphStyle("ct", fontSize=8.5, fontName="Helvetica",
                                               textColor=WHITE if r==0 else DARK_BLUE,
                                               leading=11))
          for cell in row] for r, row in enumerate(comp_data)],
        colWidths=col_w
    )
    comp_tbl.setStyle(TableStyle(hdr_style))
    story.append(comp_tbl)
    story.append(Spacer(1, 6))

    # ── 4. THREE MAIN CEREBRAL ARTERIES ───────────────────────────────────────
    story.append(section("4. The Three Main Cerebral Arteries — Supply & Stroke Effects"))
    story.append(Spacer(1, 4))

    artery_data = [
        ["Artery", "Course", "Cortical Supply", "Deep Supply", "Stroke Deficit"],
        ["ACA\n(Anterior\nCerebral A.)",
         "Forward, curves over corpus callosum in interhemispheric fissure",
         "Medial frontal & parietal lobes; sensorimotor cortex for lower limb",
         "Anterior limb internal capsule, head of caudate (via Heubner's a.)",
         "Contralateral LEG weakness/sensory loss"],
        ["MCA\n(Middle\nCerebral A.)",
         "Lateral into Sylvian (lateral) fissure; bifurcates into sup. & inf. divisions",
         "Entire lateral hemisphere — face, arm, trunk cortex; Broca's; Wernicke's",
         "Internal capsule (posterior limb), basal ganglia (lenticulostriate aa.)",
         "Contralateral FACE + ARM weakness; aphasia (dominant side)"],
        ["PCA\n(Posterior\nCerebral A.)",
         "Wraps around cerebral peduncle, passes posteriorly",
         "Occipital lobe (primary visual cortex), medial-inferior temporal lobe",
         "Thalamus, midbrain, posterior internal capsule",
         "Contralateral homonymous hemianopia; thalamic pain syndrome"],
    ]

    artery_col_w = [W*0.10, W*0.18, W*0.26, W*0.22, W*0.24]
    row_colors = [DARK_BLUE, colors.HexColor("#fdecea"), colors.HexColor("#e8f5e9"),
                  colors.HexColor("#ede7f6")]

    artery_tbl_data = []
    for r, row in enumerate(artery_data):
        tc = WHITE if r == 0 else DARK_BLUE
        artery_tbl_data.append([
            Paragraph(f"<b>{cell}</b>" if r == 0 else str(cell),
                      ParagraphStyle("at", fontSize=8, fontName="Helvetica-Bold" if r==0 else "Helvetica",
                                     textColor=tc, leading=11))
            for cell in row
        ])

    artery_tbl = Table(artery_tbl_data, colWidths=artery_col_w)
    artery_tbl.setStyle(TableStyle([
        ("BACKGROUND",    (0,0), (-1,0),  DARK_BLUE),
        ("BACKGROUND",    (0,1), (-1,1),  colors.HexColor("#fdecea")),
        ("BACKGROUND",    (0,2), (-1,2),  colors.HexColor("#e8f5e9")),
        ("BACKGROUND",    (0,3), (-1,3),  colors.HexColor("#ede7f6")),
        ("GRID",          (0,0), (-1,-1), 0.4, colors.HexColor("#aaaaaa")),
        ("FONTNAME",      (0,0), (-1,0),  "Helvetica-Bold"),
        ("FONTSIZE",      (0,0), (-1,-1), 8),
        ("TOPPADDING",    (0,0), (-1,-1), 4),
        ("BOTTOMPADDING", (0,0), (-1,-1), 4),
        ("LEFTPADDING",   (0,0), (-1,-1), 5),
        ("VALIGN",        (0,0), (-1,-1), "TOP"),
    ]))
    story.append(artery_tbl)
    story.append(Spacer(1, 6))

    # ── 5. MNEMONICS ──────────────────────────────────────────────────────────
    story.append(section("5. Mnemonics"))
    story.append(Spacer(1, 4))

    mnem_data = [
        [
            Paragraph("<b>Branches of Supraclinoid ICA</b>", bold_style),
            Paragraph("<b>OPAAM</b>", ParagraphStyle("mn", fontSize=13, fontName="Helvetica-Bold",
                                                      textColor=ACCENT_RED, alignment=TA_CENTER)),
        ],
        [
            Paragraph(
                "<b>O</b>phthalmic artery<br/>"
                "<b>P</b>osterior communicating artery<br/>"
                "<b>A</b>nterior choroidal artery<br/>"
                "<b>A</b>nterior cerebral artery<br/>"
                "<b>M</b>iddle cerebral artery",
                bullet_style),
            Paragraph(
                "<b>Vessels forming the circle</b><br/><br/>"
                "2 ACA + 1 ACoA<br/>"
                "2 ICA (supraclinoid)<br/>"
                "2 PCoA<br/>"
                "2 PCA<br/>"
                "<b>= 9 named vessels total</b>",
                bullet_style),
        ]
    ]
    mnem_tbl = Table(mnem_data, colWidths=[W*0.5, W*0.5])
    mnem_tbl.setStyle(TableStyle([
        ("BACKGROUND",    (0,0), (0,0), PALE_GOLD),
        ("BACKGROUND",    (1,0), (1,0), PALE_GOLD),
        ("BACKGROUND",    (0,1), (0,1), PALE_GOLD),
        ("BACKGROUND",    (1,1), (1,1), LIGHT_BLUE),
        ("BOX",           (0,0), (-1,-1), 0.8, MED_BLUE),
        ("INNERGRID",     (0,0), (-1,-1), 0.4, colors.HexColor("#aaaaaa")),
        ("TOPPADDING",    (0,0), (-1,-1), 5),
        ("BOTTOMPADDING", (0,0), (-1,-1), 5),
        ("LEFTPADDING",   (0,0), (-1,-1), 8),
        ("VALIGN",        (0,0), (-1,-1), "TOP"),
        ("SPAN",          (0,0), (0,0)),
    ]))
    story.append(mnem_tbl)
    story.append(Spacer(1, 6))

    # ── 6. CLINICAL CORRELATES ────────────────────────────────────────────────
    story.append(section("6. Clinical Correlates (High Yield for Exams)"))
    story.append(Spacer(1, 4))

    clin_data = [
        ["Condition", "Mechanism", "Key Feature"],
        ["Berry (Saccular) Aneurysm",
         "Congenital weakness at bifurcation points of the circle; haemodynamic stress",
         "Rupture → Subarachnoid haemorrhage (SAH) — 'worst headache of life'"],
        ["PCoA Aneurysm → CN III Palsy",
         "Enlarging PCoA aneurysm compresses CN III as it runs nearby",
         "Ptosis + dilated pupil + 'down & out' eye — neurosurgical emergency"],
        ["MCA Stroke",
         "Occlusion of MCA (most common stroke territory — largest territory)",
         "Contralateral face + arm weakness; aphasia if dominant hemisphere"],
        ["ACA Stroke",
         "Occlusion of ACA; rarer as ACoA provides collateral",
         "Contralateral LEG weakness (medial sensorimotor cortex)"],
        ["Posterior circulation (Basilar) Stroke",
         "Basilar artery occlusion affects pons + cerebellum + midbrain",
         "'Locked-in' syndrome; cerebellar ataxia; cranial nerve palsies"],
        ["Incomplete Circle of Willis",
         "Present in ~66% of people; common variant: hypoplastic A1 or 'fetal' PCA",
         "Reduced collateral reserve; increased stroke risk on vessel occlusion"],
    ]

    clin_col_w = [W*0.26, W*0.38, W*0.36]
    clin_tbl_data = []
    for r, row in enumerate(clin_data):
        tc = WHITE if r == 0 else DARK_BLUE
        clin_tbl_data.append([
            Paragraph(f"<b>{cell}</b>" if r == 0 else str(cell),
                      ParagraphStyle("clt", fontSize=8, fontName="Helvetica-Bold" if r==0 else "Helvetica",
                                     textColor=tc, leading=11))
            for cell in row
        ])

    clin_tbl = Table(clin_tbl_data, colWidths=clin_col_w)
    clin_tbl.setStyle(TableStyle([
        ("BACKGROUND",    (0,0), (-1,0),  DARK_BLUE),
        ("ROWBACKGROUNDS",(0,1),(-1,-1),  [WHITE, PALE_RED]),
        ("GRID",          (0,0), (-1,-1), 0.4, colors.HexColor("#aaaaaa")),
        ("FONTSIZE",      (0,0), (-1,-1), 8),
        ("TOPPADDING",    (0,0), (-1,-1), 4),
        ("BOTTOMPADDING", (0,0), (-1,-1), 4),
        ("LEFTPADDING",   (0,0), (-1,-1), 5),
        ("VALIGN",        (0,0), (-1,-1), "TOP"),
    ]))
    story.append(clin_tbl)
    story.append(Spacer(1, 6))

    # ── 7. QUICK REVISION SUMMARY ─────────────────────────────────────────────
    story.append(section("7. Quick Revision Summary"))
    story.append(Spacer(1, 4))

    summary_items = [
        ("<b>Location:</b>", "Base of brain, interpeduncular cistern, subarachnoid space"),
        ("<b>Function:</b>", "Equaliser — allows collateral flow between anterior/posterior "
                             "and left/right circulations when one vessel is occluded"),
        ("<b>Anterior inflow:</b>", "Internal Carotid Arteries (ICA) — gives ACA + MCA"),
        ("<b>Posterior inflow:</b>", "Vertebral Arteries → Basilar Artery → PCA"),
        ("<b>Anterior connector:</b>", "Anterior Communicating Artery (ACoA) — joins the 2 ACAs"),
        ("<b>Lateral connectors:</b>", "Posterior Communicating Arteries (PCoA) — join ICA to PCA"),
        ("<b>Completeness:</b>", "Full ring present in only ~34% of individuals"),
        ("<b>Valves:</b>", "NO valves in cerebral veins/venous sinuses (relevant for infection spread)"),
        ("<b>Most common aneurysm site:</b>", "ACoA > PCoA > MCA bifurcation"),
        ("<b>Artery of Heubner:</b>", "Large medial striate branch of ACA — supplies anterior limb of internal capsule"),
    ]

    summary_rows = [[
        Paragraph(lbl, ParagraphStyle("sl", fontSize=8.5, fontName="Helvetica-Bold",
                                       textColor=DARK_BLUE, leading=12)),
        Paragraph(val, ParagraphStyle("sv", fontSize=8.5, fontName="Helvetica",
                                       textColor=colors.HexColor("#1a1a1a"), leading=12))
    ] for lbl, val in summary_items]

    sum_tbl = Table(summary_rows, colWidths=[W*0.30, W*0.70])
    sum_tbl.setStyle(TableStyle([
        ("ROWBACKGROUNDS", (0,0), (-1,-1), [WHITE, LIGHT_BLUE]),
        ("GRID",           (0,0), (-1,-1), 0.3, colors.HexColor("#cccccc")),
        ("TOPPADDING",     (0,0), (-1,-1), 4),
        ("BOTTOMPADDING",  (0,0), (-1,-1), 4),
        ("LEFTPADDING",    (0,0), (-1,-1), 6),
        ("VALIGN",         (0,0), (-1,-1), "TOP"),
    ]))
    story.append(sum_tbl)
    story.append(Spacer(1, 8))

    # ── Footer ────────────────────────────────────────────────────────────────
    footer_data = [[
        Paragraph(
            "<font color='white'>Sources: Neuroanatomy through Clinical Cases 3e · Goldman-Cecil Medicine 22E · "
            "Miller's Anesthesia 10E · Gray's Anatomy for Students &nbsp;|&nbsp; Generated by Orris Medical AI</font>",
            ParagraphStyle("ft", fontSize=7, fontName="Helvetica", textColor=WHITE,
                           alignment=TA_CENTER, leading=10))
    ]]
    footer_tbl = Table(footer_data, colWidths=[W])
    footer_tbl.setStyle(TableStyle([
        ("BACKGROUND",    (0,0), (-1,-1), DARK_BLUE),
        ("TOPPADDING",    (0,0), (-1,-1), 5),
        ("BOTTOMPADDING", (0,0), (-1,-1), 5),
    ]))
    story.append(footer_tbl)

    doc.build(story)
    print(f"PDF created: {OUTPUT}")


build()
Running Command

cd /home/daytona/workspace/circle-of-willis && python3 generate_pdf.py 2>&1

Running Command

ls -lh /home/daytona/workspace/circle-of-willis/

Your PDF is ready! Here it is:

Circle of Willis Quick Reference

PDF Document · PDF


Here's what's packed into the single A4 page reference:
  1. Title banner - colour-coded header with subtitle
  2. Schematic diagram - hand-drawn style Circle of Willis with all vessels labelled and colour-coded:
    • Red = anterior circulation (ICA, ACA, MCA)
    • Orange = communicating arteries (ACoA, PCoA)
    • Purple = posterior/vertebrobasilar (vertebrals, basilar, PCA)
  3. Components table - all 9 vessels, their origin and position in the circle
  4. Three main cerebral arteries - course, cortical supply, deep supply, and stroke deficit for ACA / MCA / PCA
  5. Mnemonics - OPAAM for branches of ICA; vessel count memory aid
  6. Clinical correlates - berry aneurysm, PCoA/CN III palsy, stroke syndromes, incomplete circle
  7. Quick revision summary - 10 high-yield bullet points for last-minute review
  8. Source citations at the footer
This is a shared conversation. Sign in to Orris to start your own chat.