What is mean by dural venous sinuses

| Sinus | Location | What It Receives |
|---|---|---|
| Superior sagittal | Superior border of falx cerebri | Superior cerebral veins, diploic veins, emissary veins, and CSF |
| Inferior sagittal | Inferior margin of falx cerebri | A few cerebral veins and veins from the falx |
| Straight | Junction of falx cerebri and tentorium cerebelli | Inferior sagittal sinus + great cerebral vein |
| Occipital | In falx cerebelli against occipital bone | Communicates with vertebral venous plexus |
| Confluence of sinuses | At internal occipital protuberance | Receives superior sagittal, straight, and occipital sinuses |
| Transverse (right & left) | Along posterior/lateral attachment of tentorium cerebelli | From confluence of sinuses, superior petrosal sinus |
| Sigmoid (right & left) | Continuation of transverse sinuses to internal jugular vein | Transverse sinuses, cerebral and cerebellar veins |
| Cavernous (paired) | Lateral to body of sphenoid / beside sella turcica | Ophthalmic veins, sphenoparietal sinus, cerebral veins |
| Intercavernous | Crossing the sella turcica | Interconnects the two cavernous sinuses |
| Sphenoparietal (paired) | Inferior surface of lesser wings of sphenoid | Diploic and meningeal veins |
| Superior petrosal (paired) | Superior margin of petrous temporal bone | Connects cavernous to transverse/sigmoid sinuses |
| Inferior petrosal (paired) | Inferior border of petrous temporal bone | Drains cavernous sinus to internal jugular vein; receives labyrinthine veins |
| Basilar plexus | On the clivus | Connects cavernous sinus with marginal sinus |
| Marginal sinus | Encircles foramen magnum | Connects dural sinuses with vertebral venous plexuses |
Exaplian facial nerve maxillary nerve and mandibular nerve and all there branches
| Branch | Function |
|---|---|
| Greater petrosal nerve (from geniculate ganglion) | Carries preganglionic parasympathetic fibers to the pterygopalatine ganglion → secretomotor to lacrimal gland and nasal/palatal glands; also carries taste from the soft palate |
| Nerve to stapedius | Motor to the stapedius muscle in the middle ear (dampens loud sounds) |
| Chorda tympani | Carries taste from anterior 2/3 of tongue + preganglionic parasympathetic to submandibular ganglion → submandibular and sublingual salivary glands. Passes through the middle ear across the tympanic membrane, exits through the petrotympanic fissure, and joins the lingual nerve (V3) in the infratemporal fossa |
| Branch | Muscles Supplied | Area |
|---|---|---|
| Temporal | Frontalis, orbicularis oculi (upper), corrugator supercilii | Forehead, upper face |
| Zygomatic | Orbicularis oculi (lower), zygomaticus | Mid-face, cheek |
| Buccal | Buccinator, orbicularis oris, upper lip muscles | Cheek, upper lip |
| Marginal mandibular | Lower lip muscles, mentalis, depressor anguli oris | Lower lip, chin |
| Cervical | Platysma | Neck |
Note: These are all motor branches - the facial nerve does NOT carry sensation to the face (that is the trigeminal nerve's job).

| Branch | Sensory Territory |
|---|---|
| Meningeal branch | Dura mater of the middle cranial fossa |
| Ganglionic branches (2) to pterygopalatine ganglion | Carries secretomotor fibers (from CN VII via greater petrosal nerve) to the lacrimal gland; conducts nasal and palatine sensation |
| Zygomatic nerve | Splits into two: Zygomaticotemporal (skin of the temple) and Zygomaticofacial (skin over the cheekbone/zygomatic prominence) |
| Superior alveolar nerves (posterior, middle, anterior) | Upper teeth and gums via the superior dental plexus; anterior superior alveolar branch also supplies the lateral nasal wall, nasal septum, lower eyelid, and upper lip skin |
| Infraorbital nerve (terminal branch) | Skin of the cheek, midlateral nose, lower eyelid, upper lip mucosa |
| Palatine nerves (greater and lesser) | Greater: hard palate mucosa; Lesser: soft palate and tonsil region |
| Nasal branches (posterior superior lateral/medial; nasopalatine) | Lateral wall and septum of nasal cavity; nasopalatine nerve passes through the incisive canal to supply oral mucosa behind the incisor teeth |
| Pharyngeal branch | Mucosa of the nasopharynx |
Pterygopalatine (sphenopalatine) ganglion is suspended from V2 in the pterygopalatine fossa. It receives preganglionic parasympathetic fibers from CN VII via the greater petrosal nerve + sympathetic fibers from the deep petrosal nerve. Postganglionic fibers distribute via V2 branches to the lacrimal gland, nasal glands, and palatal glands.
| Branch | Type | Target |
|---|---|---|
| Buccal nerve | Mainly sensory | Skin and mucosa of the cheek; buccal gingivae of lower molars |
| Masseteric nerve | Motor | Masseter muscle |
| Deep temporal nerves (usually 2) | Motor | Temporalis muscle |
| Nerve to lateral pterygoid | Motor | Lateral pterygoid muscle |
| Branch | Type | Target |
|---|---|---|
| Auriculotemporal nerve | Sensory + carries parasympathetic | Skin of the temple (main area); external ear, external acoustic meatus, tympanic membrane, TMJ; also delivers postganglionic parasympathetic fibers from the otic ganglion (CN IX origin) to the parotid gland |
| Lingual nerve | Sensory (joined by chorda tympani) | General sensation from anterior 2/3 of tongue, oral floor mucosa, lingual gingivae. Chorda tympani joins it in the infratemporal fossa, adding taste from anterior 2/3 of tongue and parasympathetic supply to submandibular and sublingual glands |
| Inferior alveolar nerve | Sensory + one motor branch | All lower teeth and much of the gingivae; lower lip and chin skin. Gives off: nerve to mylohyoid (motor - to mylohyoid and anterior belly of digastric) just before entering the mandibular foramen; then divides into incisive nerve (to front lower teeth) and mental nerve (exits through mental foramen → lower lip and chin skin) |
| Branch | Target |
|---|---|
| Meningeal branch | Dura mater of middle cranial fossa; exits through foramen spinosum with middle meningeal artery |
| Nerve to medial pterygoid | Medial pterygoid; gives branches to tensor tympani and tensor veli palatini |

| Feature | Facial Nerve (CN VII) | Maxillary Nerve (CN V2) | Mandibular Nerve (CN V3) |
|---|---|---|---|
| Nerve type | Mixed (motor + sensory + parasympathetic) | Purely sensory | Mixed (sensory + motor) |
| Exits skull via | Stylomastoid foramen | Foramen rotundum | Foramen ovale |
| Motor function | Muscles of facial expression, stapedius, stylohyoid, posterior digastric | None | Muscles of mastication, tensor tympani, tensor veli palatini, mylohyoid, ant. belly of digastric |
| Sensory territory | Anterior 2/3 tongue (taste); small area of ear | Cheek, lower eyelid, upper lip, upper teeth, palate, nasal cavity | Lower face, lower lip, anterior 2/3 tongue (general), lower teeth, temporal region |
| Parasympathetic | To lacrimal gland (via greater petrosal), submandibular + sublingual glands (via chorda tympani) | None (carries postganglionic fibers FROM pterygopalatine ganglion) | Carries parasympathetic to parotid (via auriculotemporal + otic ganglion, origin from CN IX) |
| Associated ganglion | Geniculate ganglion (sensory), submandibular ganglion (parasympathetic) | Pterygopalatine (sphenopalatine) ganglion | Otic ganglion |
Make a detailed branching diagram PDF I can reference during exams
ls -la /tmp/workspace/ 2>/dev/null || echo "workspace empty or not found"
mkdir -p /tmp/workspace/nerve-diagram && python3 -c "import reportlab; print('reportlab ok')"
~/nerve-diagram/generate_pdf.py
from reportlab.lib.pagesizes import A3, landscape
from reportlab.lib import colors
from reportlab.lib.units import mm
from reportlab.pdfgen import canvas
from reportlab.lib.colors import HexColor
OUTPUT = "/tmp/workspace/nerve-diagram/Cranial_Nerve_Branches_Reference.pdf"
# ── Colour palette ──────────────────────────────────────────────────────────
C_CN7 = HexColor("#1565C0") # deep blue – facial nerve
C_CN7L = HexColor("#BBDEFB") # light blue – facial boxes
C_CN7M = HexColor("#1976D2") # mid blue
C_CN5V2 = HexColor("#6A1B9A") # deep purple – maxillary
C_CN5V2L = HexColor("#E1BEE7")
C_CN5V3 = HexColor("#2E7D32") # deep green – mandibular
C_CN5V3L = HexColor("#C8E6C9")
C_MOTOR = HexColor("#E65100") # orange – motor
C_SENS = HexColor("#37474F") # dark grey – sensory
C_PARA = HexColor("#00838F") # teal – parasympathetic
C_LINE = HexColor("#757575")
C_BG = HexColor("#FAFAFA")
C_TITLE = HexColor("#212121")
C_HEAD = HexColor("#ECEFF1")
PAGE_W, PAGE_H = landscape(A3)
MARGIN = 14*mm
# ── Canvas ───────────────────────────────────────────────────────────────────
c = canvas.Canvas(OUTPUT, pagesize=landscape(A3))
c.setTitle("Cranial Nerve Branching Diagram – CN VII, V2, V3")
def set_font(cv, name="Helvetica", size=8):
cv.setFont(name, size)
def rounded_rect(cv, x, y, w, h, r=4, fill_color=None, stroke_color=C_LINE, lw=0.6):
cv.setLineWidth(lw)
if fill_color:
cv.setFillColor(fill_color)
if stroke_color:
cv.setStrokeColor(stroke_color)
cv.roundRect(x, y, w, h, r, stroke=1 if stroke_color else 0, fill=1 if fill_color else 0)
def draw_label(cv, x, y, w, h, lines, fill_color, text_color=C_TITLE, font_size=7.2, bold=False):
rounded_rect(cv, x, y, w, h, r=3, fill_color=fill_color, stroke_color=C_LINE, lw=0.5)
font = "Helvetica-Bold" if bold else "Helvetica"
cv.setFillColor(text_color)
total_h = len(lines) * (font_size + 1.5)
ty = y + h/2 + total_h/2 - (font_size + 1.5)
for line in lines:
cv.setFont(font, font_size)
cv.drawCentredString(x + w/2, ty, line)
ty -= (font_size + 1.5)
def line(cv, x1, y1, x2, y2, color=C_LINE, lw=0.7):
cv.setStrokeColor(color)
cv.setLineWidth(lw)
cv.line(x1, y1, x2, y2)
def arrow_line(cv, x1, y1, x2, y2, color=C_LINE, lw=0.7):
line(cv, x1, y1, x2, y2, color, lw)
# small arrowhead
import math
dx, dy = x2-x1, y2-y1
length = math.sqrt(dx*dx+dy*dy)
if length == 0: return
ux, uy = dx/length, dy/length
ax = x2 - 4*ux + 2*uy
ay = y2 - 4*uy - 2*ux
bx = x2 - 4*ux - 2*uy
by = y2 - 4*uy + 2*ux
cv.setFillColor(color)
p = cv.beginPath()
p.moveTo(x2, y2); p.lineTo(ax, ay); p.lineTo(bx, by); p.close()
cv.drawPath(p, fill=1, stroke=0)
# ── Legend ────────────────────────────────────────────────────────────────────
def draw_legend(cv, x, y):
items = [
(C_MOTOR, "Motor"),
(C_SENS, "Sensory"),
(C_PARA, "Parasympathetic"),
(C_CN7L, "CN VII – Facial"),
(C_CN5V2L, "CN V2 – Maxillary"),
(C_CN5V3L, "CN V3 – Mandibular"),
]
cv.setFont("Helvetica-Bold", 7.5)
cv.setFillColor(C_TITLE)
cv.drawString(x, y+4, "LEGEND")
yi = y - 5
for col, label in items:
rounded_rect(cv, x, yi, 12, 7, r=2, fill_color=col, stroke_color=C_LINE, lw=0.4)
cv.setFillColor(C_TITLE)
cv.setFont("Helvetica", 7)
cv.drawString(x+14, yi+1.5, label)
yi -= 11
# ═══════════════════════════════════════════════════════════════════════════════
# PAGE 1 – FACIAL NERVE (CN VII)
# ═══════════════════════════════════════════════════════════════════════════════
def page1(cv):
cv.setFillColor(C_BG)
cv.rect(0, 0, PAGE_W, PAGE_H, fill=1, stroke=0)
# Title bar
cv.setFillColor(C_CN7)
cv.rect(0, PAGE_H-22*mm, PAGE_W, 22*mm, fill=1, stroke=0)
cv.setFillColor(colors.white)
cv.setFont("Helvetica-Bold", 16)
cv.drawCentredString(PAGE_W/2, PAGE_H-13*mm, "FACIAL NERVE (CN VII) – Complete Branching Diagram")
cv.setFont("Helvetica", 8.5)
cv.drawCentredString(PAGE_W/2, PAGE_H-19*mm, "Mixed nerve: Motor (BE) · Parasympathetic (GVE) · Taste (SA) · General sensory (GSA)")
draw_legend(cv, PAGE_W-52*mm, PAGE_H-36*mm)
# ── ROOT box ──────────────────────────────────────────────────────────────
RW, RH = 72*mm, 16*mm
RX = PAGE_W/2 - RW/2
RY = PAGE_H - 50*mm
draw_label(cv, RX, RY, RW, RH,
["CN VII – FACIAL NERVE",
"Arises: pons-medulla junction",
"Enters: Internal Acoustic Meatus (IAM)"],
fill_color=C_CN7, text_color=colors.white, font_size=7.5, bold=True)
# ── GENICULATE GANGLION ───────────────────────────────────────────────────
GGW, GGH = 60*mm, 11*mm
GGX = PAGE_W/2 - GGW/2
GGY = RY - 22*mm
arrow_line(cv, PAGE_W/2, RY, PAGE_W/2, GGY+GGH, C_CN7, 1.0)
draw_label(cv, GGX, GGY, GGW, GGH,
["GENICULATE GANGLION", "(sensory cell bodies; in petrous temporal bone)"],
fill_color=HexColor("#1E88E5"), text_color=colors.white, font_size=7.2, bold=True)
# ── GREATER PETROSAL NERVE ────────────────────────────────────────────────
GPX = 18*mm; GPY = GGY - 30*mm
GPW = 68*mm; GPH = 22*mm
line(cv, GGX, GGY+GGH/2, GPX+GPW, GGY+GGH/2, C_CN7, 0.8)
arrow_line(cv, GPX+GPW, GGY+GGH/2, GPX+GPW, GPY+GPH, C_CN7, 0.8)
draw_label(cv, GPX, GPY, GPW, GPH,
["GREATER PETROSAL NERVE",
"Parasympathetic (GVE): to pterygopalatine ganglion",
"→ Lacrimal gland secretomotor",
"→ Nasal & palatal mucosal glands",
"Taste: soft palate"],
fill_color=HexColor("#B3E5FC"), text_color=C_TITLE, font_size=6.8)
# ── NERVE TO STAPEDIUS ────────────────────────────────────────────────────
NSX = PAGE_W/2 + 20*mm; NSY = GGY - 22*mm
NSW = 52*mm; NSH = 9*mm
line(cv, GGX+GGW, GGY+GGH/2, NSX, GGY+GGH/2, C_CN7, 0.8)
arrow_line(cv, NSX, GGY+GGH/2, NSX, NSY+NSH, C_CN7, 0.8)
draw_label(cv, NSX, NSY, NSW, NSH,
["NERVE TO STAPEDIUS (Motor)", "Dampens loud sounds (middle ear)"],
fill_color=C_CN7L, font_size=6.5)
# ── CHORDA TYMPANI ────────────────────────────────────────────────────────
CTX = PAGE_W/2 - 8*mm; CTY = GGY - 46*mm
CTW = 70*mm; CTH = 22*mm
line(cv, GGX+GGW/2, GGY, GGX+GGW/2, CTY+CTH, C_CN7M, 0.8)
draw_label(cv, CTX, CTY, CTW, CTH,
["CHORDA TYMPANI",
"Taste (SA): anterior 2/3 tongue",
"Parasympathetic: to submandibular ganglion",
" → Submandibular & sublingual glands",
"Travels via petrotympanic fissure → joins LINGUAL N. (V3)"],
fill_color=HexColor("#B3E5FC"), text_color=C_TITLE, font_size=6.8)
# ── STYLOMASTOID FORAMEN ──────────────────────────────────────────────────
SFX = PAGE_W/2 - 40*mm; SFY = GGY - 72*mm
SFW = 80*mm; SFH = 10*mm
arrow_line(cv, PAGE_W/2, CTY, PAGE_W/2, SFY+SFH, C_CN7, 1.0)
draw_label(cv, SFX, SFY, SFW, SFH,
["Exits skull: STYLOMASTOID FORAMEN"],
fill_color=C_CN7, text_color=colors.white, font_size=7.5, bold=True)
# ── POST-EXIT BRANCHES ────────────────────────────────────────────────────
PEY = SFY - 18*mm
post = [
("POSTERIOR\nAURICULAR N.", "Motor: occipitalis,\nauricular muscles\nSensory: auricle", 4*mm),
("NERVE TO\nPOSTERIOR DIGASTRIC", "Motor: post. belly\nof digastric", PAGE_W/2-38*mm),
("NERVE TO\nSTYLOHYOID", "Motor: stylohyoid\nmuscle", PAGE_W/2-18*mm),
]
cx = 10*mm
for name, desc, _ in post:
bw, bh = 52*mm, 18*mm
arrow_line(cv, PAGE_W/2, SFY, cx+bw/2, PEY+bh, C_CN7, 0.7)
draw_label(cv, cx, PEY, bw, bh, [name, desc], fill_color=C_CN7L, font_size=6.3)
cx += 56*mm
# ── PAROTID GLAND / TERMINAL BRANCHES ────────────────────────────────────
PGY = PEY - 20*mm
PGX = PAGE_W/2 - 38*mm
PGW, PGH = 76*mm, 10*mm
arrow_line(cv, PAGE_W/2, PEY, PAGE_W/2, PGY+PGH, C_CN7, 1.0)
draw_label(cv, PGX, PGY, PGW, PGH,
["PAROTID GLAND (nerve divides into upper & lower trunks)"],
fill_color=C_CN7, text_color=colors.white, font_size=7, bold=True)
# Five terminal groups
terminals = [
("TEMPORAL", ["Frontalis","Orbicularis oculi (upper)","Corrugator supercilii","Auricular muscles"], 0),
("ZYGOMATIC", ["Orbicularis oculi (lower)","Zygomaticus major & minor","Levator labii"], 1),
("BUCCAL", ["Buccinator","Orbicularis oris","Levator anguli oris","Nasalis"], 2),
("MARGINAL\nMANDIBULAR", ["Depressor anguli oris","Depressor labii","Mentalis","Lower orbicularis"], 3),
("CERVICAL", ["Platysma"], 4),
]
TY = PGY - 34*mm
n = len(terminals)
total_w = PAGE_W - 2*MARGIN
bw = (total_w - (n-1)*4*mm) / n
bx = MARGIN
for name, muscles, _ in terminals:
bh = 28*mm
arrow_line(cv, PGX+PGW/2, PGY, bx+bw/2, TY+bh, C_CN7M, 0.7)
lines_ = [name] + muscles
draw_label(cv, bx, TY, bw, bh, lines_, fill_color=C_CN7L, font_size=6.3, bold=False)
bx += bw + 4*mm
# Note at bottom
cv.setFillColor(HexColor("#B71C1C"))
cv.setFont("Helvetica-BoldOblique", 7.5)
cv.drawCentredString(PAGE_W/2, 12*mm,
"★ All five terminal groups are PURELY MOTOR (facial nerve carries NO cutaneous sensation to the face – that is the trigeminal nerve)")
# Footer
cv.setFillColor(C_CN7)
cv.rect(0, 0, PAGE_W, 8*mm, fill=1, stroke=0)
cv.setFillColor(colors.white)
cv.setFont("Helvetica", 6.5)
cv.drawCentredString(PAGE_W/2, 2.5*mm, "Page 1 of 3 | CN VII Facial Nerve | Orris Medical Reference")
page1(c)
c.showPage()
# ═══════════════════════════════════════════════════════════════════════════════
# PAGE 2 – MAXILLARY NERVE (CN V2)
# ═══════════════════════════════════════════════════════════════════════════════
def page2(cv):
cv.setFillColor(C_BG)
cv.rect(0, 0, PAGE_W, PAGE_H, fill=1, stroke=0)
# Title bar
cv.setFillColor(C_CN5V2)
cv.rect(0, PAGE_H-22*mm, PAGE_W, 22*mm, fill=1, stroke=0)
cv.setFillColor(colors.white)
cv.setFont("Helvetica-Bold", 16)
cv.drawCentredString(PAGE_W/2, PAGE_H-13*mm, "MAXILLARY NERVE (CN V2) – Complete Branching Diagram")
cv.setFont("Helvetica", 8.5)
cv.drawCentredString(PAGE_W/2, PAGE_H-19*mm, "Purely SENSORY · Division of Trigeminal Nerve (CN V) · Exits: Foramen Rotundum → Pterygopalatine Fossa → Infraorbital Foramen")
draw_legend(cv, PAGE_W-52*mm, PAGE_H-36*mm)
# ── ROOT ──────────────────────────────────────────────────────────────────
RW, RH = 80*mm, 16*mm
RX = PAGE_W/2 - RW/2
RY = PAGE_H - 50*mm
draw_label(cv, RX, RY, RW, RH,
["MAXILLARY NERVE [V2]",
"Origin: Trigeminal ganglion (middle cranial fossa)",
"Exits: Foramen ROTUNDUM → Pterygopalatine fossa"],
fill_color=C_CN5V2, text_color=colors.white, font_size=7.5, bold=True)
# ── MENINGEAL BRANCH ──────────────────────────────────────────────────────
MBX = 12*mm; MBY = RY - 22*mm
MBW = 55*mm; MBH = 10*mm
line(cv, RX, RY+RH/2, MBX+MBW, RY+RH/2, C_CN5V2, 0.7)
arrow_line(cv, MBX+MBW, RY+RH/2, MBX+MBW, MBY+MBH, C_CN5V2, 0.7)
draw_label(cv, MBX, MBY, MBW, MBH,
["MENINGEAL BRANCH", "Sensory: dura of middle cranial fossa"],
fill_color=C_CN5V2L, font_size=6.5)
# ── PTERYGOPALATINE FOSSA ─────────────────────────────────────────────────
PPX = PAGE_W/2 - 42*mm; PPY = RY - 26*mm
PPW = 84*mm; PPH = 11*mm
arrow_line(cv, PAGE_W/2, RY, PAGE_W/2, PPY+PPH, C_CN5V2, 1.0)
draw_label(cv, PPX, PPY, PPW, PPH,
["In PTERYGOPALATINE FOSSA (associated with pterygopalatine/sphenopalatine ganglion)"],
fill_color=C_CN5V2, text_color=colors.white, font_size=7, bold=True)
# ── Ganglionic branches ───────────────────────────────────────────────────
GBX = 12*mm; GBY = PPY - 34*mm
GBW = 72*mm; GBH = 28*mm
line(cv, PPX, PPY+PPH/2, GBX+GBW, PPY+PPH/2, C_CN5V2, 0.7)
arrow_line(cv, GBX+GBW, PPY+PPH/2, GBX+GBW, GBY+GBH, C_CN5V2, 0.7)
draw_label(cv, GBX, GBY, GBW, GBH,
["GANGLIONIC (PTERYGOPALATINE) BRANCHES",
"2 branches suspend pterygopalatine ganglion",
"Ganglion receives GVE (parasympathetic) from:",
" Greater petrosal nerve (CN VII)",
"Postganglionic fibers distributed via V2 to:",
" Lacrimal gland · nasal glands · palatal glands"],
fill_color=C_CN5V2L, font_size=6.5)
# ── Zygomatic nerve ───────────────────────────────────────────────────────
ZNX = 96*mm; ZNY = PPY - 26*mm
ZNW = 58*mm; ZNH = 14*mm
line(cv, PPX+PPW/2, PPY, ZNX+ZNW/2, PPY, C_CN5V2, 0.7)
arrow_line(cv, ZNX+ZNW/2, PPY, ZNX+ZNW/2, ZNY+ZNH, C_CN5V2, 0.7)
draw_label(cv, ZNX, ZNY, ZNW, ZNH,
["ZYGOMATIC NERVE", "Runs in orbit; splits into 2 branches:"],
fill_color=C_CN5V2L, font_size=6.8, bold=True)
# Zygomatic sub-branches
subz = [
("Zygomatico-\nTEMPORAL N.", ["Skin: temple", "Also carries secretomotor\nto lacrimal gland\n(from CN VII via V2)"]),
("Zygomatico-\nFACIAL N.", ["Skin: prominence\nof cheek (zygoma)"]),
]
ZSY = ZNY - 24*mm
zx = ZNX - 4*mm
for name, desc in subz:
bw2 = 32*mm; bh2 = 20*mm
arrow_line(cv, ZNX+ZNW/2, ZNY, zx+bw2/2, ZSY+bh2, C_CN5V2, 0.6)
draw_label(cv, zx, ZSY, bw2, bh2, [name]+desc, fill_color=C_CN5V2L, font_size=6.2)
zx += 34*mm
# ── Superior alveolar nerves ───────────────────────────────────────────────
SAX = 175*mm; SAY = PPY - 38*mm
SAW = 70*mm; SAH = 32*mm
line(cv, PPX+PPW, PPY+PPH/2, SAX, PPY+PPH/2, C_CN5V2, 0.7)
arrow_line(cv, SAX, PPY+PPH/2, SAX, SAY+SAH, C_CN5V2, 0.7)
draw_label(cv, SAX, SAY, SAW, SAH,
["SUPERIOR ALVEOLAR NERVES",
"Form SUPERIOR DENTAL PLEXUS",
"",
"Posterior superior alveolar:",
" Upper molars + adjacent gingiva",
"Middle superior alveolar:",
" Upper premolars",
"Anterior superior alveolar (largest):",
" Incisors & canines + lateral nasal",
" wall, nasal septum, lower eyelid,",
" skin of upper lip"],
fill_color=C_CN5V2L, font_size=6.2)
# ── INFRAORBITAL N. (terminal) ─────────────────────────────────────────────
IOY = PPY - 52*mm
IOX = PAGE_W/2 - 34*mm
IOW = 68*mm; IOH = 14*mm
arrow_line(cv, PAGE_W/2, PPY, PAGE_W/2, IOY+IOH, C_CN5V2, 1.0)
draw_label(cv, IOX, IOY, IOW, IOH,
["INFRAORBITAL NERVE (terminal branch)",
"Exits via infraorbital foramen",
"Sensory: cheek skin, mid-lateral nose, lower eyelid, upper lip mucosa"],
fill_color=C_CN5V2, text_color=colors.white, font_size=6.8)
# ── Palatine & nasal branches from ganglion ────────────────────────────────
PNY = GBY - 32*mm
branches_pn = [
("GREATER\nPALATINE N.", ["Hard palate mucosa"]),
("LESSER\nPALATINE N.", ["Soft palate,\ntonsil region"]),
("POSTERIOR SUP.\nLATERAL NASAL", ["Lateral nasal\ncavity wall"]),
("NASOPALATINE\nNERVE", ["Nasal septum;\nexits incisive\ncanal → mucosa\nbehind incisors"]),
("PHARYNGEAL\nBRANCH", ["Nasopharyngeal\nmucosa"]),
]
total_pn = len(branches_pn)
bwpn = (PAGE_W - 2*MARGIN - (total_pn-1)*3*mm) / total_pn
bxpn = MARGIN
for name, desc in branches_pn:
bhpn = 28*mm
arrow_line(cv, GBX+GBW/2, GBY, bxpn+bwpn/2, PNY+bhpn, C_CN5V2, 0.6)
draw_label(cv, bxpn, PNY, bwpn, bhpn, [name]+desc, fill_color=C_CN5V2L, font_size=6.2)
bxpn += bwpn + 3*mm
# Footer
cv.setFillColor(C_CN5V2)
cv.rect(0, 0, PAGE_W, 8*mm, fill=1, stroke=0)
cv.setFillColor(colors.white)
cv.setFont("Helvetica", 6.5)
cv.drawCentredString(PAGE_W/2, 2.5*mm, "Page 2 of 3 | CN V2 Maxillary Nerve | Orris Medical Reference")
page2(c)
c.showPage()
# ═══════════════════════════════════════════════════════════════════════════════
# PAGE 3 – MANDIBULAR NERVE (CN V3)
# ═══════════════════════════════════════════════════════════════════════════════
def page3(cv):
cv.setFillColor(C_BG)
cv.rect(0, 0, PAGE_W, PAGE_H, fill=1, stroke=0)
# Title bar
cv.setFillColor(C_CN5V3)
cv.rect(0, PAGE_H-22*mm, PAGE_W, 22*mm, fill=1, stroke=0)
cv.setFillColor(colors.white)
cv.setFont("Helvetica-Bold", 16)
cv.drawCentredString(PAGE_W/2, PAGE_H-13*mm, "MANDIBULAR NERVE (CN V3) – Complete Branching Diagram")
cv.setFont("Helvetica", 8.5)
cv.drawCentredString(PAGE_W/2, PAGE_H-19*mm,
"MIXED nerve (only V division with MOTOR fibres) · Exits: Foramen OVALE → Infratemporal Fossa")
draw_legend(cv, PAGE_W-52*mm, PAGE_H-36*mm)
# ── ROOT ──────────────────────────────────────────────────────────────────
RW, RH = 88*mm, 18*mm
RX = PAGE_W/2 - RW/2
RY = PAGE_H - 52*mm
draw_label(cv, RX, RY, RW, RH,
["MANDIBULAR NERVE [V3]",
"Sensory root: trigeminal ganglion",
"Motor root: joins sensory part outside skull at foramen ovale",
"Both parts enter infratemporal fossa"],
fill_color=C_CN5V3, text_color=colors.white, font_size=7.2, bold=True)
# Immediate branches
IB_Y = RY - 22*mm
imm = [
("MENINGEAL BRANCH", ["Re-enters skull via foramen spinosum", "Sensory: dura, middle cranial fossa", "Also: mastoid air cells"]),
("NERVE TO\nMEDIAL PTERYGOID", ["Motor: medial pterygoid", "Gives branches to:", " • Tensor tympani", " • Tensor veli palatini"]),
]
ix = MARGIN
for name, desc in imm:
bw2 = 68*mm; bh2 = 26*mm
arrow_line(cv, RX+RW/2, RY, ix+bw2/2, IB_Y+bh2, C_CN5V3, 0.7)
draw_label(cv, ix, IB_Y, bw2, bh2, [name]+desc, fill_color=C_CN5V3L, font_size=6.5)
ix += bw2 + 8*mm
# ── ANTERIOR TRUNK ────────────────────────────────────────────────────────
AT_Y = IB_Y - 24*mm
ATX = MARGIN
ATW = (PAGE_W/2 - MARGIN - 6*mm)
ATH = 10*mm
line(cv, RX+RW*0.25, RY, ATX+ATW/2, RY, C_CN5V3, 0.9)
arrow_line(cv, ATX+ATW/2, RY, ATX+ATW/2, AT_Y+ATH, C_CN5V3, 0.9)
draw_label(cv, ATX, AT_Y, ATW, ATH,
["ANTERIOR TRUNK (mostly MOTOR, one sensory)"],
fill_color=C_CN5V3, text_color=colors.white, font_size=7.2, bold=True)
# Anterior trunk branches
ant_branches = [
("BUCCAL NERVE\n(mainly sensory)", ["Passes between heads of lateral pterygoid", "Sensory: skin & mucosa of cheek", "Buccal gingivae of lower molars"]),
("MASSETERIC\nNERVE (motor)", ["Passes through mandibular notch", "Motor: MASSETER muscle"]),
("DEEP TEMPORAL\nNERVES (motor)", ["Usually 2 nerves", "Curve around infratemporal crest", "Motor: TEMPORALIS (deep surface)"]),
("NERVE TO\nLATERAL PTERYGOID\n(motor)", ["Enters deep surface", "Motor: lateral pterygoid muscle"]),
]
ABY = AT_Y - 32*mm
n_ant = len(ant_branches)
bwant = (ATW - (n_ant-1)*3*mm) / n_ant
bxant = ATX
for name, desc in ant_branches:
bhant = 28*mm
arrow_line(cv, ATX+ATW/2, AT_Y, bxant+bwant/2, ABY+bhant, C_CN5V3, 0.6)
draw_label(cv, bxant, ABY, bwant, bhant, [name]+desc, fill_color=C_CN5V3L, font_size=6.0)
bxant += bwant + 3*mm
# ── POSTERIOR TRUNK ───────────────────────────────────────────────────────
PT_Y = IB_Y - 24*mm
PTX = PAGE_W/2 + 6*mm
PTW = PAGE_W - MARGIN - PTX
PTH = 10*mm
line(cv, RX+RW*0.75, RY, PTX+PTW/2, RY, C_CN5V3, 0.9)
arrow_line(cv, PTX+PTW/2, RY, PTX+PTW/2, PT_Y+PTH, C_CN5V3, 0.9)
draw_label(cv, PTX, PT_Y, PTW, PTH,
["POSTERIOR TRUNK (mostly SENSORY, one motor branch)"],
fill_color=C_CN5V3, text_color=colors.white, font_size=7.2, bold=True)
# Posterior trunk branches
post_branches = [
("AURICULOTEMPORAL\nNERVE", [
"Origin: 2 roots around middle meningeal a.",
"Passes between TMJ & external ear",
"Sensory: temple skin (main area),",
" ext. ear, ext. acoustic meatus,",
" tympanic membrane, TMJ",
"Carries postganglionic parasympathetic",
" from OTIC GANGLION → PAROTID gland",
" (preganglionic origin: CN IX)"
]),
("LINGUAL NERVE", [
"Joined by CHORDA TYMPANI (CN VII)",
"in infratemporal fossa",
"General sensation:",
" • Anterior 2/3 tongue",
" • Oral floor mucosa",
" • Lingual gingivae",
"Via chorda tympani adds:",
" • TASTE ant. 2/3 tongue",
" • Parasympathetic →",
" submandibular ganglion →",
" submandibular & sublingual glands"
]),
("INFERIOR ALVEOLAR\nNERVE", [
"Sensory: all lower teeth,",
" lower lip skin & mucosa, chin",
"",
"Branch: NERVE TO MYLOHYOID (motor)",
" → Mylohyoid + ant. belly digastric",
" (given off just before mandibular foramen)",
"",
"Enters mandibular canal",
"Terminates as 2 branches:",
" • INCISIVE NERVE: lower front teeth",
" • MENTAL NERVE: exits mental foramen",
" → lower lip & chin skin"
]),
]
PBY = PT_Y - 48*mm
n_post = len(post_branches)
bwpost = (PTW - (n_post-1)*3*mm) / n_post
bxpost = PTX
for name, desc in post_branches:
bhpost = 44*mm
arrow_line(cv, PTX+PTW/2, PT_Y, bxpost+bwpost/2, PBY+bhpost, C_CN5V3, 0.6)
draw_label(cv, bxpost, PBY, bwpost, bhpost, [name]+desc, fill_color=C_CN5V3L, font_size=6.0)
bxpost += bwpost + 3*mm
# ── CLINICAL NOTES BOX ────────────────────────────────────────────────────
CNY = 18*mm
CNH = PBY - CNY - 4*mm
CNW = PAGE_W - 2*MARGIN
rounded_rect(cv, MARGIN, CNY, CNW, CNH, r=4,
fill_color=HexColor("#E8F5E9"),
stroke_color=C_CN5V3, lw=1.0)
cv.setFillColor(C_CN5V3)
cv.setFont("Helvetica-Bold", 7.5)
cv.drawString(MARGIN+4*mm, CNY+CNH-6*mm, "KEY CLINICAL POINTS – CN V3")
notes = [
"• Inferior alveolar nerve block: anaesthetise entire lower jaw (dental procedures)",
"• Lingual nerve injury (e.g. during wisdom tooth extraction) → loss of taste + general sensation anterior 2/3 tongue",
"• Auriculotemporal nerve syndrome (Frey's syndrome): parotid surgery → aberrant regeneration → sweating instead of salivation on eating",
"• V3 motor branch damage → jaw deviation TOWARD the paralysed side (lateral pterygoid weakness)",
"• Tensor tympani (via nerve to medial pterygoid) and tensor veli palatini are both V3 motor – tested in middle ear physiology",
]
ny = CNY + CNH - 14*mm
for note in notes:
cv.setFont("Helvetica", 6.5)
cv.setFillColor(C_TITLE)
cv.drawString(MARGIN+4*mm, ny, note)
ny -= 8
# Footer
cv.setFillColor(C_CN5V3)
cv.rect(0, 0, PAGE_W, 8*mm, fill=1, stroke=0)
cv.setFillColor(colors.white)
cv.setFont("Helvetica", 6.5)
cv.drawCentredString(PAGE_W/2, 2.5*mm, "Page 3 of 3 | CN V3 Mandibular Nerve | Orris Medical Reference")
page3(c)
c.showPage()
c.save()
print(f"PDF saved to: {OUTPUT}")
python3 /tmp/workspace/nerve-diagram/generate_pdf.py
ls -lh /tmp/workspace/nerve-diagram/
Cranial Nerve Branches Reference
PDF Document · PDF