Eye explain. Write according to exam

Asking for Preferences
Reading File
Finding Sources
Finding Sources
Finding Sources
Reading File
Finding Sources
Finding Sources
Reading File
Finding Sources
Finding Sources
Reading File
Reading File
Loading Image
Reading File
Loading Image
I now have all the content needed for a thorough exam-style write-up. Let me compile the complete answer.

The Eye - Complete Chapter for MBBS Exams

(Source: Ganong's Review of Medical Physiology 26e + Robbins & Kumar Basic Pathology)

ANATOMY OF THE EYE

Cross-section anatomy of the human eye showing all major structures

Coats / Layers of the Eyeball (3 layers)

LayerComponentsFunction
Outer fibrous coatSclera (posterior 5/6) + Cornea (anterior 1/6)Protection; light entry
Middle vascular coat (Uvea)Choroid + Ciliary body + IrisNutrition; accommodation; pupil control
Inner neural coatRetinaPhototransduction

Key Structures

1. Sclera
  • White, opaque outer layer
  • Continuous anteriorly with the transparent cornea
  • Modified anteriorly to form the cornea where light enters
2. Cornea
  • Transparent; avascular (nourished by aqueous humor)
  • First and most powerful refracting surface of the eye (~43 diopters)
  • Lateral margin continuous with the conjunctiva
3. Conjunctiva
  • Clear mucous membrane covering the sclera
  • Moistened by lacrimal secretions
4. Choroid
  • Vascular layer just inside the sclera
  • Provides O2 and nutrients to the retina and outer eye structures
5. Iris
  • Pigmented, opaque, colored portion of the eye
  • Contains two muscles:
    • Sphincter pupillae - constricts pupil (miosis) - parasympathetic (CN III)
    • Dilator pupillae - dilates pupil (mydriasis) - sympathetic
  • Pupil diameter variation can produce a 16-fold change in light reaching the retina
6. Ciliary Body
  • Contains circular and longitudinal smooth muscle fibers
  • Produces aqueous humor
  • Controls lens shape via zonular fibers (accommodation)
  • Circular fibers contract → zonule relaxes → lens becomes more convex (near vision)
7. Lens
  • Transparent, biconvex, avascular
  • Held in place by the zonule of Zinn (suspensory ligament)
  • Power: ~16-24 diopters (variable with accommodation)
8. Chambers of the Eye
ChamberLocationContents
Anterior chamberBetween cornea and irisAqueous humor
Posterior chamberBetween iris and lensAqueous humor
Vitreous chamberBetween lens and retinaVitreous humor (gelatinous)
9. Aqueous Humor
  • Clear, protein-free liquid
  • Produced in the ciliary body (diffusion + active transport from plasma)
  • Flow: Ciliary body → posterior chamber → pupil → anterior chamber → trabecular meshwork → Canal of Schlemm (venous channel at iridocorneal angle)
  • Normal IOP: 10-20 mmHg
  • Obstruction of drainage raises IOP → glaucoma risk
10. Retina
  • Neural layer lining posterior 2/3 of the choroid
  • Contains photoreceptors (rods and cones) arranged with their outer segments facing the choroid (inverted retina)
  • Light must pass through ganglion and bipolar layers FIRST before reaching rods/cones

LAYERS OF THE RETINA (Inside Out - 10 layers)

LayerContents
Internal limiting membraneInnermost
Nerve fiber layerAxons of ganglion cells → optic nerve
Ganglion cell layerOutput neurons (only cells generating action potentials)
Inner plexiform layerBipolar-ganglion cell synapses
Inner nuclear layerBipolar, horizontal, and amacrine cells
Outer plexiform layerPhotoreceptor-bipolar cell synapses
Outer nuclear layerNuclei of rods and cones
Outer limiting membrane
Photoreceptor layerOuter segments of rods and cones
Retinal pigment epitheliumAbsorbs light, recycles retinal, phagocytoses shed discs

Retinal Cell Types

  • Rods - scotopic (dim light) vision; 120 million; more peripheral; detect absolute illumination
  • Cones - photopic (bright light) + colour vision; 6 million; concentrated in fovea; 3 types (L, M, S - red, green, blue opsins)
  • Bipolar cells - relay neurons between photoreceptors and ganglion cells
  • Horizontal cells - lateral connections in outer plexiform layer (photoreceptor-to-photoreceptor)
  • Amacrine cells - lateral connections in inner plexiform layer (ganglion cell-to-ganglion cell)
  • Ganglion cells - sole output of retina; axons form the optic nerve; only neurons generating propagated action potentials

Special Retinal Regions

RegionFeature
Fovea centralisPoint of highest visual acuity; only cones, no rods
Macula luteaYellow pigmented area surrounding fovea
Optic disc (blind spot)Where optic nerve exits; no photoreceptors; nasal to fovea

PHYSIOLOGY - IMAGE FORMATION & OPTICS

Refraction

  • Visible light: 397-723 nm
  • Refracting surfaces: cornea (most powerful) → aqueous humor → lens → vitreous
  • Total refractive power of eye: ~59 diopters (relaxed)
  • Refractive power measured in diopters = 1/focal length (in metres)
  • Parallel rays (from >6 m) focused on retina without accommodation

Accommodation

  • Process of adjusting lens power for near objects (<6 m)
  • Near response triad:
    1. Accommodation (lens becomes more convex)
    2. Convergence (both eyes turn inward)
    3. Miosis (pupils constrict)
  • Mediated by parasympathetics via CN III → ciliary muscle contraction → zonule relaxes → lens rounds up

Errors of Refraction

ErrorDefectCauseCorrection
Myopia (short-sightedness)Image in front of retinaEyeball too long / lens too convexConcave (diverging) lens
Hypermetropia (long-sightedness)Image behind retinaEyeball too short / lens too flatConvex (converging) lens
PresbyopiaLoss of accommodation with ageLens loses elasticityReading glasses (convex)
AstigmatismUnequal curvature of cornea/lensIrregular refracting surfaceCylindrical lens

PHOTOTRANSDUCTION (Photoreceptor Mechanism)

Rhodopsin (Visual Purple)

  • Photopigment of rods
  • Composed of: Retinal (aldehyde of Vitamin A) + Opsin (protein, 41 kDa, 7 transmembrane domains)
  • Vitamin A deficiency → reduced rhodopsin → night blindness (nyctalopia)

The Dark Current

  • In darkness: cGMP levels are high → cGMP-gated Na⁺/Ca²⁺ channels are OPEN → steady inward current ("dark current") → sustained glutamate release from photoreceptor terminal

Effect of Light (Phototransduction Cascade)

  1. Light hits rhodopsin → retinal changes from 11-cis to all-trans configuration
  2. Opsin activated → activates transducin (G-protein, Gt)
  3. Transducin activates phosphodiesterase (PDE)
  4. PDE hydrolyses cGMP → 5'-GMP
  5. cGMP levels fall → cGMP-gated channels CLOSE
  6. Hyperpolarization of photoreceptor (membrane potential moves from -40 mV to -70 mV)
  7. Glutamate release DECREASES
  8. Signal transmitted to bipolar cells → ganglion cells → optic nerve → brain
Key exam point: Photoreceptors hyperpolarize (not depolarize) in response to light. Ganglion cells are the ONLY retinal neurons that fire action potentials.

Dark Adaptation

  • Transition from bright to dark light: takes ~20-30 minutes (rods regenerate rhodopsin)
  • Rod threshold much lower than cone threshold
  • Vitamin A essential for rhodopsin regeneration

Colour Vision

  • 3 cone types with different opsins (photopsins):
    • L-cones - peak sensitivity ~560 nm (red)
    • M-cones - peak sensitivity ~530 nm (green)
    • S-cones - peak sensitivity ~430 nm (blue)
  • Trichromatic theory (Young-Helmholtz): colour perception from ratio of activation of 3 cone types
  • Colour blindness: X-linked; usually red-green; more common in males

VISUAL PATHWAY

Retina
  ↓
Optic nerve (CN II)
  ↓
Optic chiasm (nasal fibres cross)
  ↓
Optic tract
  ↓
Lateral Geniculate Nucleus (LGN) of thalamus
  ↓
Optic radiation
  ↓
Primary visual cortex (V1) - occipital lobe (calcarine sulcus)

Field Defects (High-Yield for Exams)

Site of LesionVisual Field Defect
One optic nerveMonocular blindness (ipsilateral)
Optic chiasm (central)Bitemporal hemianopia
Optic tractContralateral homonymous hemianopia
Upper optic radiation (parietal)Lower quadrantanopia (contralateral)
Lower optic radiation (temporal, Meyer's loop)Upper quadrantanopia (contralateral) - "pie in the sky"
Visual cortexContralateral homonymous hemianopia with macular sparing

PUPILLARY LIGHT REFLEX

Pathway:
  • Afferent: Retina → CN II → pretectal nucleus (midbrain)
  • Efferent: Edinger-Westphal nucleus → CN III → ciliary ganglion → constrictor pupillae
Direct reflex: Constriction of illuminated eye Consensual reflex: Constriction of opposite eye (because pretectal nucleus projects bilaterally)
Relative Afferent Pupillary Defect (RAPD / Marcus Gunn pupil): Afferent defect in one eye; on swinging light test, the affected eye dilates instead of constricting. Important exam finding.

COMMON EYE DISORDERS

1. Glaucoma

Glaucoma types - aqueous humor pathways and angle closure mechanisms
Definition: Optic neuropathy associated with (usually) raised IOP causing irreversible loss of ganglion cells and their axons.
FeatureOpen-Angle (Chronic)Angle-Closure (Acute)
MechanismImpaired drainage through trabecular meshwork into Canal of SchlemmForward iris bowing (iris bombé) blocks filtration angle
OnsetGradual, insidiousAcute, sudden
SymptomsGradual peripheral vision loss, painlessSudden severe eye pain, headache, nausea, haloes around lights
IOPElevatedMarkedly elevated (can be >50 mmHg)
Most commonYes (primary open-angle is most common type overall)Less common; anatomically predisposed eyes
Pathophysiology:
  • Aqueous humor produced in ciliary body → posterior chamber → pupil → anterior chamber → trabecular meshwork → Canal of Schlemm
  • Any obstruction at trabecular meshwork or angle → ↑IOP → compression of optic nerve at lamina cribrosa → retinal ganglion cell death → cupping of optic disc → visual field loss (starts peripherally)
Note: 20-50% of glaucoma patients have normal IOP (normal-tension glaucoma)
Treatment:
DrugMechanismAction
β-blockers (timolol)↓ aqueous secretion
Carbonic anhydrase inhibitors (dorzolamide, acetazolamide)↓ aqueous secretion
Prostaglandin analogues (latanoprost)↑ aqueous outflowFirst-line
Cholinergic agonists (pilocarpine, carbachol)↑ outflow (ciliary contraction)Also used in acute closure
Alpha-2 agonists (brimonidine)↓ secretion + ↑ outflow
Exam alert: Prolonged corticosteroid use can cause glaucoma.

2. Cataract

Definition: Opacity of the crystalline lens causing painless, progressive blurring of vision.
Types and Causes:
TypeCause
Senile (most common)Age-related protein aggregation, oxidative damage
DiabeticSorbitol / fructose accumulation in lens (polyol pathway)
CongenitalTORCH infections, galactosaemia, Down syndrome
TraumaticBlunt injury
Drug-inducedProlonged corticosteroids, chlorpromazine
Radiation-inducedUV exposure, X-rays
Diabetic mechanism: Glucose → Sorbitol (via aldose reductase) → Fructose → osmotic accumulation in lens → swelling → opacity (nuclear or posterior subcapsular cataract in diabetes)
Features: Painless loss of vision, glare, altered color perception, monocular diplopia
Treatment: Surgical (phacoemulsification + IOL implant)

3. Retinal Detachment

Definition: Separation of the neurosensory retina from the underlying retinal pigment epithelium.
Types:
  • Rhegmatogenous - most common; due to a retinal tear/hole (myopia, trauma, degeneration)
  • Tractional - fibrovascular bands pull retina away (diabetes, sickle cell)
  • Exudative - fluid accumulation under retina (tumour, inflammation, hypertension)
Symptoms: Sudden flashes of light (photopsia), floaters, "curtain" or shadow across visual field; painless
Treatment: Laser photocoagulation, cryotherapy, scleral buckle, vitrectomy

4. Age-Related Macular Degeneration (ARMD)

Definition: Degeneration of the macula/fovea; leading cause of legal blindness in the elderly.
Types:
Dry (Atrophic)Wet (Exudative/Neovascular)
MechanismDrusen accumulation, RPE atrophyChoroidal neovascularization
%~85% of cases~15% of cases
Vision lossSlow, gradualRapid
TreatmentAntioxidant vitaminsAnti-VEGF (bevacizumab, ranibizumab)
Symptoms: Central scotoma (loss of central vision), metamorphopsia (straight lines appear wavy on Amsler grid test), difficulty reading

5. Diabetic Retinopathy

Definition: Microvascular complication of diabetes; leading cause of blindness in working-age adults.
Stages:
StageFeatures
Non-proliferative (NPDR) - BackgroundMicroaneurysms, dot-blot hemorrhages, hard exudates, cotton-wool spots (ischaemia)
Pre-proliferative NPDRVenous beading, IRMA (intraretinal microvascular abnormalities)
Proliferative (PDR)Neovascularization (NVD/NVE), vitreous hemorrhage, tractional retinal detachment
MaculopathyClinically significant macular edema (CSME) - most common cause of visual loss
Treatment: Glycaemic control, laser photocoagulation (NPDR/PDR), anti-VEGF (macula edema), vitrectomy

6. Hypertensive Retinopathy (Keith-Wagener-Barker classification)

GradeFeatures
IArteriolar narrowing/silver wiring
IIAV nipping (arteriovenous crossing changes)
IIIFlame hemorrhages, cotton-wool spots, hard exudates
IVGrade III + papilloedema

QUICK REVISION TABLE - Rods vs Cones

FeatureRodsCones
Number~120 million~6 million
LocationPeripheryMacula/fovea (concentrated)
Vision typeScotopic (dim light)Photopic (bright light)
Colour visionNoYes (3 types)
AcuityLowHigh
PhotopigmentRhodopsin (retinal + opsin)Iodopsin (retinal + photopsin)
ConvergenceHigh (many rods → 1 ganglion)Low (1 cone → 1 ganglion in fovea)
SensitivityHighLow

HIGH-YIELD EXAM MNEMONICS

  • "LGN layers" - Layers 1,2 = Magnocellular (M-cells, motion, depth); Layers 3-6 = Parvocellular (P-cells, colour, fine detail)
  • "RAPD" = afferent defect (optic nerve or retinal disease); Efferent defect = CN III palsy (both pupils affected)
  • Pupil constriction = CN III (parasympathetic); Dilation = Sympathetic (superior cervical ganglion via long ciliary nerves)
  • Glaucoma drugs to avoid: Anticholinergics (cause mydriasis → angle closure); Corticosteroids (raise IOP)
  • Vitamin A deficiency: Night blindness (nyctalopia) → Bitot's spots → Xerophthalmia → Keratomalacia (corneal softening/perforation)

Sources: Ganong's Review of Medical Physiology 26e, pp. 197-215; Robbins & Kumar Basic Pathology, pp. 868-869

Can you take the source guyton and ak jain

Finding Sources
Finding Sources
Reading File
Reading File
Reading File
Reading File
Reading File
Reading File
Reading File
Reading File
Reading File
Loading Image
Loading Image
Loading Image
Note on AK Jain: AK Jain's Textbook of Physiology is not available in the library. The content below is drawn exclusively from Guyton and Hall Textbook of Medical Physiology (13th Ed) - the most authoritative physiology reference for MBBS, which covers the same topics and follows the same exam pattern. The key figures from Guyton are included.

THE EYE - Complete Chapter

Source: Guyton & Hall Textbook of Medical Physiology


PART I: OPTICS OF THE EYE

Refractive Index and Refraction of Light

  • Refractive index = velocity of light in air / velocity in a substance
  • Air = 1.00; Cornea = 1.38; Aqueous humor = 1.33; Crystalline lens = 1.40 (average); Vitreous humor = 1.34
  • Light bends (refracts) when it passes through an angulated interface between two media of different refractive indices
  • Degree of refraction depends on: (1) ratio of refractive indices, and (2) angulation between the interface and the entering wave front

The Lens System of the Eye

The eye has four refracting surfaces:
  1. Air-anterior cornea interface
  2. Posterior cornea-aqueous humor interface
  3. Aqueous humor-anterior lens interface
  4. Posterior lens-vitreous humor interface
Total refractive power of the eye = 59 diopters (for distant vision)
  • Cornea contributes ~2/3 (~40 diopters) - because the air-cornea refractive index difference is the greatest
  • Lens contributes only 20 diopters in relaxed state - but is variable (it provides accommodation)
  • In the "reduced eye" model: a single refractive surface 17 mm in front of the retina with 59 diopters total power

Image Formation

  • The image formed on the retina is inverted and reversed
  • The brain is trained to perceive this as upright (due to learning/experience)

MECHANISM OF ACCOMMODATION

  • In children, the lens can increase from 20 diopters to 34 diopters = 14 diopters of accommodation
  • This is achieved by the ciliary muscle - when it contracts, the zonular fibers relax, the lens rounds up due to its own elastic recoil, increasing its curvature and power
  • With age, the lens loses elasticity → presbyopia (by ~45-50 years)

Near Response Triad (when looking at near objects):

  1. Accommodation - lens rounds up (ciliary muscle contracts via CN III)
  2. Convergence - both eyes turn inward (medial recti)
  3. Miosis - pupils constrict (reduces spherical aberration, increases depth of focus)

ERRORS OF REFRACTION

Refractive ErrorDefectCorrective Lens
EmmetropiaNormal eye; distant objects focused on retinaNone needed
Myopia (nearsightedness)Eyeball too long or lens too convex; image focused in front of retinaConcave (diverging) lens
Hypermetropia (farsightedness)Eyeball too short or lens too flat; image focused behind retinaConvex (converging) lens
AstigmatismUnequal curvature of cornea in different planesCylindrical lens
PresbyopiaLoss of accommodation due to lens stiffening with ageConvex reading glasses

FLUID SYSTEM OF THE EYE - INTRAOCULAR FLUID

Two Compartments:

  • Aqueous humor - lies in front of the lens (anterior and posterior chambers); freely flowing
  • Vitreous humor - between lens and retina; gelatinous; held by proteoglycan fibers; little flow

Aqueous Humor Formation and Drainage

StepDetail
Formed byCiliary processes (epithelium of ciliary body) - active secretion
Rate~2-3 μL/min
Flow pathPosterior chamber → pupil → anterior chamber → trabecular meshwork → Canal of Schlemm → venous system
Normal IOP15 mmHg (range: 12-20 mmHg)
MeasurementTonometry
Guyton Key Point: The pressure in the eye is regulated by the resistance to outflow of aqueous humor at the trabecular meshwork. If resistance increases, IOP rises.
Glaucoma results from obstruction at the trabecular meshwork or filtration angle, elevating IOP and progressively damaging the optic nerve.

PART II: THE RETINA - STRUCTURE AND FUNCTION

The Retina Is Composed of 10 Layers (Guyton Fig. 51.1):

Guyton's diagram of retinal layers showing rods, cones, bipolar, horizontal, amacrine, and ganglion cells with vertical and lateral pathways
(from outermost to innermost)
LayerContents
1. Pigmented layer (RPE)Absorbs scattered light; recycles retinal; phagocytoses shed rod discs
2. Photoreceptor layerOuter segments of rods and cones
3. Outer limiting membrane
4. Outer nuclear layerNuclei (cell bodies) of rods and cones
5. Outer plexiform layerPhotoreceptor axon-bipolar cell synapses; horizontal cell connections
6. Inner nuclear layerBipolar cells, horizontal cells, amacrine cells
7. Inner plexiform layerBipolar cell-ganglion cell synapses; amacrine cell connections
8. Ganglion cell layerGanglion cells - sole output neurons of retina
9. Stratum opticum (nerve fiber layer)Axons of ganglion cells forming optic nerve
10. Inner limiting membraneInnermost - where light first enters from vitreous
Critical point (Guyton): Light travels from the INSIDE of the eye, passing through ganglion → bipolar → photoreceptors. This decreases acuity slightly due to nonhomogeneous tissue. In the fovea, inner layers are displaced to the side, allowing direct light access to cones - hence maximum acuity at the fovea.

Fovea Centralis

  • Minute area (~1 mm²) at the center of the retina
  • Central fovea = only 0.3 mm diameter
  • Contains only cones (no rods)
  • Cones here are long, slender, and closely packed
  • The neural layers are displaced to the side (allowing unimpeded light access)
  • Site of maximum visual acuity - has several hundred times as much cortical representation as peripheral retina

Retinal Neural Pathways

Vertical pathway (signal conduction):
Photoreceptors (rods/cones) → Bipolar cells → Ganglion cells → Optic nerve
Lateral pathway (signal modulation):
Horizontal cells (outer plexiform layer) - photoreceptor to photoreceptor lateral inhibition Amacrine cells (inner plexiform layer) - ganglion cell to ganglion cell modulation
Convergence of rods: In the periphery, ~100 rods converge onto a single ganglion cell → increases sensitivity but decreases acuity. Cones in fovea: Near 1:1 ratio (one cone per ganglion cell) → maximum acuity, minimum sensitivity.

PHOTOCHEMISTRY OF VISION

Rhodopsin (Visual Purple) - Rods

FeatureDetail
CompositionRetinal (11-cis form) + Scotopsin (protein)
LocationOuter segment discs of rods; ~40% concentration
PrecursorVitamin A → 11-cis retinal
Peak absorption~505 nm (blue-green light)

The Rhodopsin-Retinal Visual Cycle (Guyton Fig. 51.5):

When light hits rhodopsin:
  1. 11-cis retinal → instantly converts to all-trans retinal (physical straightening of molecule)
  2. all-trans retinal no longer fits scotopsin → begins to split
  3. Rapid sequential decomposition: Bathorhodopsin → Lumirhodopsin → Metarhodopsin I → Metarhodopsin II (activates transducin)
  4. Eventually: all-trans retinal separates from scotopsin
Regeneration (dark):
  • All-trans retinal → reduced to all-trans retinol (vitamin A) by retinol dehydrogenase
  • Vitamin A transported to RPE → isomerized back to 11-cis retinal
  • 11-cis retinal returns to rods and recombines with scotopsin → rhodopsin regenerated
  • Vitamin A deficiency interrupts this cycle → night blindness (nyctalopia)

Cone Pigments (Color Vision)

  • Cones contain iodopsin (retinal + photopsin - slightly different protein from scotopsin)
  • Three types of cones with different opsins:
Cone TypeOpsinPeak Wavelength
Blue-sensitive (S)Blue photopsin~430 nm
Green-sensitive (M)Green photopsin~530 nm
Red-sensitive (L)Red photopsin~560-570 nm

IONIC MECHANISM OF PHOTOTRANSDUCTION (Guyton Signalling Cascade)

In DARKNESS:

  • High cGMP levels in outer segment
  • cGMP-gated cation channels (Na⁺ and Ca²⁺) are OPEN
  • Steady inward Na⁺ current = "dark current"
  • Photoreceptor membrane potential = -40 mV (relatively depolarized)
  • Continuous glutamate release at synaptic terminal

In LIGHT:

StepEvent
1Light → 11-cis retinal → all-trans retinal
2Rhodopsin activates transducin (Gt protein)
3Transducin activates phosphodiesterase (PDE)
4PDE hydrolyses cGMP → 5'-GMP
5cGMP falls → cGMP-gated channels CLOSE
6Photoreceptor hyperpolarizes (-40 mV → -70 mV)
7Glutamate release decreases
8Signal passed to bipolar cells → ganglion cells → brain
Exam key: Photoreceptors HYPERPOLARIZE in response to light (opposite of most sensory receptors). Only ganglion cells fire true propagated action potentials. All other retinal neurons use graded potentials.

LIGHT AND DARK ADAPTATION

Dark Adaptation Curve (Guyton Fig. 51.9):

Dark adaptation curve showing cone adaptation (first 10 min) followed by rod adaptation (up to 40+ min) with 25,000-fold increase in sensitivity
  • After bright light, entering darkness: sensitivity is very low initially
  • After 1 minute: sensitivity increases 10-fold
  • After 20 minutes: sensitivity increases ~6,000-fold
  • After 40 minutes: sensitivity increases ~25,000-fold
The curve has two segments (inflection at ~7-10 min):
  • Early phase (first 7-10 min) = Cone adaptation - cones adapt 4x faster than rods but don't achieve as great a change
  • Late phase (10-40 min) = Rod adaptation - slow but achieves massive sensitivity increase
Additional mechanism: Pupil dilates in darkness (mydriasis) - allows more light in.

Light Adaptation:

  • Bright light bleaches photopigments → sensitivity falls
  • Excess retinal converted to vitamin A
  • Time: minutes

PART III: VISUAL PATHWAYS (Guyton Fig. 52.1)

Principal visual pathways from both eyes through optic chiasm, lateral geniculate body, optic radiation to visual cortex

Pathway in Order:

Retina (ganglion cells)
     ↓
Optic nerve (CN II)
     ↓
Optic chiasm - nasal fibres CROSS; temporal fibres STAY ipsilateral
     ↓
Optic tract
     ↓
Dorsal Lateral Geniculate Nucleus (LGN) of thalamus
     ↓
Optic radiation (geniculocalcarine tract)
     ↓
Primary Visual Cortex (V1) - calcarine fissure, medial occipital lobe

Lateral Geniculate Nucleus (LGN) - 6 Layers:

LayersCell TypeInputFunction
1, 2Magnocellular (M)Large retinal ganglion cellsMotion, depth, coarse form
3, 4, 5, 6Parvocellular (P)Small retinal ganglion cellsColor, fine detail, high acuity
  • Layers 2, 3, 5 → ipsilateral retina (temporal fibers)
  • Layers 1, 4, 6 → contralateral retina (nasal fibers - crossed at chiasm)
  • The two eyes are kept separate in LGN (not yet merged)

Other Visual Fiber Projections (Guyton):

  1. Suprachiasmatic nucleus (hypothalamus) - circadian rhythm control
  2. Pretectal nuclei (midbrain) - pupillary light reflex
  3. Superior colliculus - rapid eye movements (saccades) toward visual stimuli
  4. Ventral LGN and basal areas - behavioral functions

Primary Visual Cortex (V1):

  • Located in the calcarine fissure (striate cortex / Brodmann area 17)
  • Macular representation is disproportionately large (several hundred times more cortical area per mm² retina than periphery)
  • Upper retina → superior calcarine cortex; lower retina → inferior calcarine cortex
  • Receives geniculocalcarine fibers mainly in layer IV of cortex

Visual Association Areas:

  • V2 (Brodmann 18) - receives all signals from V1; detailed processing
  • V3, V4, V5 (MT) and beyond - progressive dissection of visual information
  • Dorsal stream (parietal) - "WHERE" pathway - spatial location, motion
  • Ventral stream (temporal) - "WHAT" pathway - color, fine detail, object recognition

VISUAL FIELD DEFECTS

Site of LesionDefectExample/Cause
One optic nerveMonocular blindness (same eye)Optic neuritis, trauma
Optic chiasm - centralBitemporal hemianopiaPituitary adenoma
Optic chiasm - lateralMonocular nasal hemianopiaCarotid aneurysm
One optic tractContralateral homonymous hemianopiaStroke
Upper optic radiation (parietal)Contralateral lower quadrantanopia
Lower optic radiation - Meyer's loop (temporal)Contralateral upper quadrantanopia ("pie in the sky")Temporal lobe lesion
Visual cortex (occipital)Contralateral homonymous hemianopia with macular sparingPCA stroke
Macular sparing occurs because the macula has dual blood supply (PCA + MCA) and a large cortical representation.

EYE MOVEMENTS (Guyton - Exam Favourite)

TypeMechanismPurpose
SaccadesRapid voluntary jumps; 2-3/sec during readingRapidly move fovea to new target
Smooth pursuitFollows moving objects; requires cortical computationKeep moving object on fovea
VergenceConvergence/divergenceBinocular fixation on near/far objects
Vestibulo-ocular reflex (VOR)Head movement → opposite eye movementStabilize image during head motion
  • Superior colliculus - turns eyes and head toward a sudden visual disturbance (in peripheral field)
  • Brain suppresses visual image during saccades (saccadic suppression) - so person is unaware of rapid eye jumps

DEPTH PERCEPTION

Three mechanisms (Guyton):
  1. Moving parallax - nearby objects move more across retina than distant ones when head moves; works with one eye
  2. Stereopsis (binocular parallax) - image disparity between two retinas gives depth sensation; most effective at <50-200 feet
  3. Other cues - size, overlap, perspective, shadows

QUICK REVISION - HIGH YIELD POINTS (Guyton)

FactValue
Total refractive power of eye59 diopters
Corneal contribution~40 diopters (~2/3)
Lens contribution (relaxed)20 diopters (1/3)
Maximum accommodation (children)14 diopters
Aqueous humor production2-3 μL/min
Normal IOP12-20 mmHg (avg 15 mmHg)
Dark adaptation time~40 minutes (full rod adaptation)
Sensitivity increase in dark adaptation~25,000-fold
Rods~120 million; peripheral; scotopic
Cones~6 million; foveal; photopic + color
Rod photopigmentRhodopsin = 11-cis retinal + scotopsin
Cone photopigmentIodopsin = retinal + photopsin
Visual cortex locationCalcarine fissure, Brodmann area 17
LGN layers6 layers; M-cells (1,2); P-cells (3-6)

Note: AK Jain is not present in the library. The content above is entirely from Guyton & Hall Medical Physiology (13th Ed), which covers all the same eye physiology topics and is the primary recommended textbook for MBBS physiology exams. Both Guyton and AK Jain follow the same conceptual framework for the eye.

Create a study guide PDF with diagrams and summary tables

Reading File
Running Command

ls /home/daytona/workspace/ 2>/dev/null && mkdir -p /home/daytona/workspace/eye-study-guide

Writing File

~/eye-study-guide/create_eye_pdf.py

#!/usr/bin/env python3
"""
Eye Study Guide PDF Generator
For MBBS Physiology - Based on Guyton & Hall
"""

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

# ─── Colour palette ────────────────────────────────────────────────────────────
DARK_BLUE   = colors.HexColor('#1a3a5c')
MED_BLUE    = colors.HexColor('#2563a8')
LIGHT_BLUE  = colors.HexColor('#dbeafe')
ACCENT_TEAL = colors.HexColor('#0d9488')
LIGHT_TEAL  = colors.HexColor('#ccfbf1')
GOLD        = colors.HexColor('#b45309')
LIGHT_GOLD  = colors.HexColor('#fef3c7')
RED         = colors.HexColor('#dc2626')
LIGHT_RED   = colors.HexColor('#fee2e2')
GREEN       = colors.HexColor('#15803d')
LIGHT_GREEN = colors.HexColor('#dcfce7')
PURPLE      = colors.HexColor('#7e22ce')
LIGHT_PURPLE= colors.HexColor('#f3e8ff')
GRAY        = colors.HexColor('#6b7280')
LIGHT_GRAY  = colors.HexColor('#f3f4f6')
WHITE       = colors.white
BLACK       = colors.black

# ─── Page setup ────────────────────────────────────────────────────────────────
PAGE_W, PAGE_H = A4
MARGIN = 1.8*cm
DOC_W  = PAGE_W - 2*MARGIN

OUTPUT = '/home/daytona/workspace/eye-study-guide/Eye_Study_Guide_MBBS.pdf'

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

def make_style(name, parent='Normal', **kw):
    s = ParagraphStyle(name, parent=styles[parent], **kw)
    styles.add(s)
    return s

TITLE_STYLE   = make_style('MyTitle',   fontSize=28, textColor=WHITE,
                            alignment=TA_CENTER, spaceAfter=4, fontName='Helvetica-Bold')
SUBTITLE_STYLE= make_style('MySubtitle',fontSize=13, textColor=LIGHT_BLUE,
                            alignment=TA_CENTER, spaceAfter=2, fontName='Helvetica')
H1_STYLE      = make_style('MyH1',      fontSize=15, textColor=WHITE,
                            alignment=TA_LEFT,   spaceBefore=6, spaceAfter=4,
                            fontName='Helvetica-Bold', leftIndent=0)
H2_STYLE      = make_style('MyH2',      fontSize=12, textColor=DARK_BLUE,
                            spaceBefore=10, spaceAfter=4,
                            fontName='Helvetica-Bold', leftIndent=0)
H3_STYLE      = make_style('MyH3',      fontSize=10.5, textColor=ACCENT_TEAL,
                            spaceBefore=6, spaceAfter=2,
                            fontName='Helvetica-Bold')
BODY_STYLE    = make_style('MyBody',    fontSize=9.2, textColor=BLACK,
                            spaceBefore=2, spaceAfter=2,
                            fontName='Helvetica', leading=13)
BULLET_STYLE  = make_style('MyBullet',  fontSize=9.2, textColor=BLACK,
                            spaceBefore=1, spaceAfter=1,
                            fontName='Helvetica', leftIndent=14, leading=13)
KEY_STYLE     = make_style('MyKey',     fontSize=9.2, textColor=RED,
                            fontName='Helvetica-Bold', spaceBefore=2, spaceAfter=2)
CAPTION_STYLE = make_style('MyCaption', fontSize=8, textColor=GRAY,
                            alignment=TA_CENTER, fontName='Helvetica-Oblique')
TH_STYLE      = ParagraphStyle('TH', fontSize=9, textColor=WHITE,
                                fontName='Helvetica-Bold', alignment=TA_CENTER, leading=12)
TD_STYLE      = ParagraphStyle('TD', fontSize=8.5, textColor=BLACK,
                                fontName='Helvetica', leading=11, alignment=TA_LEFT)
TD_C_STYLE    = ParagraphStyle('TDC', fontSize=8.5, textColor=BLACK,
                                fontName='Helvetica', leading=11, alignment=TA_CENTER)
TD_BOLD       = ParagraphStyle('TDB', fontSize=8.5, textColor=DARK_BLUE,
                                fontName='Helvetica-Bold', leading=11)

# ─── Helper: coloured section header ───────────────────────────────────────────
class SectionHeader(Flowable):
    def __init__(self, text, bg=DARK_BLUE, width=None, height=1.0*cm):
        super().__init__()
        self.text   = text
        self.bg     = bg
        self.width  = width or DOC_W
        self.height = height
    def wrap(self, aw, ah):
        return self.width, self.height
    def draw(self):
        c = self.canv
        c.setFillColor(self.bg)
        c.roundRect(0, 0, self.width, self.height, 5, fill=1, stroke=0)
        c.setFillColor(WHITE)
        c.setFont('Helvetica-Bold', 13)
        c.drawString(10, self.height/2 - 5, self.text)

class SubHeader(Flowable):
    def __init__(self, text, bg=MED_BLUE, width=None):
        super().__init__()
        self.text  = text
        self.bg    = bg
        self.width = width or DOC_W
    def wrap(self, aw, ah):
        return self.width, 0.75*cm
    def draw(self):
        c = self.canv
        c.setFillColor(self.bg)
        c.roundRect(0, 0, self.width, 0.75*cm, 4, fill=1, stroke=0)
        c.setFillColor(WHITE)
        c.setFont('Helvetica-Bold', 11)
        c.drawString(8, 0.75*cm/2 - 4, self.text)

class KeyBox(Flowable):
    """A coloured callout box."""
    def __init__(self, text, bg=LIGHT_GOLD, border=GOLD, width=None):
        super().__init__()
        self.text   = text
        self.bg     = bg
        self.border = border
        self.width  = width or DOC_W
        self._height= None
    def wrap(self, aw, ah):
        from reportlab.platypus import Paragraph
        p = Paragraph('★ ' + self.text, ParagraphStyle('kbp', fontSize=9,
                      fontName='Helvetica-Bold', textColor=GOLD, leading=13))
        _, h = p.wrap(self.width - 20, ah)
        self._height = h + 12
        return self.width, self._height
    def draw(self):
        c = self.canv
        c.setFillColor(self.bg)
        c.setStrokeColor(self.border)
        c.setLineWidth(1.2)
        c.roundRect(0, 0, self.width, self._height, 5, fill=1, stroke=1)
        c.setFillColor(GOLD)
        c.setFont('Helvetica-Bold', 9)
        margin = 10
        c.drawString(margin, self._height/2 - 5, '★  ' + self.text)

# ─── Helper: build a styled table ──────────────────────────────────────────────
def make_table(headers, rows, col_widths=None, header_bg=DARK_BLUE,
               alt_bg=LIGHT_BLUE, stripe_bg=WHITE):
    th_row = [Paragraph(h, TH_STYLE) for h in headers]
    data   = [th_row]
    for i, row in enumerate(rows):
        bg   = alt_bg if i % 2 == 0 else stripe_bg
        cells= []
        for cell in row:
            if isinstance(cell, str) and cell.startswith('**'):
                cells.append(Paragraph(cell.strip('*'), TD_BOLD))
            else:
                cells.append(Paragraph(str(cell), TD_STYLE))
        data.append(cells)

    if col_widths is None:
        n  = len(headers)
        col_widths = [DOC_W / n] * n

    t = Table(data, colWidths=col_widths, repeatRows=1)

    # base style
    ts = TableStyle([
        ('BACKGROUND',  (0, 0), (-1,  0),  header_bg),
        ('TEXTCOLOR',   (0, 0), (-1,  0),  WHITE),
        ('FONTNAME',    (0, 0), (-1,  0),  'Helvetica-Bold'),
        ('FONTSIZE',    (0, 0), (-1,  0),  9),
        ('ALIGN',       (0, 0), (-1,  0),  'CENTER'),
        ('VALIGN',      (0, 0), (-1, -1),  'MIDDLE'),
        ('ROWBACKGROUNDS', (0, 1), (-1, -1), [alt_bg, stripe_bg]),
        ('GRID',        (0, 0), (-1, -1),  0.5, colors.HexColor('#94a3b8')),
        ('TOPPADDING',  (0, 0), (-1, -1),  4),
        ('BOTTOMPADDING',(0,0), (-1, -1),  4),
        ('LEFTPADDING', (0, 0), (-1, -1),  5),
        ('RIGHTPADDING',(0, 0), (-1, -1),  5),
        ('ROWBACKGROUNDS', (0, 1), (-1, -1), [alt_bg, stripe_bg]),
    ])
    t.setStyle(ts)
    return t

# ─── SVG-style diagrams using ReportLab graphics ───────────────────────────────

def draw_eye_cross_section(width=DOC_W, height=220):
    """Schematic cross-section of the eyeball."""
    d = Drawing(width, height)
    cx, cy, rx, ry = width/2, height/2, width*0.30, height*0.44

    # Sclera (outer ring)
    d.add(Ellipse(cx, cy, rx+14, ry+14, fillColor=colors.HexColor('#e5e7eb'), strokeColor=DARK_BLUE, strokeWidth=2))
    # Choroid
    d.add(Ellipse(cx, cy, rx+6,  ry+6,  fillColor=colors.HexColor('#f97316'), strokeColor=colors.HexColor('#c2410c'), strokeWidth=1))
    # Retina
    d.add(Ellipse(cx, cy, rx,    ry,    fillColor=colors.HexColor('#fef9c3'), strokeColor=colors.HexColor('#ca8a04'), strokeWidth=1))

    # Vitreous humor
    d.add(Ellipse(cx, cy, rx-18, ry-18, fillColor=colors.HexColor('#eff6ff'), strokeColor=colors.HexColor('#93c5fd'), strokeWidth=1))

    # Cornea (anterior transparent bulge) - left side
    cornea_pts = [cx-rx-14, cy+30, cx-rx-28, cy, cx-rx-14, cy-30]
    d.add(Polygon(cornea_pts, fillColor=colors.HexColor('#bfdbfe'),
                  strokeColor=MED_BLUE, strokeWidth=1.5))

    # Iris
    d.add(Ellipse(cx-rx+10, cy, 8, 26, fillColor=colors.HexColor('#7c3aed'), strokeColor=DARK_BLUE, strokeWidth=1))
    # Pupil
    d.add(Ellipse(cx-rx+10, cy, 3, 12, fillColor=BLACK))

    # Lens
    pts = [cx-rx+20, cy+20, cx-rx+38, cy, cx-rx+20, cy-20]
    d.add(Polygon(pts, fillColor=colors.HexColor('#d1fae5'),
                  strokeColor=ACCENT_TEAL, strokeWidth=1.5))

    # Optic nerve (right side)
    d.add(Rect(cx+rx+14, cy-8, 30, 16, fillColor=colors.HexColor('#fde68a'), strokeColor=GOLD, strokeWidth=1))

    # Fovea dot
    d.add(Circle(cx+rx-20, cy, 5, fillColor=RED, strokeColor=RED))

    # Labels
    label_data = [
        (cx-rx-24, cy+50,  'Cornea',       MED_BLUE),
        (cx-rx+10, cy-38,  'Iris',         PURPLE),
        (cx-rx+28, cy-32,  'Lens',         ACCENT_TEAL),
        (cx, cy-ry-18,     'Sclera',       DARK_BLUE),
        (cx+20, cy-ry-8,   'Choroid',      colors.HexColor('#c2410c')),
        (cx+20, cy+ry+4,   'Retina',       colors.HexColor('#ca8a04')),
        (cx,    cy+14,     'Vitreous',     colors.HexColor('#1d4ed8')),
        (cx+rx+14, cy+22,  'Optic nerve',  GOLD),
        (cx+rx-18, cy+14,  'Fovea',        RED),
    ]
    for x, y, label, col in label_data:
        d.add(String(x, y, label, fontSize=7.5, fillColor=col,
                     fontName='Helvetica-Bold'))

    # Title
    d.add(String(width/2-80, height-12, 'FIG 1  Cross-Section of the Human Eye',
                 fontSize=9, fillColor=DARK_BLUE, fontName='Helvetica-Bold'))
    return d


def draw_retinal_layers(width=DOC_W, height=210):
    """Diagram of 10 retinal layers."""
    d = Drawing(width, height)
    layer_h = 16
    start_y = height - 30
    start_x = 80

    layers = [
        ('Inner limiting membrane',    colors.HexColor('#e0f2fe')),
        ('Nerve fibre layer',          colors.HexColor('#bae6fd')),
        ('Ganglion cell layer',        colors.HexColor('#7dd3fc')),
        ('Inner plexiform layer',      colors.HexColor('#38bdf8')),
        ('Inner nuclear layer',        colors.HexColor('#0ea5e9')),
        ('Outer plexiform layer',      colors.HexColor('#0284c7')),
        ('Outer nuclear layer',        colors.HexColor('#0369a1')),
        ('Outer limiting membrane',    colors.HexColor('#075985')),
        ('Photoreceptor layer (Rods & Cones)', colors.HexColor('#1e3a5f')),
        ('Retinal Pigment Epithelium (RPE)',   colors.HexColor('#1e1b4b')),
    ]

    for i, (name, col) in enumerate(layers):
        y = start_y - i * layer_h
        bar_w = width - start_x - 20
        # bar
        d.add(Rect(start_x, y, bar_w, layer_h-1, fillColor=col, strokeColor=WHITE, strokeWidth=0.5))
        # text colour
        tc = WHITE if i >= 5 else DARK_BLUE
        d.add(String(start_x + 5, y + 4, name, fontSize=7.5, fillColor=tc, fontName='Helvetica'))
        # number
        d.add(String(start_x - 18, y + 4, str(i+1) + '.', fontSize=7.5,
                     fillColor=DARK_BLUE, fontName='Helvetica-Bold'))

    # Arrow: LIGHT direction
    ax = start_x - 60
    d.add(Line(ax, start_y+layer_h, ax, start_y - (len(layers)-1)*layer_h,
               strokeColor=RED, strokeWidth=2))
    # arrowhead
    d.add(Polygon([ax-5, start_y-(len(layers)-1)*layer_h+8,
                   ax+5, start_y-(len(layers)-1)*layer_h+8,
                   ax,   start_y-(len(layers)-1)*layer_h],
                  fillColor=RED, strokeColor=RED))
    d.add(String(ax-22, start_y+layer_h+4, 'LIGHT', fontSize=7,
                 fillColor=RED, fontName='Helvetica-Bold'))

    d.add(String(20, height-14, 'FIG 2  Ten Layers of the Retina (Inside → Outside)',
                 fontSize=9, fillColor=DARK_BLUE, fontName='Helvetica-Bold'))
    return d


def draw_phototransduction(width=DOC_W, height=185):
    """Phototransduction cascade flowchart."""
    d = Drawing(width, height)
    steps = [
        ('LIGHT hits Rhodopsin',         DARK_BLUE),
        ('11-cis retinal → all-trans retinal', MED_BLUE),
        ('Activates TRANSDUCIN (Gt)',     ACCENT_TEAL),
        ('Activates PHOSPHODIESTERASE', ACCENT_TEAL),
        ('cGMP → 5\'-GMP  (cGMP falls)', colors.HexColor('#0369a1')),
        ('cGMP-gated channels CLOSE',    colors.HexColor('#c2410c')),
        ('Photoreceptor HYPERPOLARIZES', RED),
        ('↓ Glutamate release → Signal to brain', GREEN),
    ]
    bw, bh, gap = width*0.55, 16, 6
    sx = (width - bw) / 2
    sy = height - 20

    for i, (text, col) in enumerate(steps):
        y = sy - i*(bh + gap)
        d.add(Rect(sx, y, bw, bh, fillColor=col, strokeColor=WHITE, strokeWidth=0.5, rx=3, ry=3))
        d.add(String(sx+6, y+4, text, fontSize=7.8, fillColor=WHITE, fontName='Helvetica-Bold'))
        if i < len(steps)-1:
            mid = sx + bw/2
            d.add(Line(mid, y, mid, y-gap, strokeColor=GRAY, strokeWidth=1.5))
            d.add(Polygon([mid-4, y-gap+5, mid+4, y-gap+5, mid, y-gap],
                          fillColor=GRAY, strokeColor=GRAY))

    # Dark current box on left
    dc_x, dc_y = 5, sy - 3*(bh+gap) - 10
    d.add(Rect(dc_x, dc_y, 85, 50, fillColor=LIGHT_GOLD, strokeColor=GOLD, rx=3, ry=3))
    d.add(String(dc_x+5, dc_y+35, 'DARK CURRENT', fontSize=7.5, fillColor=GOLD, fontName='Helvetica-Bold'))
    d.add(String(dc_x+5, dc_y+25, 'cGMP high →', fontSize=7, fillColor=BLACK))
    d.add(String(dc_x+5, dc_y+15, 'channels OPEN', fontSize=7, fillColor=BLACK))
    d.add(String(dc_x+5, dc_y+5,  'Vm = -40 mV', fontSize=7, fillColor=BLACK))

    d.add(String(10, height-12, 'FIG 3  Phototransduction Cascade',
                 fontSize=9, fillColor=DARK_BLUE, fontName='Helvetica-Bold'))
    return d


def draw_visual_pathway(width=DOC_W, height=230):
    """Schematic of the visual pathway."""
    d = Drawing(width, height)

    # Two eyes at top
    for ex, label in [(width*0.28, 'LEFT EYE'), (width*0.72, 'RIGHT EYE')]:
        d.add(Ellipse(ex, height-22, 30, 15, fillColor=LIGHT_BLUE, strokeColor=DARK_BLUE, strokeWidth=1.5))
        d.add(Circle(ex, height-22, 7, fillColor=DARK_BLUE))
        d.add(String(ex-22, height-10, label, fontSize=7, fillColor=DARK_BLUE, fontName='Helvetica-Bold'))

    # Optic nerves down to chiasm
    chiasm_y = height - 70
    for ex in [width*0.28, width*0.72]:
        d.add(Line(ex, height-37, width/2, chiasm_y, strokeColor=MED_BLUE, strokeWidth=2))

    # Chiasm box
    d.add(Rect(width/2-40, chiasm_y-12, 80, 24, fillColor=LIGHT_PURPLE,
               strokeColor=PURPLE, rx=4, ry=4))
    d.add(String(width/2-28, chiasm_y-4, 'Optic Chiasm', fontSize=8, fillColor=PURPLE, fontName='Helvetica-Bold'))

    # Optic tracts
    lgn_y = chiasm_y - 60
    left_lgn_x  = width*0.22
    right_lgn_x = width*0.78
    d.add(Line(width/2, chiasm_y-12, left_lgn_x,  lgn_y+20, strokeColor=MED_BLUE, strokeWidth=2))
    d.add(Line(width/2, chiasm_y-12, right_lgn_x, lgn_y+20, strokeColor=MED_BLUE, strokeWidth=2))

    # Cross-over lines
    d.add(Line(width*0.28, height-37, right_lgn_x, lgn_y+20, strokeColor=colors.HexColor('#93c5fd'), strokeWidth=1.5, strokeDashArray=[3,2]))
    d.add(Line(width*0.72, height-37, left_lgn_x,  lgn_y+20, strokeColor=colors.HexColor('#93c5fd'), strokeWidth=1.5, strokeDashArray=[3,2]))

    # LGN boxes
    for lx, label in [(left_lgn_x, 'Left LGN'), (right_lgn_x, 'Right LGN')]:
        d.add(Rect(lx-28, lgn_y, 56, 20, fillColor=LIGHT_TEAL, strokeColor=ACCENT_TEAL, rx=3, ry=3))
        d.add(String(lx-22, lgn_y+5, label, fontSize=7.5, fillColor=ACCENT_TEAL, fontName='Helvetica-Bold'))

    # Optic radiation to cortex
    ctx_y = lgn_y - 55
    for lx in [left_lgn_x, right_lgn_x]:
        d.add(Line(lx, lgn_y, lx, ctx_y+20, strokeColor=MED_BLUE, strokeWidth=2))

    # Visual cortex boxes
    for lx, label in [(left_lgn_x, 'Left V1 Cortex'), (right_lgn_x, 'Right V1 Cortex')]:
        d.add(Rect(lx-38, ctx_y, 76, 20, fillColor=LIGHT_RED, strokeColor=RED, rx=3, ry=3))
        d.add(String(lx-32, ctx_y+5, label, fontSize=7.5, fillColor=RED, fontName='Helvetica-Bold'))

    # Annotation: nasal fibres cross
    d.add(String(width/2+6, chiasm_y+10, '← Nasal fibres cross', fontSize=6.5, fillColor=PURPLE))

    # Calcarine note
    d.add(String(left_lgn_x-38, ctx_y-12, 'Calcarine fissure (Brodmann 17)',
                 fontSize=6.5, fillColor=GRAY))

    d.add(String(10, height-12, 'FIG 4  Visual Pathway (Both Eyes)',
                 fontSize=9, fillColor=DARK_BLUE, fontName='Helvetica-Bold'))
    return d


def draw_dark_adaptation(width=DOC_W*0.7, height=165):
    """Simplified dark adaptation curve."""
    d = Drawing(width, height)
    ox, oy = 45, 20
    pw, ph  = width - 55, height - 40

    # Axes
    d.add(Line(ox, oy, ox, oy+ph, strokeColor=DARK_BLUE, strokeWidth=1.5))
    d.add(Line(ox, oy, ox+pw, oy, strokeColor=DARK_BLUE, strokeWidth=1.5))

    # Axis labels
    d.add(String(ox+pw/2-30, 2, 'Minutes in Dark', fontSize=8, fillColor=DARK_BLUE))
    for i, v in enumerate([0, 10, 20, 30, 40]):
        x = ox + i*(pw/4)
        d.add(String(x-4, oy-11, str(v), fontSize=7, fillColor=DARK_BLUE))
        d.add(Line(x, oy-3, x, oy+3, strokeColor=DARK_BLUE, strokeWidth=1))
    d.add(String(2, oy+ph/2-10, 'Retinal', fontSize=7, fillColor=DARK_BLUE))
    d.add(String(2, oy+ph/2-20, 'Sensitivity', fontSize=7, fillColor=DARK_BLUE))

    # Cone curve (first 10 min, small rise)
    cone_pts = []
    for t in range(0, 11):
        x = ox + t*(pw/40)
        y = oy + min(t*3.5, 35)
        cone_pts.extend([x, y])

    # Rod curve (continues and rises steeply)
    rod_pts = []
    for t in range(0, 41):
        x = ox + t*(pw/40)
        # log-like growth
        import math
        y = oy + min(math.log(t+1)*22, ph-5)
        rod_pts.extend([x, y])

    # Draw as polyline
    from reportlab.graphics.shapes import PolyLine
    d.add(PolyLine(cone_pts, strokeColor=ACCENT_TEAL, strokeWidth=2.5))
    d.add(PolyLine(rod_pts,  strokeColor=RED,         strokeWidth=2.5))

    # Labels
    d.add(String(ox+pw*0.12, oy+38, 'Cone', fontSize=7.5, fillColor=ACCENT_TEAL, fontName='Helvetica-Bold'))
    d.add(String(ox+pw*0.12, oy+28, 'adaptation', fontSize=7, fillColor=ACCENT_TEAL))
    d.add(String(ox+pw*0.6,  oy+ph*0.7, 'Rod adaptation', fontSize=7.5, fillColor=RED, fontName='Helvetica-Bold'))
    d.add(String(ox+pw*0.6,  oy+ph*0.6, '(slow, large)', fontSize=7, fillColor=RED))

    # Key values
    d.add(String(ox+pw*0.85, oy+15, '25,000×', fontSize=7.5, fillColor=RED, fontName='Helvetica-Bold'))

    d.add(String(0, height-12, 'FIG 5  Dark Adaptation Curve',
                 fontSize=9, fillColor=DARK_BLUE, fontName='Helvetica-Bold'))
    return d


def draw_visual_field_defects(width=DOC_W, height=190):
    """Visual field defect diagram."""
    d = Drawing(width, height)

    sites = [
        ('Optic nerve',      'Monocular blindness',            width*0.15, height-30),
        ('Optic chiasm',     'Bitemporal hemianopia',           width*0.38, height-30),
        ('Optic tract',      'Contralateral homonymous\nhemianopia', width*0.62, height-30),
        ('Visual cortex',    'Homonymous hemianopia\n+ macular sparing', width*0.85, height-30),
    ]
    for site, effect, x, y in sites:
        d.add(Rect(x-40, y-12, 80, 24, fillColor=LIGHT_BLUE, strokeColor=MED_BLUE, rx=4, ry=4))
        d.add(String(x-36, y-2, site, fontSize=7.5, fillColor=DARK_BLUE, fontName='Helvetica-Bold'))
        d.add(String(x-36, y-40, effect, fontSize=7, fillColor=RED))

    # Dividing arrows
    for i in range(len(sites)-1):
        x1 = sites[i][2]+42
        x2 = sites[i+1][2]-42
        y0 = height-18
        d.add(Line(x1, y0, x2, y0, strokeColor=GRAY, strokeWidth=1, strokeDashArray=[4,2]))
        d.add(Polygon([x2-4, y0+3, x2-4, y0-3, x2, y0], fillColor=GRAY, strokeColor=GRAY))

    d.add(String(10, height-12, 'FIG 6  Visual Field Defects by Site of Lesion',
                 fontSize=9, fillColor=DARK_BLUE, fontName='Helvetica-Bold'))
    return d


# ─── Cover page background ─────────────────────────────────────────────────────
class CoverBackground(Flowable):
    def __init__(self, w, h):
        super().__init__()
        self._w, self._h = w, h
    def wrap(self, aw, ah):
        return self._w, self._h
    def draw(self):
        c = self.canv
        c.setFillColor(DARK_BLUE)
        c.rect(0, 0, self._w, self._h, fill=1, stroke=0)
        # decorative circles
        import math
        for r, alpha in [(200, 0.08), (130, 0.1), (70, 0.12)]:
            c.setFillColorRGB(0.5, 0.8, 1, alpha=alpha)
            c.circle(self._w*0.85, self._h*0.85, r, fill=1, stroke=0)
        c.setFillColor(DARK_BLUE)  # reset

# ─── Build document ────────────────────────────────────────────────────────────
def build():
    doc = SimpleDocTemplate(
        OUTPUT, pagesize=A4,
        leftMargin=MARGIN, rightMargin=MARGIN,
        topMargin=MARGIN, bottomMargin=MARGIN,
        title='Eye Study Guide - MBBS Physiology',
        author='Orris AI | Based on Guyton & Hall'
    )

    story = []
    SP = Spacer(1, 0.25*cm)
    SP2 = Spacer(1, 0.5*cm)

    # ── COVER ──────────────────────────────────────────────────────────────────
    story.append(CoverBackground(PAGE_W - 2*MARGIN, PAGE_H - 2*MARGIN))
    # Adjust: cover is a background flowable; put text over it using a table
    # Instead, render cover as a full-page block
    # Use a table with coloured background for cover
    cover_data = [[
        Paragraph('<b>THE EYE</b>', ParagraphStyle('CT', fontSize=36,
                  textColor=WHITE, alignment=TA_CENTER, fontName='Helvetica-Bold',
                  spaceAfter=8)),
    ], [
        Paragraph('Complete Study Guide for MBBS Physiology', ParagraphStyle('CS',
                  fontSize=15, textColor=LIGHT_BLUE, alignment=TA_CENTER,
                  fontName='Helvetica')),
    ], [
        Paragraph('Anatomy · Optics · Retina · Phototransduction<br/>'
                  'Visual Pathway · Disorders', ParagraphStyle('CS2',
                  fontSize=11, textColor=colors.HexColor('#93c5fd'),
                  alignment=TA_CENTER, fontName='Helvetica', leading=16)),
    ], [
        Spacer(1, 0.5*cm),
    ], [
        Paragraph('Source: Guyton &amp; Hall Textbook of Medical Physiology, 13th Ed',
                  ParagraphStyle('CS3', fontSize=9, textColor=colors.HexColor('#94a3b8'),
                  alignment=TA_CENTER, fontName='Helvetica-Oblique')),
    ]]
    cover_table = Table(cover_data, colWidths=[DOC_W])
    cover_table.setStyle(TableStyle([
        ('BACKGROUND', (0,0), (-1,-1), DARK_BLUE),
        ('ALIGN', (0,0), (-1,-1), 'CENTER'),
        ('VALIGN', (0,0), (-1,-1), 'MIDDLE'),
        ('TOPPADDING', (0,0), (-1,-1), 18),
        ('BOTTOMPADDING', (0,0), (-1,-1), 18),
        ('ROUNDEDCORNERS', [8]),
    ]))
    story.append(Spacer(1, 3*cm))
    story.append(cover_table)
    story.append(PageBreak())

    # ── SECTION 1: ANATOMY ─────────────────────────────────────────────────────
    story.append(SectionHeader('1.  ANATOMY OF THE EYE'))
    story.append(SP2)

    # Eye diagram
    story.append(draw_eye_cross_section())
    story.append(Paragraph('Figure 1 - Schematic cross-section of the human eyeball showing major structures.',
                            CAPTION_STYLE))
    story.append(SP2)

    story.append(SubHeader('1.1  Three Coats (Layers) of the Eyeball', bg=MED_BLUE))
    story.append(SP)

    layers_table = make_table(
        ['Layer', 'Components', 'Key Function'],
        [
            ['Outer fibrous coat', 'Sclera (posterior 5/6) + Cornea (anterior 1/6)', 'Protection; light entry via cornea'],
            ['Middle vascular coat\n(Uvea)', 'Choroid + Ciliary body + Iris', 'Nutrition; accommodation; pupil control'],
            ['Inner neural coat', 'Retina (posterior 2/3)', 'Phototransduction; image processing'],
        ],
        col_widths=[DOC_W*0.28, DOC_W*0.40, DOC_W*0.32],
    )
    story.append(layers_table)
    story.append(SP2)

    story.append(SubHeader('1.2  Key Structures', bg=MED_BLUE))
    story.append(SP)

    structs = [
        ['Cornea', 'Transparent; avascular; nourished by aqueous humor; provides ~40 D (2/3 of total refractive power)'],
        ['Sclera', 'White opaque outer coat; continuous with cornea anteriorly'],
        ['Iris', 'Pigmented; sphincter pupillae (miosis - PS, CN III); dilator pupillae (mydriasis - sympathetic). Pupil size changes cause 16× change in light entering'],
        ['Ciliary body', 'Secretes aqueous humor; controls lens curvature via zonular fibers during accommodation'],
        ['Lens', 'Transparent biconvex; 20 D in relaxed state; increases to 34 D (max accommodation = 14 D in children)'],
        ['Choroid', 'Vascular; nourishes outer retina and RPE'],
        ['Retina', 'Neural layer; rods + cones + interneurons; inverted (light must pass through inner layers first)'],
        ['Fovea', '0.3 mm; only cones; inner layers displaced laterally → maximum acuity'],
        ['Optic disc', 'Blind spot; no photoreceptors; where optic nerve exits'],
        ['Aqueous humor', 'Clear, protein-free; produced by ciliary body at 2-3 µL/min; nourishes cornea & iris; drains via Canal of Schlemm'],
        ['Vitreous humor', 'Gelatinous; between lens and retina; proteoglycan network; maintains eye shape'],
    ]
    struct_table = make_table(
        ['Structure', 'Key Features'],
        structs,
        col_widths=[DOC_W*0.23, DOC_W*0.77],
        alt_bg=LIGHT_BLUE, stripe_bg=WHITE
    )
    story.append(struct_table)
    story.append(SP)
    story.append(KeyBox('Pupil diameter variation causes up to 16-FOLD change in the amount of light reaching the retina. (Guyton)', LIGHT_GOLD, GOLD))
    story.append(SP2)

    # Aqueous humor flow
    story.append(SubHeader('1.3  Aqueous Humor Flow & IOP', bg=MED_BLUE))
    story.append(SP)
    aq_flow = make_table(
        ['Step', 'Location', 'Detail'],
        [
            ['Produced', 'Ciliary body (epithelium)', 'Active secretion; 2-3 µL/min'],
            ['Flows into', 'Posterior chamber', 'Behind iris, in front of lens'],
            ['Passes through', 'Pupil', 'Anterior chamber (in front of iris)'],
            ['Drains via', 'Trabecular meshwork', '→ Canal of Schlemm → venous system'],
            ['Normal IOP', '12-20 mmHg (avg 15)', 'Measured by tonometry'],
        ],
        col_widths=[DOC_W*0.22, DOC_W*0.32, DOC_W*0.46],
        header_bg=ACCENT_TEAL, alt_bg=LIGHT_TEAL, stripe_bg=WHITE
    )
    story.append(aq_flow)
    story.append(PageBreak())

    # ── SECTION 2: RETINA ──────────────────────────────────────────────────────
    story.append(SectionHeader('2.  THE RETINA'))
    story.append(SP2)

    story.append(draw_retinal_layers())
    story.append(Paragraph('Figure 2 - Ten layers of the retina. Light enters from inside (bottom) and must pass through inner layers before reaching photoreceptors.',
                            CAPTION_STYLE))
    story.append(SP2)

    story.append(SubHeader('2.1  Ten Layers of the Retina (Inside → Outside)', bg=MED_BLUE))
    story.append(SP)
    ret_layers = make_table(
        ['#', 'Layer', 'Contents / Note'],
        [
            ['1', 'Inner limiting membrane', 'Innermost; first layer light enters'],
            ['2', 'Nerve fibre layer (Stratum opticum)', 'Axons of ganglion cells → optic nerve'],
            ['3', 'Ganglion cell layer', 'Only output neurons of retina; fire true APs'],
            ['4', 'Inner plexiform layer', 'Bipolar ↔ Ganglion cell synapses; amacrine cells'],
            ['5', 'Inner nuclear layer', 'Bipolar cells, horizontal cells, amacrine cells'],
            ['6', 'Outer plexiform layer', 'Photoreceptor ↔ Bipolar cell synapses; horizontal cells'],
            ['7', 'Outer nuclear layer', 'Cell bodies (nuclei) of rods and cones'],
            ['8', 'Outer limiting membrane', '—'],
            ['9', 'Photoreceptor layer', 'Outer segments of rods and cones (face choroid)'],
            ['10', 'Retinal Pigment Epithelium (RPE)', 'Absorbs light; recycles retinal; phagocytoses shed discs'],
        ],
        col_widths=[DOC_W*0.06, DOC_W*0.37, DOC_W*0.57],
        header_bg=DARK_BLUE, alt_bg=LIGHT_BLUE, stripe_bg=WHITE
    )
    story.append(ret_layers)
    story.append(SP2)

    story.append(SubHeader('2.2  Rods vs Cones - Comparison Table', bg=MED_BLUE))
    story.append(SP)
    rvc = make_table(
        ['Feature', 'RODS', 'CONES'],
        [
            ['Number',           '~120 million',             '~6 million'],
            ['Location',         'Peripheral retina',        'Macula / fovea'],
            ['Vision type',      'Scotopic (dim/night)',     'Photopic (bright/day)'],
            ['Colour vision',    'No (achromatic)',          'Yes (3 types)'],
            ['Acuity',           'Low',                      'High (highest in fovea)'],
            ['Photopigment',     'Rhodopsin\n(retinal + Scotopsin)', 'Iodopsin\n(retinal + Photopsin)'],
            ['Convergence',      'High (~100 rods:1 ganglion)', '~1:1 in fovea'],
            ['Sensitivity',      'Very high',                'Lower'],
            ['Adaptation speed', 'Slow (30-40 min)',         'Fast (7-10 min)'],
            ['Protein defect\n(deficiency)', 'Night blindness\n(Vitamin A deficit)', 'Colour blindness\n(X-linked, opsins)'],
        ],
        col_widths=[DOC_W*0.28, DOC_W*0.36, DOC_W*0.36],
        header_bg=DARK_BLUE, alt_bg=LIGHT_BLUE, stripe_bg=WHITE
    )
    story.append(rvc)
    story.append(PageBreak())

    # ── SECTION 3: OPTICS ──────────────────────────────────────────────────────
    story.append(SectionHeader('3.  OPTICS OF THE EYE'))
    story.append(SP2)

    story.append(SubHeader('3.1  Refractive Power', bg=MED_BLUE))
    story.append(SP)
    ref_data = make_table(
        ['Component', 'Refractive Index', 'Power (Diopters)', 'Notes'],
        [
            ['Cornea (anterior surface)', '1.38', '~40 D', 'Contributes 2/3 of total power; most powerful'],
            ['Aqueous humor', '1.33', '—', 'Separates cornea from lens'],
            ['Crystalline lens', '1.40 (avg)', '20 D (relaxed)\nup to 34 D (max accommodation)', 'Variable - provides accommodation'],
            ['Vitreous humor', '1.34', '—', 'Fills posterior segment'],
            ['TOTAL (relaxed eye)', '—', '59 DIOPTERS', '"Reduced eye" - single surface 17 mm from retina'],
        ],
        col_widths=[DOC_W*0.28, DOC_W*0.18, DOC_W*0.26, DOC_W*0.28],
        header_bg=ACCENT_TEAL, alt_bg=LIGHT_TEAL, stripe_bg=WHITE
    )
    story.append(ref_data)
    story.append(SP)
    story.append(KeyBox('Total refractive power = 59 D. Cornea provides 2/3 (~40 D). Lens provides 1/3 (20 D) but is the variable component (accommodation).', LIGHT_TEAL, ACCENT_TEAL))
    story.append(SP2)

    story.append(SubHeader('3.2  Refractive Errors', bg=MED_BLUE))
    story.append(SP)
    ref_err = make_table(
        ['Error', 'Defect', 'Cause', 'Correction'],
        [
            ['Emmetropia', 'Normal - image on retina', 'Normal eye', 'None'],
            ['Myopia\n(Nearsightedness)', 'Image in FRONT of retina', 'Eyeball too long or lens too convex', 'CONCAVE\n(diverging) lens'],
            ['Hypermetropia\n(Farsightedness)', 'Image BEHIND retina', 'Eyeball too short or lens too flat', 'CONVEX\n(converging) lens'],
            ['Astigmatism', 'Different focal lengths in different planes', 'Irregular corneal curvature', 'Cylindrical lens'],
            ['Presbyopia', 'Reduced accommodation', 'Lens loses elasticity with age (~45+)', 'Convex reading glasses'],
        ],
        col_widths=[DOC_W*0.22, DOC_W*0.26, DOC_W*0.30, DOC_W*0.22],
        header_bg=DARK_BLUE, alt_bg=LIGHT_BLUE, stripe_bg=WHITE
    )
    story.append(ref_err)
    story.append(SP2)

    story.append(SubHeader('3.3  Accommodation', bg=MED_BLUE))
    story.append(SP)
    acc_bullets = [
        '• For near objects: Ciliary muscle CONTRACTS → Zonular fibers RELAX → Lens becomes more CONVEX → ↑ refractive power',
        '• Maximum accommodation in children = 14 diopters (lens power increases from 20 D to 34 D)',
        '• Presbyopia = lens stiffens with age → accommodation lost (~45 years)',
        '• NEAR RESPONSE TRIAD: (1) Accommodation (2) Convergence of eyes (3) Miosis (pupil constriction)',
        '• All three components mediated by CN III (oculomotor) via parasympathetic pathway',
    ]
    for b in acc_bullets:
        story.append(Paragraph(b, BULLET_STYLE))
    story.append(PageBreak())

    # ── SECTION 4: PHOTOTRANSDUCTION ──────────────────────────────────────────
    story.append(SectionHeader('4.  PHOTOTRANSDUCTION'))
    story.append(SP2)

    story.append(draw_phototransduction())
    story.append(Paragraph('Figure 3 - Phototransduction cascade. Light triggers rhodopsin activation leading to photoreceptor hyperpolarization.',
                            CAPTION_STYLE))
    story.append(SP2)

    story.append(SubHeader('4.1  Rhodopsin Visual Cycle', bg=MED_BLUE))
    story.append(SP)
    rhod = make_table(
        ['Component', 'Detail'],
        [
            ['Rhodopsin composition', '11-cis RETINAL + SCOTOPSIN (protein)'],
            ['Location', 'Outer segment discs of RODS; ~40% concentration'],
            ['Light effect', '11-cis retinal → ALL-TRANS retinal → Opsin separation'],
            ['Intermediate products', 'Bathorhodopsin → Lumirhodopsin → Metarhodopsin I → Metarhodopsin II (activates Transducin)'],
            ['Regeneration', 'All-trans retinal → Vitamin A (retinol) → 11-cis retinal (in RPE) → Rhodopsin'],
            ['Vitamin A deficiency', 'Cannot regenerate rhodopsin → NIGHT BLINDNESS (Nyctalopia)'],
            ['Cone pigment', 'IODOPSIN = retinal + PHOTOPSIN (3 variants: red/green/blue)'],
        ],
        col_widths=[DOC_W*0.30, DOC_W*0.70],
        header_bg=DARK_BLUE, alt_bg=LIGHT_BLUE, stripe_bg=WHITE
    )
    story.append(rhod)
    story.append(SP2)

    story.append(SubHeader('4.2  Ionic Basis (Dark Current)', bg=MED_BLUE))
    story.append(SP)
    ionic = make_table(
        ['State', 'cGMP level', 'Na⁺ channels', 'Membrane potential', 'Glutamate release'],
        [
            ['DARK', 'HIGH', 'OPEN (dark current)', '-40 mV (depolarized)', 'Continuous (high)'],
            ['LIGHT', 'LOW (PDE degrades it)', 'CLOSED', '-70 mV (hyperpolarized)', 'Decreased'],
        ],
        col_widths=[DOC_W*0.12, DOC_W*0.17, DOC_W*0.23, DOC_W*0.26, DOC_W*0.22],
        header_bg=MED_BLUE, alt_bg=LIGHT_BLUE, stripe_bg=WHITE
    )
    story.append(ionic)
    story.append(SP)
    story.append(KeyBox('KEY EXAM POINT: Photoreceptors HYPERPOLARIZE (not depolarize) in response to light. Only ganglion cells generate true propagated action potentials.', LIGHT_RED, RED))
    story.append(SP2)

    story.append(SubHeader('4.3  Colour Vision', bg=MED_BLUE))
    story.append(SP)
    colour = make_table(
        ['Cone Type', 'Opsin', 'Peak Wavelength', 'Perceived Colour'],
        [
            ['S-cones (Short)',  'Blue photopsin',  '~430 nm', 'BLUE'],
            ['M-cones (Medium)', 'Green photopsin', '~530 nm', 'GREEN'],
            ['L-cones (Long)',   'Red photopsin',   '~560-570 nm', 'RED'],
        ],
        col_widths=[DOC_W*0.22, DOC_W*0.26, DOC_W*0.26, DOC_W*0.26],
        header_bg=DARK_BLUE, alt_bg=LIGHT_BLUE, stripe_bg=WHITE
    )
    story.append(colour)
    story.append(SP)
    story.append(Paragraph('• Trichromatic theory (Young-Helmholtz): Colour perception from ratio of activation of 3 cone types', BULLET_STYLE))
    story.append(Paragraph('• Colour blindness: X-linked recessive; usually red-green deficiency; more common in males', BULLET_STYLE))
    story.append(PageBreak())

    # ── SECTION 5: LIGHT & DARK ADAPTATION ────────────────────────────────────
    story.append(SectionHeader('5.  LIGHT & DARK ADAPTATION'))
    story.append(SP2)

    story.append(draw_dark_adaptation())
    story.append(Paragraph('Figure 5 - Dark adaptation curve. Note the inflection at ~7-10 min (cones adapt first, rods adapt more slowly but achieve far greater sensitivity).',
                            CAPTION_STYLE))
    story.append(SP2)

    adapt_data = make_table(
        ['Parameter', 'Cones', 'Rods'],
        [
            ['Adaptation speed', 'Fast (~7-10 min)', 'Slow (30-40 min)'],
            ['Max sensitivity gain', 'Moderate', '~25,000-fold'],
            ['Photopigment involved', 'Iodopsin', 'Rhodopsin'],
            ['Mechanism', 'Photopsin regeneration', 'Rhodopsin regeneration + Vitamin A recycling'],
            ['Scotopic / Photopic', 'Photopic only', 'Scotopic (takes over after cones plateau)'],
        ],
        col_widths=[DOC_W*0.30, DOC_W*0.35, DOC_W*0.35],
        header_bg=DARK_BLUE, alt_bg=LIGHT_BLUE, stripe_bg=WHITE
    )
    story.append(adapt_data)
    story.append(SP)
    story.append(KeyBox('After 1 min in dark: 10× sensitivity. After 20 min: ~6,000×. After 40 min: ~25,000×. Two phases in curve = cones (early) + rods (late).', LIGHT_GOLD, GOLD))
    story.append(PageBreak())

    # ── SECTION 6: VISUAL PATHWAY ─────────────────────────────────────────────
    story.append(SectionHeader('6.  VISUAL PATHWAY & CENTRAL PROCESSING'))
    story.append(SP2)

    story.append(draw_visual_pathway())
    story.append(Paragraph('Figure 4 - Visual pathway. Nasal fibres cross at the optic chiasm; temporal fibres remain ipsilateral.',
                            CAPTION_STYLE))
    story.append(SP2)

    vp_steps = make_table(
        ['Station', 'Structure', 'Key Points'],
        [
            ['1st', 'Retinal ganglion cells', 'Only neurons that generate APs; axons form optic nerve (CN II)'],
            ['2nd', 'Optic chiasm', 'Nasal fibres CROSS to opposite side; temporal fibres stay ipsilateral'],
            ['3rd', 'Optic tract', 'Contains fibres from BOTH eyes representing same visual hemifield'],
            ['4th', 'Dorsal LGN (thalamus)', '6 layers: M-cells (1,2) = motion/depth; P-cells (3-6) = colour/detail. Two eyes kept separate.'],
            ['5th', 'Optic radiation', 'Geniculocalcarine tract. Upper radiation (parietal); Lower = Meyers loop (temporal)'],
            ['6th', 'Primary visual cortex (V1)', 'Calcarine fissure, medial occipital lobe, Brodmann area 17. Fovea has disproportionately large representation.'],
        ],
        col_widths=[DOC_W*0.08, DOC_W*0.28, DOC_W*0.64],
        header_bg=DARK_BLUE, alt_bg=LIGHT_BLUE, stripe_bg=WHITE
    )
    story.append(vp_steps)
    story.append(SP2)

    story.append(SubHeader('6.1  LGN Layers', bg=MED_BLUE))
    story.append(SP)
    lgn = make_table(
        ['Layers', 'Cell Type', 'Input from', 'Function'],
        [
            ['1, 2', 'Magnocellular (M)', 'Large ganglion cells (Y-cells)', 'Motion, depth, coarse form, low contrast'],
            ['3, 4, 5, 6', 'Parvocellular (P)', 'Small ganglion cells (X-cells)', 'Fine detail, colour, high acuity, texture'],
        ],
        col_widths=[DOC_W*0.15, DOC_W*0.25, DOC_W*0.30, DOC_W*0.30],
        header_bg=ACCENT_TEAL, alt_bg=LIGHT_TEAL, stripe_bg=WHITE
    )
    story.append(lgn)
    story.append(SP2)

    story.append(SubHeader('6.2  Other Visual Projections (Guyton)', bg=MED_BLUE))
    story.append(SP)
    other_proj = [
        '• Suprachiasmatic nucleus (hypothalamus) → Circadian rhythm control (day/night synchronisation)',
        '• Pretectal nuclei (midbrain) → PUPILLARY LIGHT REFLEX; reflex focusing movements',
        '• Superior colliculus → Rapid eye movements (saccades) toward sudden peripheral visual stimuli',
        '• Ventral LGN/basal areas → Behavioural responses to visual stimuli',
    ]
    for b in other_proj:
        story.append(Paragraph(b, BULLET_STYLE))
    story.append(PageBreak())

    # ── SECTION 7: VISUAL FIELD DEFECTS ───────────────────────────────────────
    story.append(SectionHeader('7.  VISUAL FIELD DEFECTS'))
    story.append(SP2)

    story.append(draw_visual_field_defects())
    story.append(Paragraph('Figure 6 - Visual field defects at different sites of lesion along the visual pathway.',
                            CAPTION_STYLE))
    story.append(SP2)

    vfd = make_table(
        ['Site of Lesion', 'Visual Field Defect', 'Key Cause'],
        [
            ['One optic nerve', 'Monocular blindness (same eye)', 'Optic neuritis, trauma, MS'],
            ['Optic chiasm (central/midline)', 'BITEMPORAL HEMIANOPIA\n(tunnel vision)', 'Pituitary adenoma (commonest cause)'],
            ['Optic chiasm (lateral)', 'Monocular nasal hemianopia', 'Carotid artery aneurysm'],
            ['Optic tract', 'Contralateral HOMONYMOUS\nHEMIANOPIA', 'Stroke, tumour'],
            ['Upper optic radiation (parietal lobe)', 'Contralateral lower quadrantanopia', 'Parietal lobe infarct'],
            ['Lower optic radiation -\nMeyer\'s loop (temporal lobe)', '"PIE IN THE SKY"\nContralateral upper quadrantanopia', 'Temporal lobe lesion / TLE surgery'],
            ['Visual cortex (occipital)', 'Contralateral homonymous hemianopia\nwith MACULAR SPARING', 'Posterior cerebral artery infarct'],
        ],
        col_widths=[DOC_W*0.33, DOC_W*0.38, DOC_W*0.29],
        header_bg=RED, alt_bg=LIGHT_RED, stripe_bg=WHITE
    )
    story.append(vfd)
    story.append(SP)
    story.append(KeyBox('Macular sparing in cortical lesions: Dual blood supply (PCA + MCA) to the occipital pole. Also, the macula has large cortical representation over a wide area.', LIGHT_GOLD, GOLD))
    story.append(PageBreak())

    # ── SECTION 8: EYE MOVEMENTS ──────────────────────────────────────────────
    story.append(SectionHeader('8.  EYE MOVEMENTS'))
    story.append(SP2)

    em = make_table(
        ['Type', 'Description', 'Control Centre', 'Purpose'],
        [
            ['Saccades', 'Rapid jumps, 2-3/sec; brain suppresses vision during saccade', 'Frontal eye fields + Superior colliculus', 'Move fovea rapidly to new target'],
            ['Smooth pursuit', 'Follows moving object; velocity-matched; requires cortical computation', 'Parieto-occipital cortex + Cerebellum', 'Keep moving object on fovea'],
            ['Vergence\n(Convergence/Divergence)', 'Both eyes move toward/away from each other', 'CN III (medial rectus)', 'Binocular fixation on near/far objects'],
            ['Vestibulo-ocular\nreflex (VOR)', 'Head moves → eyes move opposite direction', 'Vestibular nuclei + CN III/IV/VI', 'Stabilize image during head movement'],
            ['Optokinetic\nnystagmus', 'Slow tracking + fast saccadic reset', 'Brainstem', 'Track large moving field'],
        ],
        col_widths=[DOC_W*0.20, DOC_W*0.30, DOC_W*0.26, DOC_W*0.24],
        header_bg=DARK_BLUE, alt_bg=LIGHT_BLUE, stripe_bg=WHITE
    )
    story.append(em)
    story.append(PageBreak())

    # ── SECTION 9: PUPILLARY LIGHT REFLEX ────────────────────────────────────
    story.append(SectionHeader('9.  PUPILLARY LIGHT REFLEX'))
    story.append(SP2)

    plr = make_table(
        ['Component', 'Pathway'],
        [
            ['AFFERENT (sensory)', 'Retina → Optic nerve (CN II) → Pretectal nucleus (midbrain) - BILATERAL projection'],
            ['EFFERENT (motor)', 'Edinger-Westphal nucleus → CN III → Ciliary ganglion → Constrictor pupillae'],
            ['Direct reflex', 'Illuminated eye constricts'],
            ['Consensual reflex', 'Opposite (non-illuminated) eye also constricts (because pretectal nucleus projects bilaterally)'],
            ['RAPD\n(Marcus Gunn pupil)', 'Relative Afferent Pupillary Defect - swinging light test: affected eye DILATES instead of constricting. Indicates AFFERENT pathway defect (optic nerve or retinal disease)'],
            ['Argyll Robertson pupil', 'Accommodates but does NOT react to light. Lesion in pretectal area. Classically syphilis.'],
        ],
        col_widths=[DOC_W*0.28, DOC_W*0.72],
        header_bg=DARK_BLUE, alt_bg=LIGHT_BLUE, stripe_bg=WHITE
    )
    story.append(plr)
    story.append(PageBreak())

    # ── SECTION 10: QUICK REVISION TABLE ─────────────────────────────────────
    story.append(SectionHeader('10.  QUICK REVISION - HIGH-YIELD FACTS'))
    story.append(SP2)

    quick_rev = make_table(
        ['Key Fact', 'Value / Answer'],
        [
            ['Total refractive power of eye (relaxed)',  '59 DIOPTERS'],
            ['Corneal contribution',                      '~40 D (2/3 of total)'],
            ['Lens contribution (relaxed)',               '20 D'],
            ['Maximum accommodation',                    '14 D (children); lens goes 20→34 D'],
            ['Aqueous humor production rate',            '2-3 µL/min (by ciliary body)'],
            ['Normal intraocular pressure (IOP)',        '12-20 mmHg (average 15 mmHg)'],
            ['Number of rods',                           '~120 million'],
            ['Number of cones',                          '~6 million'],
            ['Fovea diameter',                           '0.3 mm; only cones'],
            ['Dark adaptation - full sensitivity',       '~40 minutes (rods)'],
            ['Dark adaptation - fold increase',         '~25,000-fold'],
            ['Rod photopigment',                        'Rhodopsin = 11-cis retinal + SCOTOPSIN'],
            ['Cone photopigment',                       'Iodopsin = retinal + PHOTOPSIN (3 types)'],
            ['Retinal cell that fires APs',             'Ganglion cells ONLY'],
            ['Response of photoreceptors to light',     'HYPERPOLARIZATION (dark current closes)'],
            ['Site of Rhodopsin regeneration',          'Retinal Pigment Epithelium (RPE)'],
            ['Vitamin A deficiency → eye',              'Night blindness (Nyctalopia)'],
            ['Visual cortex location',                  'Calcarine fissure, Brodmann area 17'],
            ['LGN layers (magnocellular)',               'Layers 1 & 2 (motion, depth)'],
            ['LGN layers (parvocellular)',               'Layers 3,4,5,6 (colour, fine detail)'],
            ['Bitemporal hemianopia → cause',           'Pituitary adenoma (optic chiasm)'],
            ['Macular sparing → lesion at',             'Visual cortex (PCA infarct)'],
            ['Meyer\'s loop defect',                    '"Pie in sky" - upper quadrantanopia'],
            ['Near response triad',                     'Accommodation + Convergence + Miosis'],
            ['Glaucoma - first-line drug',              'Prostaglandin analogue (e.g. Latanoprost)'],
            ['Glaucoma type - most common',             'Primary Open-Angle Glaucoma (POAG)'],
            ['Argyll Robertson pupil - cause',          'Syphilis (neurosyphilis) - pretectal lesion'],
        ],
        col_widths=[DOC_W*0.52, DOC_W*0.48],
        header_bg=GOLD, alt_bg=LIGHT_GOLD, stripe_bg=WHITE
    )
    story.append(quick_rev)
    story.append(SP2)

    # ── FINAL BOX ─────────────────────────────────────────────────────────────
    final = Table([[
        Paragraph('This study guide is based on <b>Guyton &amp; Hall Textbook of Medical Physiology, 13th Edition</b>.<br/>'
                  'Compiled by <b>Orris AI</b> for MBBS Physiology exam preparation.',
                  ParagraphStyle('ft', fontSize=8, textColor=WHITE, alignment=TA_CENTER,
                                 fontName='Helvetica', leading=12))
    ]], colWidths=[DOC_W])
    final.setStyle(TableStyle([
        ('BACKGROUND', (0,0), (-1,-1), DARK_BLUE),
        ('ALIGN', (0,0), (-1,-1), 'CENTER'),
        ('TOPPADDING', (0,0), (-1,-1), 10),
        ('BOTTOMPADDING', (0,0), (-1,-1), 10),
        ('ROUNDEDCORNERS', [6]),
    ]))
    story.append(final)

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

if __name__ == '__main__':
    build()
Running Command

cd /home/daytona/workspace/eye-study-guide && python3 create_eye_pdf.py 2>&1

Editing File

~/eye-study-guide/create_eye_pdf.py

Successfully replaced 1 instance(s) of the string in '/home/daytona/workspace/eye-study-guide/create_eye_pdf.py'
Running Command

cd /home/daytona/workspace/eye-study-guide && python3 create_eye_pdf.py 2>&1

Running Command

ls -lh /home/daytona/workspace/eye-study-guide/Eye_Study_Guide_MBBS.pdf

Your PDF is ready! Here's the download link:

Eye Study Guide MBBS

PDF Document · PDF


What's inside the PDF (10 sections):
SectionContent
1. AnatomyEye cross-section diagram + 3 coats table + all key structures + aqueous humor flow
2. Retina10-layer diagram + layer-by-layer table + Rods vs Cones comparison table
3. OpticsRefractive indices + refractive errors table + accommodation notes
4. PhototransductionCascade flowchart + Rhodopsin cycle table + dark current table + colour vision
5. Light & Dark AdaptationDark adaptation curve diagram + comparison table with values
6. Visual PathwayPathway schematic + step-by-step table + LGN layers + other projections
7. Visual Field DefectsDefect diagram + full table with lesion sites and causes
8. Eye MovementsSaccades, pursuit, VOR comparison table
9. Pupillary ReflexAfferent/efferent pathway + RAPD + Argyll Robertson table
10. Quick Revision27-row high-yield facts table (numbers, values, exam favourites)
All content sourced from Guyton & Hall Medical Physiology, 13th Ed. with original diagrams drawn in the PDF itself.

Generate a Word document with detailed explanations

Reading File
Running Command

ls /home/daytona/workspace/eye-study-guide/ && ls /home/daytona/skills/docx/scripts/office/ 2>/dev/null | head -20

Running Command

node --version && npm list -g docx 2>/dev/null | head -5

This is a shared conversation. Sign in to Orris to start your own chat.