Sugery for olorectal carcinoma and main steps and which all structure removaed and different in table from and with diagram if possible
colorectal carcinoma surgery types steps structures removed comparison
| Feature | Right Hemicolectomy | Left Hemicolectomy | Sigmoid Colectomy | High Anterior Resection (HAR) | Low Anterior Resection (LAR) | Abdominoperineal Excision (APE) | Hartmann's Procedure | Pelvic Exenteration |
|---|---|---|---|---|---|---|---|---|
| Tumour location | Caecum, ascending, hepatic flexure, proximal transverse colon | Descending colon, splenic flexure | Sigmoid colon | Upper rectum (>12 cm from anal verge) | Middle/lower rectum (5-12 cm) | Low rectum/anus (distal 3rd, <5 cm from verge) | Sigmoid/upper rectum (unfit/frail patients) | Locally advanced rectum invading adjacent organs |
| Structures removed | Terminal ileum (10-15 cm), caecum, ascending colon, hepatic flexure, proximal transverse colon, associated mesocolon, ileocolic and right colic lymph nodes | Descending colon, splenic flexure, part of transverse colon, associated mesocolon, left colic LNs | Sigmoid colon, mesosigmoid, sigmoid vessels, LNs | Upper rectum (≥3 cm below tumour), mesorectum (partial TME), sigmoid colon, superior rectal vessels, LNs | Upper + middle + lower rectum (complete TME), mesorectum en bloc, sigmoid colon, pelvic LNs | Sigmoid colon, entire rectum, mesorectum, anus, anal sphincters, levator ani, ischiorectal fat, perineal skin, pelvic LNs | Sigmoid colon + rectum (stump closed), no anastomosis | All APE structures PLUS bladder ± prostate (male), or uterus ± posterior vaginal wall (female) |
| Anastomosis | Ileocolic (ileum to transverse colon) | Colorectal or colo-colic | Colorectal | Colorectal | Colorectal (stapled, low) | None - end colostomy | None - end colostomy (rectal stump closed) | Colostomy ± ileal conduit (if bladder removed) |
| Stoma | Usually none | Usually none | Usually none | Usually none | Defunctioning loop ileostomy often used | Permanent end-colostomy (left iliac fossa) | Permanent end-colostomy | Permanent colostomy ± urostomy |
| Anal sphincter preserved? | Yes | Yes | Yes | Yes | Yes | No | Yes | No (if APE component) |
| TME performed? | No | No | No | Partial (proximal TME) | Complete TME | Complete TME + extralevator excision | No | Complete |
| Key vessels ligated | Ileocolic artery, right colic artery, right branch of middle colic artery | Left colic artery, inferior mesenteric artery | Inferior mesenteric artery or sigmoid vessels | Superior rectal artery, IMA (high ligation) | IMA at origin or just distal (high ligation) | IMA, middle rectal vessels, pudendal branches | IMA | IMA + internal iliac vessels |
TME: Sharp dissection in the embryological plane between the investing fascia of the rectum (fascia propria) and the presacral/parietal pelvic fascia, removing the rectum en bloc with its intact mesorectum. This reduces local recurrence from ~25% to ~6% and improves 5-year survival from ~60% to ~73%.



