Anatomy of ear
anatomy of the ear diagram showing external middle and inner ear





| Region | Main Structures | Function |
|---|---|---|
| External ear | Auricle, external acoustic meatus | Sound collection and conduction |
| Middle ear | Tympanic membrane, ossicles, Eustachian tube | Sound transmission/amplification, pressure equalization |
| Internal ear | Cochlea, vestibule, semicircular canals | Hearing (cochlea) and balance (vestibular apparatus) |
Convert in pdf
mkdir -p /tmp/workspace/ear-anatomy/assets /tmp/workspace/ear-anatomy/output && ls -la /tmp/workspace/
cd /tmp/workspace/ear-anatomy/assets && \ curl -s -o auricle.png "https://cdn.orris.care/cdss_images/00a54eb5a4673a333c5346b5d2ed1344301c1f3a390bad198477f6ab68cea6ee.png" && \ curl -s -o innervation.png "https://cdn.orris.care/cdss_images/4716d5951d05ab2d79c04a81049cc2d33f308869da768968d9ae3d5d6711f0a7.png" && \ curl -s -o internal_ear_location.png "https://cdn.orris.care/cdss_images/9cb4f2340095f42dbc54a4ec4b9d4c114a910b2e6c596f6ece0f051fee29bc0a.png" && \ curl -s -o internal_ear_relationships.png "https://cdn.orris.care/cdss_images/d02eba7729c051a05f55c7e94923513e843a7f1eafbfba4a0f9dabc611239c08.png" && \ curl -s -o composite_cross_section.jpg "https://cdn.orris.care/cdss_images/pmc_clinical_VQA_3f20ab24d42d04b85ddbd86255917048fc2db8244feb48c751ad719d02bcc441.jpg" && \ ls -la
~/ear-anatomy/build_pdf.py
from reportlab.lib.pagesizes import A4
from reportlab.lib.units import cm
from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle
from reportlab.lib.enums import TA_CENTER
from reportlab.platypus import (
SimpleDocTemplate, Paragraph, Spacer, Image, Table, TableStyle,
PageBreak, ListFlowable, ListItem, KeepTogether
)
from reportlab.lib import colors
from PIL import Image as PILImage
import os
ASSETS = "/tmp/workspace/ear-anatomy/assets"
OUT = "/tmp/workspace/ear-anatomy/output/Anatomy_of_the_Ear.pdf"
styles = getSampleStyleSheet()
title_style = ParagraphStyle(
"TitleStyle", parent=styles["Title"], fontSize=22, spaceAfter=6, textColor=colors.HexColor("#1a3c6e")
)
subtitle_style = ParagraphStyle(
"Subtitle", parent=styles["Normal"], fontSize=11, alignment=TA_CENTER, textColor=colors.grey, spaceAfter=18
)
h1 = ParagraphStyle(
"H1", parent=styles["Heading1"], fontSize=16, textColor=colors.HexColor("#1a3c6e"),
spaceBefore=14, spaceAfter=8, borderPadding=0
)
h2 = ParagraphStyle(
"H2", parent=styles["Heading2"], fontSize=13, textColor=colors.HexColor("#2f5d8a"),
spaceBefore=10, spaceAfter=6
)
body = ParagraphStyle(
"Body", parent=styles["Normal"], fontSize=10.5, leading=15, spaceAfter=8, alignment=4
)
bullet_style = ParagraphStyle(
"Bullet", parent=body, leftIndent=14, spaceAfter=4
)
caption_style = ParagraphStyle(
"Caption", parent=styles["Normal"], fontSize=9, alignment=TA_CENTER, textColor=colors.grey,
spaceAfter=14, spaceBefore=4, fontName="Helvetica-Oblique"
)
source_style = ParagraphStyle(
"Source", parent=styles["Normal"], fontSize=8.5, textColor=colors.grey, spaceBefore=20
)
def img_flowable(path, max_width=13*cm, max_height=8*cm):
with PILImage.open(path) as im:
w, h = im.size
ratio = w / h
width = max_width
height = width / ratio
if height > max_height:
height = max_height
width = height * ratio
return Image(path, width=width, height=height)
story = []
# Title page header
story.append(Paragraph("Anatomy of the Ear", title_style))
story.append(Paragraph("External, Middle, and Internal Ear Structures & Function", subtitle_style))
# Intro
story.append(Paragraph(
"The ear is divided into three anatomical regions: the <b>external (outer) ear</b>, the "
"<b>middle ear</b>, and the <b>internal (inner) ear</b>. The first two are concerned mainly "
"with conducting sound, while the internal ear houses the organs of hearing and balance.",
body
))
# Composite image
story.append(img_flowable(os.path.join(ASSETS, "composite_cross_section.jpg"), max_width=14*cm, max_height=8*cm))
story.append(Paragraph("Labeled cross-section of outer, middle, and inner ear structures", caption_style))
# 1. External Ear
story.append(Paragraph("1. External Ear", h1))
story.append(Paragraph("Consists of two parts:", body))
ext_items = [
"<b>Auricle (pinna)</b> - the visible projection on the side of the head, made of elastic cartilage covered by skin, shaped to capture sound. Landmarks include the <b>helix</b> (outer rim), <b>antihelix</b>, <b>tragus</b> and <b>antitragus</b>, <b>concha</b> (hollow center), and the <b>lobule</b> (the only part without cartilage support).",
"<b>External acoustic meatus</b> - the canal leading from the concha inward to the tympanic membrane, directing sound waves toward the middle ear.",
]
story.append(ListFlowable([ListItem(Paragraph(t, bullet_style)) for t in ext_items], bulletType="bullet"))
story.append(Paragraph(
"Both intrinsic and extrinsic auricular muscles are present but are largely vestigial in humans; "
"they are innervated by the <b>facial nerve (CN VII)</b>. Sensory supply to the auricle comes from "
"multiple sources: the great auricular and lesser occipital nerves (cervical plexus), the auriculotemporal "
"nerve (CN V3), and branches of CN VII and CN X.",
body
))
story.append(img_flowable(os.path.join(ASSETS, "auricle.png"), max_width=9*cm, max_height=7*cm))
story.append(Paragraph("Fig. Auricle - surface landmarks", caption_style))
story.append(img_flowable(os.path.join(ASSETS, "innervation.png"), max_width=9*cm, max_height=7*cm))
story.append(Paragraph("Fig. Sensory innervation of the auricle", caption_style))
# 2. Middle Ear
story.append(Paragraph("2. Middle Ear (Tympanic Cavity)", h1))
story.append(Paragraph(
"An air-filled space in the petrous temporal bone, situated between the tympanic membrane laterally "
"and the internal ear medially. Key components:", body
))
mid_items = [
"<b>Tympanic membrane</b> - thin, translucent partition that vibrates in response to sound.",
"<b>Auditory ossicles</b> - the <b>malleus</b>, <b>incus</b>, and <b>stapes</b>, forming a lever chain that transmits and amplifies vibrations from the tympanic membrane to the oval window of the internal ear. The stapes footplate sits in the oval window.",
"<b>Associated muscles</b> - <b>tensor tympani</b> (innervated by CN V3) and <b>stapedius</b> (innervated by CN VII), which dampen excessive ossicular movement (acoustic reflex).",
"<b>Pharyngotympanic (Eustachian) tube</b> - connects the middle ear to the nasopharynx, equalizing air pressure across the tympanic membrane.",
"<b>Mastoid antrum and air cells</b> - posterior air-filled extension of the middle ear cavity.",
]
story.append(ListFlowable([ListItem(Paragraph(t, bullet_style)) for t in mid_items], bulletType="bullet"))
story.append(Paragraph(
"The <b>chorda tympani</b> (a branch of CN VII carrying taste fibers) and the tympanic plexus (CN IX) "
"pass through this cavity.", body
))
# 3. Internal Ear
story.append(Paragraph("3. Internal (Inner) Ear", h1))
story.append(Paragraph(
"Located in the petrous part of the temporal bone, medial to the middle ear. It consists of the "
"<b>bony labyrinth</b> (bony cavities filled with perilymph) containing a <b>membranous labyrinth</b> "
"(filled with endolymph):", body
))
inner_items = [
"<b>Bony labyrinth</b>: vestibule, three semicircular canals, and cochlea.",
"<b>Membranous labyrinth</b>: semicircular ducts, cochlear duct, and two sacs - the <b>utricle</b> and <b>saccule</b>.",
]
story.append(ListFlowable([ListItem(Paragraph(t, bullet_style)) for t in inner_items], bulletType="bullet"))
story.append(Paragraph(
"<b>Vestibule</b> - the central chamber, contains the oval window and connects anteriorly to the cochlea, "
"posterosuperiorly to the semicircular canals.", body
))
story.append(Paragraph(
"<b>Semicircular canals</b> (anterior, posterior, lateral) - each forms two-thirds of a circle, oriented "
"at right angles to one another, with a dilated <b>ampulla</b> at one end; they detect rotational "
"(angular) head movements.", body
))
story.append(Paragraph(
"<b>Cochlea</b> - a coiled bony tube (about 2.5 turns) housing the <b>cochlear duct</b> and the "
"<b>organ of Corti</b>, the sensory organ of hearing, which converts fluid vibrations into neural signals.",
body
))
story.append(Paragraph(
"<b>Utricle and saccule</b> - contain maculae that detect linear acceleration and head position (gravity).",
body
))
story.append(Paragraph(
"The <b>vestibulocochlear nerve (CN VIII)</b> enters via the internal acoustic meatus and splits into:",
body
))
cn8_items = [
"<b>Vestibular part</b> - balance information from semicircular ducts, utricle, saccule",
"<b>Cochlear part</b> - hearing information from the cochlear duct",
]
story.append(ListFlowable([ListItem(Paragraph(t, bullet_style)) for t in cn8_items], bulletType="bullet"))
story.append(img_flowable(os.path.join(ASSETS, "internal_ear_location.png"), max_width=9.5*cm, max_height=7.5*cm))
story.append(Paragraph("Fig. Location of the internal ear in the temporal bone", caption_style))
story.append(PageBreak())
story.append(img_flowable(os.path.join(ASSETS, "internal_ear_relationships.png"), max_width=12*cm, max_height=15*cm))
story.append(Paragraph("Fig. Anatomical relationships of internal ear structures", caption_style))
# Functional summary table
story.append(Paragraph("Functional Summary", h1))
table_data = [
["Region", "Main Structures", "Function"],
["External ear", "Auricle, external acoustic meatus", "Sound collection and conduction"],
["Middle ear", "Tympanic membrane, ossicles, Eustachian tube", "Sound transmission/amplification, pressure equalization"],
["Internal ear", "Cochlea, vestibule, semicircular canals", "Hearing (cochlea) and balance (vestibular apparatus)"],
]
tbl = Table(table_data, colWidths=[3.2*cm, 6.3*cm, 6.5*cm])
tbl.setStyle(TableStyle([
("BACKGROUND", (0, 0), (-1, 0), colors.HexColor("#1a3c6e")),
("TEXTCOLOR", (0, 0), (-1, 0), colors.white),
("FONTNAME", (0, 0), (-1, 0), "Helvetica-Bold"),
("FONTSIZE", (0, 0), (-1, -1), 9),
("GRID", (0, 0), (-1, -1), 0.5, colors.grey),
("VALIGN", (0, 0), (-1, -1), "TOP"),
("ROWBACKGROUNDS", (0, 1), (-1, -1), [colors.whitesmoke, colors.white]),
("LEFTPADDING", (0, 0), (-1, -1), 6),
("RIGHTPADDING", (0, 0), (-1, -1), 6),
("TOPPADDING", (0, 0), (-1, -1), 5),
("BOTTOMPADDING", (0, 0), (-1, -1), 5),
]))
story.append(tbl)
story.append(Paragraph(
"Source: Gray's Anatomy for Students (pp. 1093-1106); Cummings Otolaryngology Head and Neck Surgery.",
source_style
))
doc = SimpleDocTemplate(
OUT, pagesize=A4,
leftMargin=2*cm, rightMargin=2*cm, topMargin=2*cm, bottomMargin=2*cm,
title="Anatomy of the Ear"
)
doc.build(story)
print("PDF written to", OUT)
cd /tmp/workspace/ear-anatomy && python3 build_pdf.py
cd /tmp/workspace/ear-anatomy/output && python3 -c " from pypdf import PdfReader r = PdfReader('Anatomy_of_the_Ear.pdf') print('Pages:', len(r.pages)) " && ls -la
Anatomy of the Ear
PDF Document · PDF
Create pdf
Anatomy of the Ear
PDF Document · PDF