Slit lamp illumination technics by Monica chudhary book with images
Monica Chaudhary slit lamp illumination techniques ophthalmology book
https://www.slideshare.net/slideshow/slit-lamp-biomicroscopy…
Monica Chaudhary's Contact Lens Primer specifically notes this technique for observing contact lens fitting performance.

| Technique | Beam Setup | Key Clinical Uses |
|---|---|---|
| Diffuse | Wide, low intensity | General survey, CL fitting |
| Broad beam / Parallelpiped | 1-2 mm wide, 30-45° | 3D corneal view, AC depth |
| Optical section | Narrowest beam | Depth of corneal lesion |
| Indirect illumination | Beam beside area of interest | Microcysts, infiltrates |
| Scleral scatter | Beam at limbus, scope at center | Subtle stromal haze |
| Retroillumination (iris) | Beam on iris, scope on cornea | Epithelial cysts, KPs |
| Retroillumination (fundus) | Coaxial, dilated pupil | Lens/vitreous opacities |
| Specular reflection | Angle of incidence = reflection | Endothelial assessment, tear film |
| Oscillating | Sweeping beam | Aqueous flare/cells |
Create a quick reference PDF guide on slit lamp techniques
mkdir -p /tmp/workspace/slit-lamp-guide && ls /tmp/workspace/
~/slit-lamp-guide/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, Rect, Line, Circle, String, Polygon
from reportlab.graphics import renderPDF
from reportlab.graphics.shapes import Group
import os
OUTPUT_PATH = "/tmp/workspace/slit-lamp-guide/Slit_Lamp_Illumination_Quick_Reference.pdf"
# ── Colour palette ──────────────────────────────────────────────────────────────
TEAL = colors.HexColor("#006D77")
TEAL_LIGHT = colors.HexColor("#83C5BE")
TEAL_PALE = colors.HexColor("#EDF6F9")
ORANGE = colors.HexColor("#E76F51")
ORANGE_LT = colors.HexColor("#FFDDD2")
GOLD = colors.HexColor("#E9C46A")
DARK = colors.HexColor("#1A1A2E")
MID_GREY = colors.HexColor("#555555")
LIGHT_GREY = colors.HexColor("#F0F4F8")
WHITE = colors.white
RED_BEAM = colors.HexColor("#D62828")
W, H = A4
# ── Document ────────────────────────────────────────────────────────────────────
doc = SimpleDocTemplate(
OUTPUT_PATH,
pagesize=A4,
leftMargin=15*mm, rightMargin=15*mm,
topMargin=15*mm, bottomMargin=15*mm,
title="Slit Lamp Illumination Techniques – Quick Reference",
author="Orris Medical Reference"
)
styles = getSampleStyleSheet()
def S(name, **kw):
return ParagraphStyle(name, **kw)
title_style = S("Title2",
fontName="Helvetica-Bold", fontSize=22, textColor=WHITE,
alignment=TA_CENTER, spaceAfter=4)
subtitle_style = S("Sub2",
fontName="Helvetica", fontSize=11, textColor=TEAL_LIGHT,
alignment=TA_CENTER, spaceAfter=2)
ref_style = S("Ref",
fontName="Helvetica-Oblique", fontSize=8, textColor=TEAL_LIGHT,
alignment=TA_CENTER)
section_head = S("SecH",
fontName="Helvetica-Bold", fontSize=13, textColor=WHITE,
alignment=TA_CENTER, spaceAfter=4, spaceBefore=2)
card_title = S("CardT",
fontName="Helvetica-Bold", fontSize=11, textColor=TEAL,
spaceAfter=3)
card_body = S("CardB",
fontName="Helvetica", fontSize=8.5, textColor=DARK,
spaceAfter=2, leading=13)
card_label = S("CardL",
fontName="Helvetica-Bold", fontSize=8, textColor=MID_GREY,
spaceAfter=1)
bullet_style = S("Bul",
fontName="Helvetica", fontSize=8.5, textColor=DARK,
leftIndent=10, spaceAfter=1, leading=13)
tip_style = S("Tip",
fontName="Helvetica-Oblique", fontSize=8, textColor=ORANGE,
spaceAfter=2)
footer_style = S("Foot",
fontName="Helvetica", fontSize=7, textColor=colors.HexColor("#AAAAAA"),
alignment=TA_CENTER)
filter_head = S("FH",
fontName="Helvetica-Bold", fontSize=9, textColor=WHITE, alignment=TA_CENTER)
filter_body = S("FB",
fontName="Helvetica", fontSize=8, textColor=DARK, leading=12)
table_hdr = S("TH",
fontName="Helvetica-Bold", fontSize=8.5, textColor=WHITE, alignment=TA_CENTER)
table_cell = S("TC",
fontName="Helvetica", fontSize=8, textColor=DARK, alignment=TA_CENTER, leading=12)
table_cell_l = S("TCL",
fontName="Helvetica", fontSize=8, textColor=DARK, alignment=TA_LEFT, leading=12)
# ── Diagram helpers ──────────────────────────────────────────────────────────────
def cornea_arc(d, cx, cy, r=28, fill=colors.HexColor("#CCE8FF"), stroke=TEAL):
"""Simple cornea outline arc approximated as an ellipse sector."""
# Draw as a simple arc outline
from reportlab.graphics.shapes import ArcPath
# Just draw the corneal silhouette as a filled ellipse segment
pass
def make_eye_diagram(technique, w=120, h=90):
"""Return a Drawing of the eye cross-section with beam for each technique."""
d = Drawing(w, h)
# Background
bg = Rect(0, 0, w, h, fillColor=colors.HexColor("#F7FBFF"), strokeColor=TEAL_LIGHT, strokeWidth=0.5)
d.add(bg)
cx, cy = w * 0.5, h * 0.42
# ── Eye outline (cornea+sclera simplified) ───────────────────────────────
# Sclera (white of eye) - wide ellipse
sclera = Rect(cx - 38, cy - 14, 76, 28,
fillColor=colors.HexColor("#FAFAFA"),
strokeColor=colors.HexColor("#BBBBBB"), strokeWidth=0.8,
rx=14, ry=14)
d.add(sclera)
# Iris
iris = Circle(cx, cy, 11, fillColor=colors.HexColor("#7B5EA7"),
strokeColor=colors.HexColor("#5A3E8A"), strokeWidth=0.8)
d.add(iris)
# Pupil
pupil = Circle(cx, cy, 5, fillColor=DARK, strokeColor=None)
d.add(pupil)
# Cornea (transparent arc - represented as a thin curved cap)
cornea = Rect(cx - 16, cy + 10, 32, 8,
fillColor=colors.HexColor("#D4EFFF"),
strokeColor=TEAL, strokeWidth=1.0,
rx=10, ry=4)
d.add(cornea)
# cornea label
d.add(String(cx, cy + 22, "Cornea", fontSize=6, fillColor=TEAL,
textAnchor="middle"))
# Lens
lens = Rect(cx - 8, cy - 9, 16, 18,
fillColor=colors.HexColor("#E8F8FF"),
strokeColor=colors.HexColor("#99CCEE"), strokeWidth=0.7,
rx=6, ry=6)
d.add(lens)
# ── Beam drawing per technique ───────────────────────────────────────────
if technique == "diffuse":
# Wide fan of rays from upper-left
for dx in [-8, -4, 0, 4, 8]:
d.add(Line(cx - 35 + dx, h - 8, cx + dx, cy + 18,
strokeColor=colors.HexColor("#FFD700"),
strokeWidth=1.2))
d.add(String(cx, h - 2, "Wide diffuse beam", fontSize=6,
fillColor=MID_GREY, textAnchor="middle"))
elif technique == "optical_section":
# Narrow single beam at angle
d.add(Line(cx - 30, h - 5, cx, cy + 18,
strokeColor=RED_BEAM, strokeWidth=2.0))
# Show layers
for i, (lbl, col) in enumerate([("Epi", "#FF6B6B"), ("Stroma", "#FF9966"), ("Endo", "#FFCC66")]):
yy = cy + 17 - i * 4
d.add(Line(cx - 4, yy, cx + 4, yy,
strokeColor=colors.HexColor(col), strokeWidth=1.5))
d.add(String(cx, h - 2, "Narrow optical section", fontSize=6,
fillColor=MID_GREY, textAnchor="middle"))
elif technique == "indirect":
# Beam beside area, scope at center
d.add(Line(cx + 28, h - 5, cx + 18, cy + 18,
strokeColor=RED_BEAM, strokeWidth=1.8))
# Dashed scope line at center
for i in range(3):
yy = h - 8 - i * 8
d.add(Line(cx, yy, cx, yy - 5,
strokeColor=TEAL, strokeWidth=1.0))
d.add(String(cx, h - 2, "Beam beside area", fontSize=6,
fillColor=MID_GREY, textAnchor="middle"))
elif technique == "scleral":
# Beam at limbus (side), light path inside cornea
# Incoming beam to limbus
d.add(Line(cx - 50, h - 10, cx - 16, cy + 14,
strokeColor=RED_BEAM, strokeWidth=2.0))
# Internal reflection arrows along cornea
d.add(Line(cx - 16, cy + 14, cx + 16, cy + 14,
strokeColor=colors.HexColor("#FFA500"), strokeWidth=1.5))
d.add(Line(cx + 16, cy + 14, cx + 35, h - 10,
strokeColor=RED_BEAM, strokeWidth=1.5))
# Scatter point
scatter = Circle(cx, cy + 20, 4,
fillColor=colors.HexColor("#FFEE55"),
strokeColor=GOLD, strokeWidth=1)
d.add(scatter)
d.add(String(cx, h - 2, "Beam → Limbus, TIR in cornea", fontSize=6,
fillColor=MID_GREY, textAnchor="middle"))
elif technique == "retro_iris":
# Beam hits iris, reflected up through cornea
d.add(Line(cx + 28, h - 5, cx + 8, cy + 10,
strokeColor=RED_BEAM, strokeWidth=2.0))
# Reflected beam upward
d.add(Line(cx + 8, cy + 10, cx, cy + 18,
strokeColor=colors.HexColor("#FF8C00"), strokeWidth=1.5))
d.add(Line(cx, cy + 18, cx - 10, h - 5,
strokeColor=colors.HexColor("#FF8C00"), strokeWidth=1.0))
d.add(String(cx, h - 2, "Reflects off iris → cornea", fontSize=6,
fillColor=MID_GREY, textAnchor="middle"))
elif technique == "retro_fundus":
# Coaxial beam → fundus → back
d.add(Line(cx, h - 5, cx, cy + 18,
strokeColor=RED_BEAM, strokeWidth=2.0))
d.add(Line(cx, cy + 18, cx, cy - 14,
strokeColor=RED_BEAM, strokeWidth=1.5))
# Fundus glow
d.add(Rect(cx - 20, cy - 20, 40, 8,
fillColor=colors.HexColor("#FF6600"),
strokeColor=None, rx=3, ry=3))
d.add(String(cx, cy - 16, "Fundus", fontSize=5.5,
fillColor=WHITE, textAnchor="middle"))
# Return path
for dx in [-6, 0, 6]:
d.add(Line(cx + dx, cy - 12, cx + dx - 2, h - 5,
strokeColor=colors.HexColor("#FFB347"), strokeWidth=0.8))
d.add(String(cx, h - 2, "Coaxial, dilated pupil", fontSize=6,
fillColor=MID_GREY, textAnchor="middle"))
elif technique == "specular":
# Angle of incidence = angle of reflection
d.add(Line(cx - 30, h - 5, cx, cy + 18,
strokeColor=RED_BEAM, strokeWidth=2.0))
d.add(Line(cx, cy + 18, cx + 30, h - 5,
strokeColor=colors.HexColor("#FF8C00"), strokeWidth=2.0))
# Normal line
d.add(Line(cx, cy + 18, cx, cy + 32,
strokeColor=MID_GREY, strokeWidth=0.7))
d.add(String(cx - 22, h - 10, "i", fontSize=7, fillColor=RED_BEAM))
d.add(String(cx + 18, h - 10, "r", fontSize=7,
fillColor=colors.HexColor("#FF8C00")))
d.add(String(cx, h - 2, "Angle i = Angle r", fontSize=6,
fillColor=MID_GREY, textAnchor="middle"))
return d
# ── Technique data ──────────────────────────────────────────────────────────────
techniques = [
{
"name": "1. Diffuse Illumination",
"diagram": "diffuse",
"setup": "Wide beam + diffuser/frosted glass; low intensity; 45° angle",
"uses": [
"General survey of anterior segment",
"Gross lid, conjunctiva & corneal changes",
"Contact lens fitting performance",
"Initial orientation before other techniques",
],
"tip": "Always start your exam here — gives a quick overview before fine detail work.",
"mag": "Low (6–10×)",
"beam": "Wide / diffuse",
"angle": "~45°",
"color": TEAL_PALE,
},
{
"name": "2. Direct Focal (Parallelepiped)",
"diagram": "optical_section",
"setup": "Beam 1–2 mm wide at 30–45° to microscope axis; moderate intensity",
"uses": [
"3D block view of corneal layers",
"Anterior chamber depth assessment",
"Epithelial & stromal pathology",
"Debris beneath contact lens",
],
"tip": "Use red-free (green) filter to enhance corneal nerves and blood vessels.",
"mag": "Medium–high (16–25×)",
"beam": "1–2 mm wide",
"angle": "30–45°",
"color": colors.HexColor("#EAF4FB"),
},
{
"name": "3. Optical Section (Thin Beam)",
"diagram": "optical_section",
"setup": "Narrowest beam possible; high intensity; 30–45°",
"uses": [
"Exact depth of corneal lesions (epi/stroma/endo)",
"Flare assessment in anterior chamber",
"Crystalline lens assessment",
"Corneal foreign body depth",
],
"tip": "Adjust slit height to measure vertical/horizontal lesion size using the calibrated scale.",
"mag": "High (25–40×)",
"beam": "Thinnest (< 0.5 mm)",
"angle": "30–45°",
"color": colors.HexColor("#FFF7EC"),
},
{
"name": "4. Indirect (Proximal) Illumination",
"diagram": "indirect",
"setup": "Beam focused beside (not on) area of interest; microscope at area",
"uses": [
"Corneal microcysts & vacuoles",
"Epithelial infiltrates",
"Subtle changes missed by direct illumination",
"Contact lens-induced changes",
],
"tip": "Offset the beam just 1–2 mm beside the area — the indirect glow reveals fine detail.",
"mag": "Medium (16–25×)",
"beam": "Moderate",
"angle": "30–45°",
"color": TEAL_PALE,
},
{
"name": "5. Scleral Scatter",
"diagram": "scleral",
"setup": "Beam at limbus (decentralized); microscope focused centrally on cornea",
"uses": [
"Subtle stromal haze (e.g., early keratoconus)",
"Cellular & lipid infiltration",
"Fleischer ring, Vogt's striae",
"Contact lens-induced oedema",
],
"tip": "The entire cornea glows faintly — any opacity appears as a bright spot. No filters needed.",
"mag": "Low–medium",
"beam": "Focused at limbus",
"angle": "Decentralized",
"color": colors.HexColor("#FFF4E6"),
},
{
"name": "6. Retroillumination (Iris)",
"diagram": "retro_iris",
"setup": "Beam on iris; microscope focused on cornea; use iris as reflector",
"uses": [
"Corneal epithelial cysts",
"Keratic precipitates (KPs)",
"Small corneal vessels",
"Fine endothelial changes",
],
"tip": "Direct: lesion appears dark on bright iris. Indirect: move to dark iris area — lesion appears bright.",
"mag": "High (25–40×)",
"beam": "Narrow",
"angle": "Variable",
"color": TEAL_PALE,
},
{
"name": "7. Retroillumination (Fundus)",
"diagram": "retro_fundus",
"setup": "Pupil dilated; coaxial beam & microscope; beam strikes fundus",
"uses": [
"Lens/vitreous opacities",
"Posterior corneal changes",
"Contact lens surface deposits (front & back)",
"Media opacities assessment",
],
"tip": "Requires dilation. Red-orange fundal glow silhouettes opacities dramatically.",
"mag": "Medium",
"beam": "Coaxial",
"angle": "Coaxial (0°)",
"color": colors.HexColor("#FFF0F0"),
},
{
"name": "8. Specular Reflection",
"diagram": "specular",
"setup": "Angle of incidence = angle of reflection from corneal surface",
"uses": [
"Endothelial cell morphology (mosaic pattern)",
"Corneal guttata & pseudoguttata",
"Pre-corneal tear film lipid layer",
"Contact lens front-surface wetting",
],
"tip": "Position microscope to capture the bright specular reflex — adjust until endothelial mosaic is visible.",
"mag": "High (40×)",
"beam": "Narrow–medium",
"angle": "Mirror angle (i = r)",
"color": colors.HexColor("#FDF5FF"),
},
]
# ─────────────────────────────────────────────────────────────────────────────
# Build story
# ─────────────────────────────────────────────────────────────────────────────
story = []
# ── COVER HEADER BAND ────────────────────────────────────────────────────────
header_data = [[
Paragraph("SLIT LAMP ILLUMINATION TECHNIQUES", title_style),
Paragraph("Quick Reference Guide", subtitle_style),
Paragraph("Based on Monica Chaudhary's Contact Lens Primer & Kanski's Clinical Ophthalmology", ref_style),
]]
header_table = Table(header_data, colWidths=[W - 30*mm])
header_table.setStyle(TableStyle([
("BACKGROUND", (0, 0), (-1, -1), TEAL),
("ROUNDEDCORNERS", (0, 0), (-1, -1), [8]),
("TOPPADDING", (0, 0), (-1, -1), 12),
("BOTTOMPADDING", (0, 0), (-1, -1), 12),
("LEFTPADDING", (0, 0), (-1, -1), 12),
]))
story.append(header_table)
story.append(Spacer(1, 8*mm))
# ── INTRO BOX ────────────────────────────────────────────────────────────────
intro_text = (
"<b>The slit lamp biomicroscope</b> uses Gullstrand's illumination system to project a bright, "
"adjustable slit of light at the eye. By varying <b>beam width, angle, intensity</b> and <b>focus point</b>, "
"8 distinct illumination techniques are possible — each revealing different ocular structures. "
"Magnification ranges from <b>6× (survey)</b> to <b>40× (fine detail)</b>. "
"Always begin with diffuse illumination for orientation."
)
intro_para = Paragraph(intro_text, ParagraphStyle("Intro",
fontName="Helvetica", fontSize=9, textColor=DARK,
alignment=TA_JUSTIFY, leading=14))
intro_box = Table([[intro_para]], colWidths=[W - 30*mm])
intro_box.setStyle(TableStyle([
("BACKGROUND", (0, 0), (-1, -1), LIGHT_GREY),
("BOX", (0, 0), (-1, -1), 0.8, TEAL_LIGHT),
("TOPPADDING", (0, 0), (-1, -1), 8),
("BOTTOMPADDING", (0, 0), (-1, -1), 8),
("LEFTPADDING", (0, 0), (-1, -1), 10),
("RIGHTPADDING", (0, 0), (-1, -1), 10),
("ROUNDEDCORNERS", (0, 0), (-1, -1), [5]),
]))
story.append(intro_box)
story.append(Spacer(1, 6*mm))
# ── TECHNIQUE CARDS (2 per row) ───────────────────────────────────────────────
CARD_W = (W - 30*mm - 6*mm) / 2 # two columns with gap
def make_card(t):
diag = make_eye_diagram(t["diagram"], w=110, h=78)
title_p = Paragraph(t["name"], card_title)
setup_lbl = Paragraph("SETUP", card_label)
setup_p = Paragraph(t["setup"], card_body)
uses_lbl = Paragraph("CLINICAL USES", card_label)
uses_items = [Paragraph(f"• {u}", bullet_style) for u in t["uses"]]
tip_p = Paragraph(f"💡 {t['tip']}", tip_style)
# Mini param strip
param_data = [
[Paragraph("MAG", filter_head), Paragraph("BEAM", filter_head), Paragraph("ANGLE", filter_head)],
[Paragraph(t["mag"], filter_body), Paragraph(t["beam"], filter_body), Paragraph(t["angle"], filter_body)],
]
param_table = Table(param_data, colWidths=[CARD_W*0.33]*3)
param_table.setStyle(TableStyle([
("BACKGROUND", (0, 0), (-1, 0), TEAL),
("BACKGROUND", (0, 1), (-1, 1), colors.HexColor("#F8F8F8")),
("BOX", (0, 0), (-1, -1), 0.5, TEAL_LIGHT),
("INNERGRID", (0, 0), (-1, -1), 0.3, TEAL_LIGHT),
("TOPPADDING", (0, 0), (-1, -1), 3),
("BOTTOMPADDING", (0, 0), (-1, -1), 3),
("ALIGN", (0, 0), (-1, -1), "CENTER"),
]))
content = [
title_p,
diag,
Spacer(1, 2),
setup_lbl, setup_p,
uses_lbl,
*uses_items,
Spacer(1, 2),
param_table,
Spacer(1, 3),
tip_p,
]
card_inner = Table([[c] for c in content], colWidths=[CARD_W - 12])
card_inner.setStyle(TableStyle([
("TOPPADDING", (0, 0), (-1, -1), 1),
("BOTTOMPADDING", (0, 0), (-1, -1), 1),
("LEFTPADDING", (0, 0), (-1, -1), 0),
("RIGHTPADDING", (0, 0), (-1, -1), 0),
]))
outer = Table([[card_inner]], colWidths=[CARD_W])
outer.setStyle(TableStyle([
("BACKGROUND", (0, 0), (-1, -1), t["color"]),
("BOX", (0, 0), (-1, -1), 1.0, TEAL),
("TOPPADDING", (0, 0), (-1, -1), 8),
("BOTTOMPADDING", (0, 0), (-1, -1), 8),
("LEFTPADDING", (0, 0), (-1, -1), 6),
("RIGHTPADDING", (0, 0), (-1, -1), 6),
("ROUNDEDCORNERS", (0, 0), (-1, -1), [6]),
]))
return outer
# Pair techniques into rows of 2
for i in range(0, len(techniques), 2):
left = make_card(techniques[i])
right = make_card(techniques[i + 1]) if i + 1 < len(techniques) else Spacer(CARD_W, 1)
row = Table([[left, right]], colWidths=[CARD_W, CARD_W], spaceBefore=0)
row.setStyle(TableStyle([
("TOPPADDING", (0, 0), (-1, -1), 0),
("BOTTOMPADDING", (0, 0), (-1, -1), 0),
("LEFTPADDING", (0, 0), (-1, -1), 0),
("RIGHTPADDING", (0, 0), (-1, -1), 3),
("VALIGN", (0, 0), (-1, -1), "TOP"),
]))
story.append(KeepTogether([row]))
story.append(Spacer(1, 5*mm))
# ── PAGE 2 HEADER ─────────────────────────────────────────────────────────────
story.append(Spacer(1, 4*mm))
sec_bg = Table([[Paragraph("SUMMARY TABLE & FILTERS", section_head)]],
colWidths=[W - 30*mm])
sec_bg.setStyle(TableStyle([
("BACKGROUND", (0, 0), (-1, -1), TEAL),
("TOPPADDING", (0, 0), (-1, -1), 7),
("BOTTOMPADDING", (0, 0), (-1, -1), 7),
("ROUNDEDCORNERS", (0, 0), (-1, -1), [6]),
]))
story.append(sec_bg)
story.append(Spacer(1, 5*mm))
# ── SUMMARY TABLE ─────────────────────────────────────────────────────────────
sum_headers = ["Technique", "Beam", "Angle", "Key Uses", "CL Application"]
sum_rows = [
["Diffuse", "Wide/diffuse", "~45°", "Gross survey, orientation", "Fitting performance"],
["Parallelepiped", "1–2 mm", "30–45°", "3D corneal block view, AC depth", "Debris under lens"],
["Optical Section", "< 0.5 mm", "30–45°", "Lesion depth (epi/stroma/endo)", "Lens thickness"],
["Indirect", "Moderate, offset", "30–45°", "Microcysts, infiltrates", "CL-induced changes"],
["Scleral Scatter", "Limbus-focused", "Decentralised", "Stromal haze, Fleischer ring", "Oedema detection"],
["Retro (Iris)", "Narrow, on iris", "Variable", "Epithelial cysts, KPs", "Deposits"],
["Retro (Fundus)", "Coaxial", "0° (coaxial)", "Media opacities, lens changes", "Surface deposits"],
["Specular Refl.", "Narrow–medium", "i = r", "Endothelium, guttata, tear film", "Surface wetting"],
]
table_header_row = [Paragraph(h, table_hdr) for h in sum_headers]
table_data = [table_header_row]
for i, row in enumerate(sum_rows):
bg = TEAL_PALE if i % 2 == 0 else WHITE
table_data.append([Paragraph(c, table_cell if j > 0 else table_cell_l) for j, c in enumerate(row)])
col_widths = [38*mm, 28*mm, 28*mm, 52*mm, 34*mm]
sum_table = Table(table_data, colWidths=col_widths, repeatRows=1)
sum_table.setStyle(TableStyle([
("BACKGROUND", (0, 0), (-1, 0), TEAL),
("ROWBACKGROUNDS", (0, 1), (-1, -1), [TEAL_PALE, WHITE]),
("BOX", (0, 0), (-1, -1), 1.0, TEAL),
("INNERGRID", (0, 0), (-1, -1), 0.4, TEAL_LIGHT),
("TOPPADDING", (0, 0), (-1, -1), 5),
("BOTTOMPADDING", (0, 0), (-1, -1), 5),
("LEFTPADDING", (0, 0), (-1, -1), 6),
("RIGHTPADDING", (0, 0), (-1, -1), 6),
("VALIGN", (0, 0), (-1, -1), "MIDDLE"),
("FONTNAME", (0, 0), (-1, 0), "Helvetica-Bold"),
]))
story.append(sum_table)
story.append(Spacer(1, 7*mm))
# ── FILTERS SECTION ───────────────────────────────────────────────────────────
filter_title = Table([[Paragraph("SLIT LAMP FILTERS", section_head)]],
colWidths=[W - 30*mm])
filter_title.setStyle(TableStyle([
("BACKGROUND", (0, 0), (-1, -1), ORANGE),
("TOPPADDING", (0, 0), (-1, -1), 7),
("BOTTOMPADDING", (0, 0), (-1, -1), 7),
("ROUNDEDCORNERS", (0, 0), (-1, -1), [6]),
]))
story.append(filter_title)
story.append(Spacer(1, 5*mm))
filters = [
{
"name": "Cobalt Blue Filter",
"color": colors.HexColor("#1565C0"),
"with": "Sodium fluorescein dye",
"uses": [
"Corneal epithelial defects / abrasions",
"Tear film break-up time (TBUT)",
"Contact lens fit assessment",
"Applanation tonometry",
],
},
{
"name": "Red-Free (Green) Filter",
"color": colors.HexColor("#2E7D32"),
"with": "No dye required",
"uses": [
"Blood vessels appear black (high contrast)",
"Corneal nerve visualisation",
"Haemorrhage detection",
"Superficial vascular anomalies",
],
},
{
"name": "Neutral Density Filter",
"color": colors.HexColor("#546E7A"),
"with": "Any technique",
"uses": [
"Reduces light intensity for photophobic patients",
"Sensitive eyes or inflamed corneas",
"Post-operative eyes",
],
},
{
"name": "Yellow Filter (Wratten 12)",
"color": colors.HexColor("#F57F17"),
"with": "Cobalt blue + fluorescein",
"uses": [
"Enhances fluorescein contrast further",
"Reduces background glare",
"Useful for TBUT in bright conditions",
],
},
]
filter_cards = []
for f in filters:
title_p2 = Paragraph(f["name"],
ParagraphStyle("FT", fontName="Helvetica-Bold", fontSize=9.5,
textColor=WHITE))
with_p = Paragraph(f"Used with: {f['with']}",
ParagraphStyle("FW", fontName="Helvetica-Oblique", fontSize=7.5,
textColor=colors.HexColor("#EEEEEE")))
uses_ps = [Paragraph(f"• {u}", ParagraphStyle("FU", fontName="Helvetica",
fontSize=8, textColor=DARK, leading=12, leftIndent=6))
for u in f["uses"]]
head_content = Table([[title_p2], [with_p]],
colWidths=[(W - 30*mm) / 4 - 8])
head_content.setStyle(TableStyle([
("BACKGROUND", (0, 0), (-1, -1), f["color"]),
("TOPPADDING", (0, 0), (-1, -1), 5),
("BOTTOMPADDING", (0, 0), (-1, -1), 5),
("LEFTPADDING", (0, 0), (-1, -1), 6),
("RIGHTPADDING", (0, 0), (-1, -1), 4),
("ROUNDEDCORNERS", (0, 0), (0, 0), [5, 5, 0, 0]),
]))
uses_content = Table([[u] for u in uses_ps],
colWidths=[(W - 30*mm) / 4 - 8])
uses_content.setStyle(TableStyle([
("BACKGROUND", (0, 0), (-1, -1), LIGHT_GREY),
("TOPPADDING", (0, 0), (-1, -1), 3),
("BOTTOMPADDING", (0, 0), (-1, -1), 2),
("LEFTPADDING", (0, 0), (-1, -1), 4),
("RIGHTPADDING", (0, 0), (-1, -1), 4),
("BOX", (0, 0), (-1, -1), 0.6, f["color"]),
]))
card2 = Table([[head_content], [uses_content]],
colWidths=[(W - 30*mm) / 4 - 8])
card2.setStyle(TableStyle([
("TOPPADDING", (0, 0), (-1, -1), 0),
("BOTTOMPADDING", (0, 0), (-1, -1), 0),
("LEFTPADDING", (0, 0), (-1, -1), 0),
("RIGHTPADDING", (0, 0), (-1, -1), 0),
("BOX", (0, 0), (-1, -1), 1.0, f["color"]),
("ROUNDEDCORNERS", (0, 0), (-1, -1), [5]),
]))
filter_cards.append(card2)
filter_row = Table([filter_cards],
colWidths=[(W - 30*mm) / 4] * 4)
filter_row.setStyle(TableStyle([
("TOPPADDING", (0, 0), (-1, -1), 0),
("BOTTOMPADDING", (0, 0), (-1, -1), 0),
("LEFTPADDING", (0, 0), (-1, -1), 0),
("RIGHTPADDING", (0, 0), (-1, -1), 3),
("VALIGN", (0, 0), (-1, -1), "TOP"),
]))
story.append(filter_row)
story.append(Spacer(1, 7*mm))
# ── CLINICAL TIPS BOX ────────────────────────────────────────────────────────
tips_title = Paragraph(
"● CLINICAL PEARLS",
ParagraphStyle("PT", fontName="Helvetica-Bold", fontSize=10,
textColor=ORANGE, spaceAfter=4))
tips = [
"Always start with <b>diffuse illumination</b> for orientation before narrowing the beam.",
"Use <b>scleral scatter</b> whenever diffuse illumination looks 'normal' but symptoms persist.",
"For depth assessment, <b>optical section</b> is essential — the lesion's position within the beam tells you the layer.",
"<b>Specular reflection</b> requires patience; move until the bright spot reveals the endothelial mosaic.",
"In contact lens practice, <b>retroillumination from the fundus</b> best reveals surface deposits on both lens faces.",
"Combine <b>cobalt blue filter + fluorescein</b> with specular reflection for tear film lipid layer assessment.",
"For KPs: use <b>retroillumination from the iris</b> to reveal fine KPs that optical section may miss.",
]
tips_content = [tips_title] + [
Paragraph(f" ▶ {t}", ParagraphStyle("TT", fontName="Helvetica", fontSize=8.5,
textColor=DARK, leading=14, spaceAfter=1, leftIndent=8))
for t in tips
]
tips_inner = Table([[c] for c in tips_content], colWidths=[W - 30*mm - 16])
tips_inner.setStyle(TableStyle([
("TOPPADDING", (0, 0), (-1, -1), 1),
("BOTTOMPADDING", (0, 0), (-1, -1), 1),
("LEFTPADDING", (0, 0), (-1, -1), 0),
]))
tips_box = Table([[tips_inner]], colWidths=[W - 30*mm])
tips_box.setStyle(TableStyle([
("BACKGROUND", (0, 0), (-1, -1), ORANGE_LT),
("BOX", (0, 0), (-1, -1), 1.0, ORANGE),
("TOPPADDING", (0, 0), (-1, -1), 10),
("BOTTOMPADDING", (0, 0), (-1, -1), 10),
("LEFTPADDING", (0, 0), (-1, -1), 10),
("RIGHTPADDING", (0, 0), (-1, -1), 10),
("ROUNDEDCORNERS", (0, 0), (-1, -1), [6]),
]))
story.append(tips_box)
story.append(Spacer(1, 6*mm))
# ── FOOTER ───────────────────────────────────────────────────────────────────
story.append(HRFlowable(width="100%", thickness=0.5, color=TEAL_LIGHT))
story.append(Spacer(1, 2*mm))
story.append(Paragraph(
"Reference: Monica Chaudhary, <i>Contact Lens Primer</i>, 1st ed., pp. 28–40 | "
"Kanski's Clinical Ophthalmology, 10th ed., p. 35 | "
"A.K. Khurana, <i>Theory and Practice of Optics and Refraction</i>, 3rd ed., pp. 351–61 | "
"Orris Medical Reference · orris.care",
footer_style))
# ── Build ────────────────────────────────────────────────────────────────────
doc.build(story)
print(f"PDF saved → {OUTPUT_PATH}")
cd /tmp/workspace/slit-lamp-guide && python generate_pdf.py
ls -lh /tmp/workspace/slit-lamp-guide/
Slit Lamp Illumination Quick Reference
PDF Document · PDF