| Type | Structures Removed |
|---|---|
| Posterior exenteration | Rectum + posterior vagina/uterus |
| Total exenteration | Rectum + bladder + prostate (male) OR rectum + uterus + bladder (female) |
| Extended | Above + sacrum, pelvic side wall muscles |
| Nerve | Origin | Function | At Risk During |
|---|---|---|---|
| Hypogastric plexus (sympathetic) | L1-L3 (preaortic) | Ejaculation, bladder neck closure | IMA high ligation, sacral promontory dissection |
| Pelvic plexus (parasympathetic) | S2, S3, S4 (nervi erigentes) | Erection, bladder voiding | Lateral rectal dissection |
| Pudendal nerve | S2-S4 | Anal sphincter tone, perineal sensation | Perineal phase of APER |
| Left ureter | Retroperitoneal | Urine drainage | Left colon / sigmoid mobilisation |
| Membranous urethra | - | Urinary continence | Anterior dissection in APER (male) |
| Feature | Low Anterior Resection (LAR) | Abdominoperineal Excision (APER) |
|---|---|---|
| Tumour level | Middle/upper rectum | Lower rectum / invades sphincter |
| Anal sphincters | Preserved | Excised |
| Stoma | Temporary covering ileostomy | Permanent end-colostomy |
| TME type | Complete | Complete + extralevator (cylindrical) |
| Approach | Abdominal only | Abdominal + perineal |
| Anastomosis | Yes (stapled) | No |
| Local recurrence risk | Low (with TME) | Low (with extralevator excision) |
| Positive CRM risk | Lower | Higher if standard (reduced with extralevator APER) |
Generate a detailed surgical atlas poster showing TME dissection planes
Detailed surgical atlas poster titled "Total Mesorectal Excision (TME) - Dissection Planes" for medical education. Scientific anatomical illustration style with clean white background. Main central illustration: Large sagittal cross-section of male pelvis showing: - Rectum in center with clearly labeled mesorectum (fatty envelope around rectum) - Tumor shown as pink nodule in mid-rectum - Labeled dissection planes with colored dotted/dashed lines: * POSTERIOR plane: between presacral fascia (Waldeyer's fascia) and fascia propria of rectum (mesorectal investing fascia) - shown in blue dotted line * ANTERIOR plane: anterior to Denonvilliers' fascia, between rectum and prostate/seminal vesicles - shown in red dotted line * LATERAL planes: along pelvic side walls - shown in green dotted line - Anatomical labels pointing to: Sacrum, Presacral fascia, Fascia propria of rectum, Mesorectum, Denonvilliers' fascia, Prostate, Seminal vesicles, Bladder, Peritoneum, Levator ani, Waldeyer's rectosacral fascia, Puborectalis, Anal canal, Anococcygeal ligament Top left inset diagram: Axial/cross-sectional view of rectum at mid-pelvis showing: - Concentric layers: rectal wall, mesorectum, investing fascia, parietal fascia - Circumferential resection margin (CRM) indicated - Label: "Holy Plane of TME" with arrow Top right inset: Posterior view showing hypogastric nerves and pelvic plexus with labels: - Superior hypogastric plexus - Left and right hypogastric nerves - Inferior hypogastric (pelvic) plexus - IMA (inferior mesenteric artery) stump - Sacral promontory - Nervi erigentes S2-S4 Bottom panel: Three-step sequential diagrams showing progression of TME dissection: Step 1 - "Posterior Dissection: Enter presacral space at sacral promontory" Step 2 - "Lateral Dissection: Divide lateral ligaments preserving pelvic nerves" Step 3 - "Anterior Dissection: Anterior to Denonvilliers' fascia" Bottom right inset: Completed TME specimen showing intact mesorectal envelope with label "Intact mesorectal fascia = oncologically correct TME" Color-coded legend box: - Blue = Posterior dissection plane - Red = Anterior dissection plane - Green = Lateral dissection planes - Yellow shading = Mesorectum - Orange = Nerves to preserve Title banner at top: "TOTAL MESORECTAL EXCISION (TME) - Surgical Dissection Planes" in bold dark blue Subtitle: "Anatomical Guide for Rectal Cancer Surgery" Footer: "Bailey & Love / Sabiston Surgical Atlas Reference" Professional medical atlas style, anatomically accurate, high detail, suitable for surgical training
mkdir -p /home/daytona/workspace/tme-poster && ls /home/daytona/workspace/tme-poster/
~/tme-poster/tme_atlas.py
"""
TME Surgical Atlas Poster - Total Mesorectal Excision Dissection Planes
"""
import matplotlib.pyplot as plt
import matplotlib.patches as mpatches
from matplotlib.patches import FancyArrowPatch, Arc, Ellipse, FancyBboxPatch, PathPatch
from matplotlib.path import Path
import matplotlib.patheffects as pe
import numpy as np
# ── Canvas ─────────────────────────────────────────────────────────────────
fig = plt.figure(figsize=(22, 28), facecolor='#F8F6F0')
fig.patch.set_linewidth(6)
fig.patch.set_edgecolor('#1a3a5c')
# Color palette
C = dict(
bg = '#F8F6F0',
title_bg = '#1a3a5c',
title_fg = '#FFFFFF',
bone = '#EDE0C4',
bone_dark = '#C8B89A',
rectum = '#C05050',
rectum_lm = '#8B2020',
mesrect = '#F4C4A0',
bladder = '#A0B8D8',
prostate = '#C4A0C8',
fascia = '#8B6914',
plane_p = '#1565C0', # posterior - blue
plane_a = '#C62828', # anterior - red
plane_l = '#2E7D32', # lateral - green
nerve = '#F57F17', # nerves - amber
lymph = '#4A148C', # lymphatics - purple
section_bg= '#E8F4FD',
heading = '#1a3a5c',
text = '#2C2C2C',
tumor = '#B71C1C',
levator = '#5D8A5E',
label_box = '#FFFFFFCC',
)
# ── Title Banner ────────────────────────────────────────────────────────────
title_ax = fig.add_axes([0, 0.945, 1, 0.055])
title_ax.set_facecolor(C['title_bg'])
title_ax.set_xlim(0,1); title_ax.set_ylim(0,1)
title_ax.axis('off')
title_ax.text(0.5, 0.70, 'TOTAL MESORECTAL EXCISION (TME)',
ha='center', va='center', fontsize=30, fontweight='bold',
color='white', fontfamily='DejaVu Sans')
title_ax.text(0.5, 0.20, 'Surgical Dissection Planes — Anatomical Atlas for Rectal Cancer Surgery',
ha='center', va='center', fontsize=15, color='#B0C4DE',
fontfamily='DejaVu Sans')
# ═══════════════════════════════════════════════════════════════════════════
# MAIN SAGITTAL DIAGRAM (left half, tall)
# ═══════════════════════════════════════════════════════════════════════════
main_ax = fig.add_axes([0.02, 0.32, 0.56, 0.60])
main_ax.set_facecolor(C['bg'])
main_ax.set_xlim(-1, 11); main_ax.set_ylim(-1, 14)
main_ax.axis('off')
main_ax.set_aspect('equal')
def filled_curve(ax, xs, ys, color, alpha=1.0, zorder=2, lw=1.5, ec=None):
ec = ec or color
ax.fill(xs, ys, color=color, alpha=alpha, zorder=zorder)
ax.plot(xs, ys, color=ec, lw=lw, zorder=zorder+1)
# ── Sacrum / Coccyx ─────────────────────────────────────────────────────────
sacrum_x = [6.5, 9.5, 9.8, 9.2, 9.4, 8.8, 9.0, 8.4, 8.2, 7.2, 6.5]
sacrum_y = [13.5, 13.5, 12.5, 11.5, 10.5, 9.5, 8.5, 7.5, 6.5, 5.5, 13.5]
filled_curve(main_ax, sacrum_x, sacrum_y, C['bone'], ec=C['bone_dark'], zorder=2)
# Coccyx
coccyx_x = [7.2, 8.2, 8.0, 7.6, 7.2]
coccyx_y = [5.5, 6.5, 5.0, 4.0, 5.5]
filled_curve(main_ax, coccyx_x, coccyx_y, C['bone'], ec=C['bone_dark'], zorder=2)
main_ax.text(8.8, 11.5, 'Sacrum', fontsize=10, color=C['text'], fontweight='bold', zorder=10)
main_ax.text(7.4, 4.5, 'Coccyx', fontsize=9, color=C['text'], zorder=10)
# ── Lumbar vertebra (top) ───────────────────────────────────────────────────
for yi, lbl in zip([13.0], ['L5']):
main_ax.add_patch(FancyBboxPatch((6.6, yi-0.4), 2.2, 0.8,
boxstyle="round,pad=0.05", fc=C['bone'], ec=C['bone_dark'], lw=1.5, zorder=3))
main_ax.text(7.7, yi, lbl, ha='center', va='center', fontsize=8, color=C['text'], zorder=10)
# ── Presacral fascia ────────────────────────────────────────────────────────
pf_x = [7.0, 8.8, 8.5, 8.0, 7.6, 7.2, 7.0]
pf_y = [13.0, 13.0, 11.2, 9.2, 7.2, 5.8, 13.0]
filled_curve(main_ax, pf_x, pf_y, '#D4B896', alpha=0.6, ec='#8B6914', lw=1.5, zorder=3)
main_ax.text(8.15, 9.8, 'Presacral\nfascia', fontsize=8.5, color=C['fascia'],
fontstyle='italic', zorder=10, ha='center')
# ── Waldeyer's fascia (rectosacral) ─────────────────────────────────────────
wald_x = np.array([4.8, 5.2, 5.8, 6.5, 7.0])
wald_y = np.array([5.8, 5.5, 5.2, 5.4, 5.8])
main_ax.plot(wald_x, wald_y, color='#5C4000', lw=2.5, ls='--', zorder=6)
main_ax.text(5.0, 5.0, "Waldeyer's fascia\n(rectosacral)", fontsize=8, color='#5C4000',
fontstyle='italic', zorder=10)
# ── Mesorectum (fatty envelope) ─────────────────────────────────────────────
meso_x = [3.5, 3.2, 3.0, 3.1, 3.4, 3.8, 4.2, 4.5, 4.8, 5.2, 5.8, 6.2,
6.8, 7.2, 7.5, 7.3, 6.8, 6.0, 5.0, 4.0, 3.5]
meso_y = [12.5, 11.5, 10.0, 8.5, 7.0, 6.0, 5.6, 5.5, 5.4, 5.2, 5.0, 5.2,
5.8, 6.5, 8.0, 10.0, 11.5, 12.5, 13.0, 12.8, 12.5]
filled_curve(main_ax, meso_x, meso_y, C['mesrect'], alpha=0.85, ec='#CC7733', lw=2, zorder=4)
main_ax.text(4.0, 9.0, 'Mesorectum\n(fatty envelope\nwith lymph nodes)', fontsize=9,
color='#884400', fontweight='bold', zorder=10, ha='center')
# ── Fascia propria of rectum (investing fascia) ──────────────────────────────
fp_x = [3.8, 3.6, 3.5, 3.6, 3.9, 4.2, 4.6, 4.8, 5.1, 5.5, 5.8, 6.2,
6.6, 6.9, 7.0, 6.8, 6.4, 5.8, 5.0, 4.2, 3.8]
fp_y = [12.2, 11.2, 9.8, 8.5, 7.2, 6.4, 6.0, 5.9, 5.8, 5.6, 5.5, 5.7,
6.2, 7.2, 8.5, 10.0, 11.2, 12.0, 12.5, 12.4, 12.2]
filled_curve(main_ax, fp_x, fp_y, '#F8D4B0', alpha=0.9, ec='#CC5500', lw=2.0, zorder=5)
# ── Rectum wall ──────────────────────────────────────────────────────────────
rect_x = [4.2, 4.0, 3.9, 4.0, 4.2, 4.5, 4.7, 5.0, 5.3, 5.6, 5.9, 6.1,
6.3, 6.5, 6.4, 6.2, 5.8, 5.3, 4.8, 4.2]
rect_y = [12.0, 11.0, 9.8, 8.5, 7.5, 6.8, 6.4, 6.2, 6.0, 5.9, 6.0, 6.2,
6.8, 7.5, 9.0, 10.5, 11.5, 12.2, 12.3, 12.0]
filled_curve(main_ax, rect_x, rect_y, '#D4706A', alpha=0.9, ec=C['rectum_lm'], lw=2, zorder=6)
main_ax.text(5.15, 9.2, 'RECTUM', fontsize=11, fontweight='bold',
color='white', ha='center', va='center', zorder=10)
# ── Tumor ────────────────────────────────────────────────────────────────────
tumor_patch = Ellipse((5.1, 7.5), 0.85, 0.65, fc=C['tumor'], ec='#800000', lw=2, zorder=8)
main_ax.add_patch(tumor_patch)
main_ax.text(5.1, 7.5, 'T', ha='center', va='center', fontsize=9, fontweight='bold',
color='white', zorder=9)
# ── Anal canal ───────────────────────────────────────────────────────────────
anal_x = [4.5, 4.3, 4.2, 4.3, 4.5, 5.0, 5.5, 5.7, 5.6, 5.4, 4.5]
anal_y = [5.5, 4.8, 4.0, 3.3, 2.8, 2.6, 2.8, 3.3, 4.0, 5.0, 5.5]
filled_curve(main_ax, anal_x, anal_y, '#A05050', ec='#703030', lw=1.5, zorder=7)
main_ax.text(5.0, 3.5, 'Anal\ncanal', fontsize=8.5, ha='center', color='white',
fontweight='bold', zorder=10)
# ── Levator ani ──────────────────────────────────────────────────────────────
lev_x = [3.0, 3.2, 3.6, 4.2, 4.5, 5.5, 6.0, 6.5, 7.0, 7.5, 7.5, 7.0,
6.5, 5.5, 4.5, 3.8, 3.2, 3.0]
lev_y = [4.5, 4.8, 5.0, 5.2, 5.3, 5.4, 5.3, 5.2, 5.0, 4.8, 4.2, 4.4,
4.5, 4.6, 4.5, 4.3, 4.0, 4.5]
filled_curve(main_ax, lev_x, lev_y, C['levator'], alpha=0.7, ec='#2E5E2E', lw=2, zorder=5)
main_ax.text(3.0, 4.6, 'Levator ani\n(puborectalis +\npubococcygeus)', fontsize=8,
color=C['levator'], fontstyle='italic', zorder=10)
# ── Bladder ──────────────────────────────────────────────────────────────────
bladder_patch = Ellipse((1.8, 9.5), 2.4, 3.2, fc=C['bladder'], ec='#1a5276', lw=2, alpha=0.85, zorder=5)
main_ax.add_patch(bladder_patch)
main_ax.text(1.8, 9.5, 'Bladder', ha='center', va='center', fontsize=9,
fontweight='bold', color='#1a5276', zorder=10)
# ── Prostate / Seminal vesicles ───────────────────────────────────────────────
prostate_patch = Ellipse((2.5, 7.0), 1.8, 1.2, fc=C['prostate'], ec='#6a0dad', lw=1.5, alpha=0.85, zorder=6)
main_ax.add_patch(prostate_patch)
main_ax.text(2.5, 7.0, 'Prostate', ha='center', va='center', fontsize=8.5,
fontweight='bold', color='white', zorder=10)
sv_patch = Ellipse((2.8, 8.1), 1.4, 0.7, fc='#D0B0E0', ec='#6a0dad', lw=1.5, alpha=0.85, zorder=6)
main_ax.add_patch(sv_patch)
main_ax.text(2.8, 8.1, 'Sem. vesicles', ha='center', va='center', fontsize=7.5,
color='#4a0078', zorder=10)
# ── Denonvilliers' fascia ─────────────────────────────────────────────────────
den_x = [3.5, 3.6, 3.8, 3.9, 4.0]
den_y = [8.8, 7.8, 7.0, 6.4, 6.0]
main_ax.plot(den_x, den_y, color='#8B0000', lw=3, ls='-.', zorder=8)
main_ax.text(1.5, 7.8, "Denonvilliers'\nfascia", fontsize=8.5, color='#8B0000',
fontstyle='italic', zorder=10, ha='center')
main_ax.annotate('', xy=(3.55, 8.3), xytext=(2.4, 8.0),
arrowprops=dict(arrowstyle='->', color='#8B0000', lw=1.5))
# ── Peritoneum reflection ─────────────────────────────────────────────────────
per_x = [0.5, 1.0, 1.5, 2.5, 3.2, 3.5, 3.6, 3.8, 4.0, 4.5, 5.0, 5.5, 5.8, 6.0,
6.2, 6.5, 7.0, 7.5, 8.0, 8.5, 9.0, 9.5, 10.5]
per_y = [13.8, 13.5, 13.0, 12.0, 11.5, 11.2, 10.8, 10.5, 10.4, 10.2, 10.0, 9.8, 9.7, 9.5,
9.2, 9.0, 9.2, 9.5, 10.0, 10.5, 11.0, 11.5, 12.0]
main_ax.plot(per_x, per_y, color='#2E8B57', lw=2.5, ls=':', zorder=7)
main_ax.text(1.2, 13.2, 'Peritoneum', fontsize=8.5, color='#2E8B57', fontstyle='italic', zorder=10)
# ═══════════════════════════════════════════════════════════════════════════════
# DISSECTION PLANE ARROWS & LABELS
# ═══════════════════════════════════════════════════════════════════════════════
# ── POSTERIOR plane (blue) ────────────────────────────────────────────────────
post_plane_x = np.linspace(6.0, 7.3, 30)
post_plane_y = np.linspace(12.0, 5.8, 30)
main_ax.plot(post_plane_x, post_plane_y, color=C['plane_p'], lw=4, ls='--',
dashes=(8,4), zorder=9, alpha=0.9)
# Arrow on the plane
main_ax.annotate('', xy=(6.8, 7.5), xytext=(6.5, 10.5),
arrowprops=dict(arrowstyle='->', color=C['plane_p'], lw=2.5))
# ── ANTERIOR plane (red) ──────────────────────────────────────────────────────
ant_plane_x = [3.8, 3.7, 3.6, 3.6, 3.7, 3.8, 3.9, 4.0]
ant_plane_y = [11.5, 10.5, 9.5, 8.5, 7.5, 6.8, 6.2, 5.8]
main_ax.plot(ant_plane_x, ant_plane_y, color=C['plane_a'], lw=4, ls='--',
dashes=(8,4), zorder=9, alpha=0.9)
main_ax.annotate('', xy=(3.7, 8.0), xytext=(3.9, 10.5),
arrowprops=dict(arrowstyle='->', color=C['plane_a'], lw=2.5))
# ── LATERAL planes (green) ────────────────────────────────────────────────────
main_ax.annotate('', xy=(4.0, 6.5), xytext=(2.5, 7.0),
arrowprops=dict(arrowstyle='->', color=C['plane_l'], lw=2.5,
connectionstyle='arc3,rad=0.2'))
main_ax.annotate('', xy=(6.5, 6.5), xytext=(8.0, 7.0),
arrowprops=dict(arrowstyle='->', color=C['plane_l'], lw=2.5,
connectionstyle='arc3,rad=-0.2'))
# ── Nerve paths (amber) ──────────────────────────────────────────────────────
# Hypogastric nerves along sacral promontory
nerve_x = [6.8, 6.5, 6.2, 5.9, 5.6]
nerve_y = [12.5, 12.0, 11.3, 10.5, 9.8]
main_ax.plot(nerve_x, nerve_y, color=C['nerve'], lw=3, zorder=9)
main_ax.plot([n+0.3 for n in nerve_x], nerve_y, color=C['nerve'], lw=3, zorder=9)
# Nervi erigentes
for sx, sy in [(7.5, 9.0), (7.5, 8.0), (7.5, 7.0)]:
ex, ey = sx - 2.8, sy - 1.0
main_ax.annotate('', xy=(ex, ey), xytext=(sx, sy),
arrowprops=dict(arrowstyle='->', color=C['nerve'], lw=1.8))
# ═══════════════════════════════════════════════════════════════════════════════
# CALLOUT LABELS (right side)
# ═══════════════════════════════════════════════════════════════════════════════
labels = [
(6.8, 11.0, 12.5, 11.5, 'Hypogastric\nnerves\n(sympathetic L1-L3)', C['nerve']),
(7.5, 8.5, 10.5, 8.5, 'Nervi erigentes\n(S2,S3,S4)', C['nerve']),
(7.5, 6.5, 10.5, 6.5, 'Pelvic (inferior\nhypogastric)\nplexus', C['nerve']),
(7.0, 5.6, 10.5, 5.6, "Waldeyer's\n(rectosacral)\nfascia", '#5C4000'),
]
for lx, ly, tx, ty, txt, col in labels:
main_ax.annotate(txt, xy=(lx, ly), xytext=(tx, ty),
fontsize=8.5, color=col,
arrowprops=dict(arrowstyle='-', color=col, lw=1.3),
bbox=dict(boxstyle='round,pad=0.3', fc='white', ec=col, alpha=0.9))
# Structures labels (left side)
struct_labels = [
(3.5, 11.0, -0.5, 11.5, 'Fascia propria\nof rectum\n(investing fascia)', C['plane_a']),
(3.0, 6.5, -0.5, 6.5, 'Mesorectal\ninvesting\nfascia', '#CC5500'),
]
for lx, ly, tx, ty, txt, col in struct_labels:
main_ax.annotate(txt, xy=(lx, ly), xytext=(tx, ty),
fontsize=8.5, color=col,
arrowprops=dict(arrowstyle='-', color=col, lw=1.3),
bbox=dict(boxstyle='round,pad=0.3', fc='white', ec=col, alpha=0.9))
# Tumor label
main_ax.annotate('TUMOUR', xy=(5.1, 7.5), xytext=(1.0, 7.3),
fontsize=9, color=C['tumor'], fontweight='bold',
arrowprops=dict(arrowstyle='->', color=C['tumor'], lw=1.8),
bbox=dict(boxstyle='round,pad=0.3', fc='#FFE0E0', ec=C['tumor']))
# Main ax title
main_ax.text(5.0, 13.8, 'SAGITTAL VIEW — Male Pelvis',
ha='center', fontsize=13, fontweight='bold', color=C['heading'], zorder=12)
# ═══════════════════════════════════════════════════════════════════════════
# TOP-RIGHT: AXIAL CROSS-SECTION
# ═══════════════════════════════════════════════════════════════════════════
ax_ax = fig.add_axes([0.60, 0.72, 0.38, 0.22])
ax_ax.set_facecolor(C['section_bg'])
ax_ax.set_xlim(-5, 5); ax_ax.set_ylim(-5, 5)
ax_ax.axis('off')
ax_ax.set_aspect('equal')
# Background circle (pelvis wall)
pelvis = plt.Circle((0,0), 4.5, fc='#E8D5B5', ec=C['bone_dark'], lw=2.5)
ax_ax.add_patch(pelvis)
# Parietal pelvic fascia
parietal = plt.Circle((0,0), 3.8, fc='#D4C4A0', ec='#9B7A30', lw=2.5)
ax_ax.add_patch(parietal)
# Mesorectum ring
meso_c = plt.Circle((0,0), 2.6, fc=C['mesrect'], ec='#CC7733', lw=3.0)
ax_ax.add_patch(meso_c)
# Fascia propria ring
fp_c = plt.Circle((0,0), 1.7, fc='#F0C0A0', ec='#CC5500', lw=2.0)
ax_ax.add_patch(fp_c)
# Rectum lumen
rect_c = plt.Circle((0,0), 1.1, fc=C['rectum'], ec=C['rectum_lm'], lw=2.0)
ax_ax.add_patch(rect_c)
# Tumor patch
t_c = plt.Circle((0.5, -0.6), 0.45, fc=C['tumor'], ec='#800000', lw=1.5)
ax_ax.add_patch(t_c)
ax_ax.text(0.5, -0.6, 'T', ha='center', va='center', fontsize=7, fontweight='bold', color='white')
# CRM dashed circle
crm = plt.Circle((0,0), 3.0, fc='none', ec='#CC0000', lw=2.5, ls='--')
ax_ax.add_patch(crm)
# Holy Plane arrow
ax_ax.annotate('', xy=(2.6*np.cos(np.radians(45)), 2.6*np.sin(np.radians(45))),
xytext=(3.5*np.cos(np.radians(45)), 3.5*np.sin(np.radians(45))),
arrowprops=dict(arrowstyle='<->', color=C['plane_p'], lw=2.5))
# Labels
ax_ax.text(0, 0, 'Rectum\nlumen', ha='center', va='center', fontsize=7,
color='white', fontweight='bold')
ax_ax.text(0, 1.35, 'Fascia\npropria', ha='center', va='center', fontsize=6.5, color='#883300')
ax_ax.text(0, 2.15, 'Mesorectum', ha='center', va='center', fontsize=7, color='#884400', fontweight='bold')
ax_ax.text(0, 3.0, 'CRM', ha='center', va='center', fontsize=7.5, color='#CC0000',
fontweight='bold',
bbox=dict(boxstyle='round,pad=0.2', fc='white', ec='#CC0000', alpha=0.9))
ax_ax.text(-4.2, 3.8, 'Pelvic\nwall', ha='center', fontsize=6.5, color=C['text'])
# Holy plane label
ax_ax.text(4.8, 4.5, '"Holy Plane"\nof TME', ha='right', fontsize=8,
color=C['plane_p'], fontweight='bold',
bbox=dict(boxstyle='round,pad=0.3', fc='#E8F0FF', ec=C['plane_p'], alpha=0.95))
ax_ax.annotate('', xy=(2.8, 2.8), xytext=(4.2, 4.0),
arrowprops=dict(arrowstyle='->', color=C['plane_p'], lw=1.8))
ax_ax.set_title('AXIAL VIEW — Mid-Rectum Cross-Section',
fontsize=11, fontweight='bold', color=C['heading'], pad=8)
# ═══════════════════════════════════════════════════════════════════════════
# MID-RIGHT: NERVE ANATOMY PANEL
# ═══════════════════════════════════════════════════════════════════════════
nerve_ax = fig.add_axes([0.60, 0.50, 0.38, 0.20])
nerve_ax.set_facecolor(C['section_bg'])
nerve_ax.set_xlim(0, 10); nerve_ax.set_ylim(0, 6)
nerve_ax.axis('off')
nerve_ax.set_title('AUTONOMIC NERVE ANATOMY (Posterior View)',
fontsize=11, fontweight='bold', color=C['heading'], pad=6)
# IMA and aorta
nerve_ax.plot([5, 5], [6.0, 4.8], color='#CC2222', lw=5, solid_capstyle='round', zorder=3)
nerve_ax.text(5.3, 5.5, 'Aorta / IMA', fontsize=8, color='#CC2222')
# Superior hypogastric plexus
shp = Ellipse((5, 4.3), 2.5, 0.6, fc='#FFE082', ec=C['nerve'], lw=2, zorder=4)
nerve_ax.add_patch(shp)
nerve_ax.text(5, 4.3, 'Superior hypogastric plexus', ha='center', va='center',
fontsize=7.5, fontweight='bold', color='#7B5E00')
# Left and right hypogastric nerves
nerve_ax.plot([4.0, 2.5], [4.0, 2.5], color=C['nerve'], lw=2.5, zorder=4)
nerve_ax.plot([6.0, 7.5], [4.0, 2.5], color=C['nerve'], lw=2.5, zorder=4)
nerve_ax.text(2.0, 2.3, 'L hypogastric\nnerve', fontsize=7.5, ha='center', color=C['nerve'])
nerve_ax.text(8.0, 2.3, 'R hypogastric\nnerve', fontsize=7.5, ha='center', color=C['nerve'])
# Nervi erigentes from sacrum
for sx, col_off in [(2.5, -0.3), (5.0, 0), (7.5, 0.3)]:
nerve_ax.plot([sx + col_off, sx + col_off - 0.5], [0.8, 2.0],
color='#1565C0', lw=2, ls='--', zorder=4)
nerve_ax.text(sx + col_off, 0.5, 'S2-S4', fontsize=7, ha='center', color='#1565C0')
# Inferior hypogastric plexus
ihp_l = Ellipse((2.5, 2.0), 1.8, 0.7, fc='#FFE082', ec=C['nerve'], lw=2, zorder=5)
ihp_r = Ellipse((7.5, 2.0), 1.8, 0.7, fc='#FFE082', ec=C['nerve'], lw=2, zorder=5)
nerve_ax.add_patch(ihp_l)
nerve_ax.add_patch(ihp_r)
nerve_ax.text(2.5, 2.0, 'Pelvic plexus\n(IHP)', ha='center', va='center', fontsize=7, color='#7B5E00')
nerve_ax.text(7.5, 2.0, 'Pelvic plexus\n(IHP)', ha='center', va='center', fontsize=7, color='#7B5E00')
# Rectum schematic
rect_nerve = FancyBboxPatch((3.8, 0.2), 2.4, 3.5, boxstyle="round,pad=0.2",
fc=C['rectum'], ec=C['rectum_lm'], lw=2, alpha=0.6, zorder=3)
nerve_ax.add_patch(rect_nerve)
nerve_ax.text(5.0, 2.0, 'RECTUM', ha='center', va='center', fontsize=8,
fontweight='bold', color='white', zorder=6)
# Legend
nerve_ax.plot([0.2, 0.8], [0.8, 0.8], color=C['nerve'], lw=2.5)
nerve_ax.text(0.9, 0.8, 'Sympathetic', fontsize=7, va='center', color=C['nerve'])
nerve_ax.plot([0.2, 0.8], [0.4, 0.4], color='#1565C0', lw=2.5, ls='--')
nerve_ax.text(0.9, 0.4, 'Parasympathetic', fontsize=7, va='center', color='#1565C0')
# ═══════════════════════════════════════════════════════════════════════════
# BOTTOM PANEL: 3-STEP SEQUENTIAL DISSECTION
# ═══════════════════════════════════════════════════════════════════════════
step_colors = [C['plane_p'], C['plane_a'], C['plane_l']]
step_titles = ['STEP 1: POSTERIOR DISSECTION',
'STEP 2: ANTERIOR DISSECTION',
'STEP 3: LATERAL DISSECTION']
step_texts = [
'Enter presacral space at\nsacral promontory (L5/S1).\nDissect anterior to presacral\nfascia, posterior to fascia\npropria of rectum.\nPreserve hypogastric nerves.\nIncise Waldeyer\'s fascia at\nanorectal junction.',
'Anterior to Denonvilliers\'\nfascia (between rectum and\nprostate / seminal vesicles\nin male; or posterior vaginal\nwall in female).\nProtect membranous urethra\n(palpate urinary catheter).',
'Divide lateral ligaments\n("lateral stalks") bilaterally.\nPreserve pelvic plexuses\n(inferior hypogastric plexus)\non pelvic side wall.\nNervi erigentes at greatest\nrisk here (S2, S3, S4).'
]
step_icons = ['⬇ Posterior', '⬆ Anterior', '↔ Lateral']
for i, (col, title, text, icon) in enumerate(zip(step_colors, step_titles, step_texts, step_icons)):
ax_s = fig.add_axes([0.03 + i*0.325, 0.10, 0.295, 0.20])
ax_s.set_facecolor('#FFFFFF')
for spine in ax_s.spines.values():
spine.set_edgecolor(col); spine.set_linewidth(3)
ax_s.axis('off')
# Header strip
ax_s.add_patch(FancyBboxPatch((0, 0.82), 1, 0.18,
boxstyle="square,pad=0", fc=col, ec=col, transform=ax_s.transAxes))
ax_s.text(0.5, 0.91, title, ha='center', va='center', fontsize=10, fontweight='bold',
color='white', transform=ax_s.transAxes)
# Schematic mini-diagram
ax_s.set_xlim(0, 10); ax_s.set_ylim(0, 10)
# Sacrum (right)
sac = FancyBboxPatch((6.5, 2), 2.5, 7, boxstyle="round,pad=0.2",
fc=C['bone'], ec=C['bone_dark'], lw=1.5)
ax_s.add_patch(sac)
# Rectum
rec = FancyBboxPatch((3.5, 2), 2.0, 7, boxstyle="round,pad=0.3",
fc=C['rectum'], ec=C['rectum_lm'], lw=1.5, alpha=0.85)
ax_s.add_patch(rec)
# Mesorectum
meso_mini = FancyBboxPatch((3.0, 2), 3.0, 7, boxstyle="round,pad=0.2",
fc=C['mesrect'], ec='#CC7733', lw=1.5, alpha=0.7, zorder=1)
ax_s.add_patch(meso_mini)
# Dissection arrow based on step
if i == 0: # posterior
ax_s.annotate('', xy=(6.3, 5.5), xytext=(5.2, 5.5),
arrowprops=dict(arrowstyle='->', color=col, lw=3))
ax_s.text(5.75, 6.2, 'PLANE', ha='center', fontsize=8, color=col, fontweight='bold')
elif i == 1: # anterior
ax_s.add_patch(FancyBboxPatch((1.0, 3), 2.0, 3.5, boxstyle="round,pad=0.2",
fc=C['prostate'], ec='#6a0dad', lw=1.5, alpha=0.8))
ax_s.text(2.0, 4.75, 'Prostate', ha='center', fontsize=7, color='white')
ax_s.annotate('', xy=(3.2, 5.5), xytext=(3.2, 5.5),
arrowprops=dict(arrowstyle='->', color=col, lw=3))
ax_s.plot([3.2, 3.2], [2.5, 8.5], color=col, lw=3, ls='--', dashes=(5,3))
ax_s.text(3.9, 8.8, 'PLANE', ha='center', fontsize=8, color=col, fontweight='bold')
else: # lateral
for xs, xe, ys in [(1.5, 2.9, 5.0), (8.5, 6.1, 5.0)]:
ax_s.annotate('', xy=(xe, ys), xytext=(xs, ys),
arrowprops=dict(arrowstyle='->', color=col, lw=3))
# Text description
ax_s.text(5.0, 1.5, text, ha='center', va='top', fontsize=7.5, color=C['text'],
transform=ax_s.transData,
bbox=dict(boxstyle='round,pad=0.4', fc='#F0F8FF', ec=col, alpha=0.9))
# ═══════════════════════════════════════════════════════════════════════════
# LEGEND BOX
# ═══════════════════════════════════════════════════════════════════════════
leg_ax = fig.add_axes([0.62, 0.10, 0.35, 0.19])
leg_ax.set_facecolor('#FAFAFA')
for spine in leg_ax.spines.values():
spine.set_edgecolor(C['heading']); spine.set_linewidth(2)
leg_ax.axis('off')
leg_ax.text(0.5, 0.95, 'LEGEND', ha='center', va='top', fontsize=11, fontweight='bold',
color=C['heading'], transform=leg_ax.transAxes)
legend_items = [
(C['plane_p'], '--', 'Posterior dissection plane (blue)'),
(C['plane_a'], '--', 'Anterior dissection plane (red)'),
(C['plane_l'], '--', 'Lateral dissection planes (green)'),
(C['nerve'], '-', 'Autonomic nerves (amber) — PRESERVE'),
('#CC7733', '-', 'Mesorectum / mesorectal envelope'),
(C['rectum'], '-', 'Rectum'),
(C['tumor'], '-', 'Tumour'),
('#CC0000', '--', 'Circumferential resection margin (CRM)'),
]
for j, (col, ls, lbl) in enumerate(legend_items):
y = 0.85 - j * 0.11
leg_ax.plot([0.03, 0.12], [y, y], color=col, lw=3 if ls == '-' else 2,
ls=ls, transform=leg_ax.transAxes)
leg_ax.text(0.15, y, lbl, va='center', fontsize=8, color=C['text'],
transform=leg_ax.transAxes)
# ═══════════════════════════════════════════════════════════════════════════
# FOOTER
# ═══════════════════════════════════════════════════════════════════════════
foot_ax = fig.add_axes([0, 0, 1, 0.04])
foot_ax.set_facecolor(C['title_bg'])
foot_ax.axis('off')
foot_ax.text(0.5, 0.55,
'Sources: Bailey & Love\'s Short Practice of Surgery (28e) · Sabiston Textbook of Surgery (21e) · Fischer\'s Mastery of Surgery (8e)',
ha='center', va='center', fontsize=9, color='#B0C4DE')
foot_ax.text(0.5, 0.15,
'TME reduces local recurrence from ~25% → ~6% | 5-year survival improves from ~60% → ~73%',
ha='center', va='center', fontsize=9.5, color='#FFD700', fontweight='bold')
# ═══════════════════════════════════════════════════════════════════════════
# SAVE
# ═══════════════════════════════════════════════════════════════════════════
out = '/home/daytona/workspace/tme-poster/TME_Surgical_Atlas.png'
plt.savefig(out, dpi=180, bbox_inches='tight', facecolor=C['bg'])
print(f"Saved: {out}")
plt.close()
cd /home/daytona/workspace/tme-poster && python tme_atlas.py 2>&1
ls -lh /home/daytona/workspace/tme-poster/TME_Surgical_Atlas.png
TME Surgical Atlas
Image · PNG