hey
i am 2nd yr mbbs student from nimsrc medical college jafferguda and knruhs univercity
no i have only pharma micro and path
i wanna start my path from scratch
| Order | Topic |
|---|---|
| 1 | Cell injury, Death & Adaptation |
| 2 | Inflammation (Acute & Chronic) |
| 3 | Healing & Repair |
| 4 | Hemodynamic disorders (Edema, Thrombosis, Embolism, Infarction) |
| 5 | Immunopathology |
| 6 | Neoplasia |
| 7 | Infectious diseases (basics) |
| 8 | Genetic & Pediatric diseases |
i have my univercity exam in sept 1st week but i also have my pre final exam in july 1st week
| Week | Topics |
|---|---|
| Week 1 (May 26 - Jun 1) | Cell Injury, Death & Adaptation + Inflammation (Acute) |
| Week 2 (Jun 2 - Jun 8) | Inflammation (Chronic), Healing & Repair, Hemodynamic disorders |
| Week 3 (Jun 9 - Jun 15) | Neoplasia, Immunopathology, Genetic diseases |
| Week | Topics |
|---|---|
| Week 4 (Jun 16 - Jun 22) | CVS + Respiratory |
| Week 5 (Jun 23 - Jun 30) | Liver/GIT + Kidney + Blood (basics) |
Pre-final exam around July 1 - you'll have General Path solid + key systemic topics covered.
but i wanna complete my syllabus before prefinaln or atleast my 70-80% syllabus
| Day | Topic |
|---|---|
| Day 1-2 | Cell Injury, Adaptation & Cell Death (Apoptosis/Necrosis) |
| Day 3-4 | Acute Inflammation |
| Day 5 | Chronic Inflammation + Granulomatous inflammation |
| Day 6 | Healing & Repair (wound healing) |
| Day 7-8 | Hemodynamic disorders (Edema, Thrombosis, Embolism, Shock) |
| Day 9-10 | Neoplasia (very important - 2 full days) |
Skip Immunopathology & Genetics for now - low yield, do after pre-final
| Days | System | Why Priority |
|---|---|---|
| Day 11-13 | Liver + GIT | Huge in KNRUHS exams |
| Day 14-15 | Respiratory | Common long questions |
| Day 16-17 | Cardiovascular | IHD, Rheumatic fever - high yield |
| Day 18-19 | Kidney | Glomerulonephritis patterns |
| Day 20-22 | Hematopoietic (Blood + Lymphoma) | Lots of MCQs |
| Day 23-24 | Endocrine (Thyroid + Pancreas/Diabetes) | Very common |
| Day 25-26 | Female Reproductive (Cervix, Breast, Ovary) | High yield |
| Day 27-28 | Infectious diseases | TB, HIV basics |
| Day 29-30 | Nervous system + Skin (quick read) | Low depth needed |
| Day | Task |
|---|---|
| Day 31-32 | Revise General Path (notes only) |
| Day 33-34 | Revise Systemic (topic-wise quick pass) |
| Day 35 | Previous year KNRUHS questions |
can u make pdf of above list u have given me date with topic
mkdir -p /home/daytona/workspace/path-study-plan
~/path-study-plan/generate_pdf.py
from reportlab.lib.pagesizes import A4
from reportlab.lib import colors
from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle
from reportlab.lib.units import cm
from reportlab.platypus import SimpleDocTemplate, Paragraph, Spacer, Table, TableStyle, HRFlowable
from reportlab.lib.enums import TA_CENTER, TA_LEFT
output_path = "/home/daytona/workspace/path-study-plan/Pathology_Study_Plan.pdf"
doc = SimpleDocTemplate(
output_path,
pagesize=A4,
rightMargin=2*cm,
leftMargin=2*cm,
topMargin=2*cm,
bottomMargin=2*cm
)
styles = getSampleStyleSheet()
# Custom styles
title_style = ParagraphStyle(
'Title', parent=styles['Title'],
fontSize=20, textColor=colors.HexColor('#1a237e'),
spaceAfter=6, alignment=TA_CENTER
)
subtitle_style = ParagraphStyle(
'Subtitle', parent=styles['Normal'],
fontSize=11, textColor=colors.HexColor('#37474f'),
spaceAfter=4, alignment=TA_CENTER
)
section_style = ParagraphStyle(
'Section', parent=styles['Heading2'],
fontSize=13, textColor=colors.white,
spaceAfter=4, spaceBefore=12,
backColor=colors.HexColor('#1a237e'),
leftIndent=6, rightIndent=6
)
note_style = ParagraphStyle(
'Note', parent=styles['Normal'],
fontSize=9, textColor=colors.HexColor('#37474f'),
spaceAfter=4, leftIndent=10
)
elements = []
# Title
elements.append(Spacer(1, 0.3*cm))
elements.append(Paragraph("PATHOLOGY STUDY PLAN", title_style))
elements.append(Paragraph("NIMSRC Medical College | KNRUHS University | 2nd Year MBBS", subtitle_style))
elements.append(Paragraph("Pre-Final Target: July 1, 2026 | University Exam: September 1, 2026", subtitle_style))
elements.append(Spacer(1, 0.3*cm))
elements.append(HRFlowable(width="100%", thickness=2, color=colors.HexColor('#1a237e')))
elements.append(Spacer(1, 0.4*cm))
# ---- PHASE 1: General Pathology ----
elements.append(Paragraph(" PHASE 1 - General Pathology (May 26 - June 4)", section_style))
elements.append(Spacer(1, 0.2*cm))
gp_data = [
["Day", "Date", "Topic", "Chapter (Harsh Mohan)"],
["Day 1", "May 26 (Mon)", "Cell Injury & Adaptation", "Ch. 3"],
["Day 2", "May 27 (Tue)", "Cell Death - Necrosis & Apoptosis", "Ch. 3"],
["Day 3", "May 28 (Wed)", "Acute Inflammation", "Ch. 4"],
["Day 4", "May 29 (Thu)", "Acute Inflammation (contd.) + Mediators", "Ch. 4"],
["Day 5", "May 30 (Fri)", "Chronic Inflammation + Granulomatous", "Ch. 5"],
["Day 6", "May 31 (Sat)", "Healing & Repair (Wound Healing)", "Ch. 6"],
["Day 7", "Jun 1 (Sun)", "Hemodynamic Disorders - Edema, Thrombosis", "Ch. 7"],
["Day 8", "Jun 2 (Mon)", "Embolism, Infarction & Shock", "Ch. 7"],
["Day 9", "Jun 3 (Tue)", "Neoplasia - Part 1 (Basics, Nomenclature)", "Ch. 8"],
["Day 10", "Jun 4 (Wed)", "Neoplasia - Part 2 (Carcinogenesis, Spread)", "Ch. 8"],
]
gp_table = Table(gp_data, colWidths=[2.2*cm, 3.2*cm, 7.5*cm, 3.5*cm])
gp_table.setStyle(TableStyle([
('BACKGROUND', (0,0), (-1,0), colors.HexColor('#283593')),
('TEXTCOLOR', (0,0), (-1,0), colors.white),
('FONTNAME', (0,0), (-1,0), 'Helvetica-Bold'),
('FONTSIZE', (0,0), (-1,0), 9),
('FONTSIZE', (0,1), (-1,-1), 8.5),
('ROWBACKGROUNDS', (0,1), (-1,-1), [colors.HexColor('#e8eaf6'), colors.white]),
('GRID', (0,0), (-1,-1), 0.4, colors.HexColor('#9fa8da')),
('ALIGN', (0,0), (-1,-1), 'LEFT'),
('VALIGN', (0,0), (-1,-1), 'MIDDLE'),
('TOPPADDING', (0,0), (-1,-1), 4),
('BOTTOMPADDING', (0,0), (-1,-1), 4),
('LEFTPADDING', (0,0), (-1,-1), 6),
]))
elements.append(gp_table)
elements.append(Spacer(1, 0.2*cm))
elements.append(Paragraph("* Skip Immunopathology & Genetics for now - cover after pre-final (low yield for internals)", note_style))
# ---- PHASE 2: Systemic Pathology ----
elements.append(Spacer(1, 0.3*cm))
elements.append(Paragraph(" PHASE 2 - Systemic Pathology (June 5 - June 24)", section_style))
elements.append(Spacer(1, 0.2*cm))
sp_data = [
["Days", "Dates", "System / Topic", "Why High Priority"],
["Day 11-13", "Jun 5-7", "Liver + GIT (Hepatitis, Cirrhosis, Ca)", "Huge in KNRUHS exams"],
["Day 14-15", "Jun 8-9", "Respiratory (Pneumonia, TB, Ca Lung)", "Common long questions"],
["Day 16-17", "Jun 10-11", "Cardiovascular (IHD, Rheumatic fever, HF)", "IHD very high yield"],
["Day 18-19", "Jun 12-13", "Kidney (Glomerulonephritis patterns)", "Pattern-based Qs"],
["Day 20-22", "Jun 14-16", "Hematopoietic (Anemias, Leukemias, Lymphoma)", "Lots of MCQs"],
["Day 23-24", "Jun 17-18", "Endocrine (Thyroid + Pancreas/Diabetes)", "Very common topic"],
["Day 25-26", "Jun 19-20", "Female Reproductive (Cervix, Breast, Ovary)", "High yield"],
["Day 27-28", "Jun 21-22", "Infectious Diseases (TB, HIV basics)", "Overlap with Micro"],
["Day 29-30", "Jun 23-24", "Nervous System + Skin (quick read)", "Low depth needed"],
]
sp_table = Table(sp_data, colWidths=[2.2*cm, 3.0*cm, 7.0*cm, 4.2*cm])
sp_table.setStyle(TableStyle([
('BACKGROUND', (0,0), (-1,0), colors.HexColor('#283593')),
('TEXTCOLOR', (0,0), (-1,0), colors.white),
('FONTNAME', (0,0), (-1,0), 'Helvetica-Bold'),
('FONTSIZE', (0,0), (-1,0), 9),
('FONTSIZE', (0,1), (-1,-1), 8.5),
('ROWBACKGROUNDS', (0,1), (-1,-1), [colors.HexColor('#e8eaf6'), colors.white]),
('GRID', (0,0), (-1,-1), 0.4, colors.HexColor('#9fa8da')),
('ALIGN', (0,0), (-1,-1), 'LEFT'),
('VALIGN', (0,0), (-1,-1), 'MIDDLE'),
('TOPPADDING', (0,0), (-1,-1), 4),
('BOTTOMPADDING', (0,0), (-1,-1), 4),
('LEFTPADDING', (0,0), (-1,-1), 6),
]))
elements.append(sp_table)
# ---- PHASE 3: Revision ----
elements.append(Spacer(1, 0.3*cm))
elements.append(Paragraph(" PHASE 3 - Pre-Final Revision (June 25 - June 30)", section_style))
elements.append(Spacer(1, 0.2*cm))
rev_data = [
["Day", "Date", "Task"],
["Day 31-32", "Jun 25-26", "Revise General Pathology (short notes only)"],
["Day 33-34", "Jun 27-28", "Revise Systemic Pathology (topic-wise quick pass)"],
["Day 35", "Jun 29-30", "KNRUHS Previous Year Questions + Practical slides"],
]
rev_table = Table(rev_data, colWidths=[2.2*cm, 3.2*cm, 11.0*cm])
rev_table.setStyle(TableStyle([
('BACKGROUND', (0,0), (-1,0), colors.HexColor('#283593')),
('TEXTCOLOR', (0,0), (-1,0), colors.white),
('FONTNAME', (0,0), (-1,0), 'Helvetica-Bold'),
('FONTSIZE', (0,0), (-1,0), 9),
('FONTSIZE', (0,1), (-1,-1), 8.5),
('ROWBACKGROUNDS', (0,1), (-1,-1), [colors.HexColor('#e8eaf6'), colors.white]),
('GRID', (0,0), (-1,-1), 0.4, colors.HexColor('#9fa8da')),
('ALIGN', (0,0), (-1,-1), 'LEFT'),
('VALIGN', (0,0), (-1,-1), 'MIDDLE'),
('TOPPADDING', (0,0), (-1,-1), 4),
('BOTTOMPADDING', (0,0), (-1,-1), 4),
('LEFTPADDING', (0,0), (-1,-1), 6),
]))
elements.append(rev_table)
# ---- After Pre-Final ----
elements.append(Spacer(1, 0.3*cm))
elements.append(Paragraph(" PHASE 4 - After Pre-Final (July 2 - Aug 31) - University Exam Prep", section_style))
elements.append(Spacer(1, 0.2*cm))
post_data = [
["Period", "Dates", "Task"],
["Week 1-5", "Jul 2 - Aug 10", "Complete remaining topics: Immunopathology, Genetics, Pediatric diseases, Male Reproductive, Musculoskeletal"],
["Week 6-7", "Aug 11 - Aug 24", "Full syllabus rapid revision (notes + diagrams)"],
["Week 8", "Aug 25 - Aug 31", "University previous year papers + MCQ practice (Sparsh Gupta / Gobind Rai Garg)"],
]
post_table = Table(post_data, colWidths=[2.2*cm, 3.5*cm, 10.7*cm])
post_table.setStyle(TableStyle([
('BACKGROUND', (0,0), (-1,0), colors.HexColor('#283593')),
('TEXTCOLOR', (0,0), (-1,0), colors.white),
('FONTNAME', (0,0), (-1,0), 'Helvetica-Bold'),
('FONTSIZE', (0,0), (-1,0), 9),
('FONTSIZE', (0,1), (-1,-1), 8.5),
('ROWBACKGROUNDS', (0,1), (-1,-1), [colors.HexColor('#e8eaf6'), colors.white]),
('GRID', (0,0), (-1,-1), 0.4, colors.HexColor('#9fa8da')),
('ALIGN', (0,0), (-1,-1), 'LEFT'),
('VALIGN', (0,0), (-1,-1), 'MIDDLE'),
('TOPPADDING', (0,0), (-1,-1), 4),
('BOTTOMPADDING', (0,0), (-1,-1), 4),
('LEFTPADDING', (0,0), (-1,-1), 6),
('WORDWRAP', (0,0), (-1,-1), True),
]))
elements.append(post_table)
# ---- Tips ----
elements.append(Spacer(1, 0.4*cm))
elements.append(HRFlowable(width="100%", thickness=1, color=colors.HexColor('#9fa8da')))
elements.append(Spacer(1, 0.2*cm))
tips_style = ParagraphStyle('Tips', parent=styles['Normal'], fontSize=9,
textColor=colors.HexColor('#1a237e'), spaceAfter=3, leftIndent=10)
elements.append(Paragraph("<b>Study Tips:</b>", tips_style))
elements.append(Paragraph("• Daily target: 2.5 - 3 hrs of Pathology | Don't read Harsh Mohan cover to cover - use selectively", tips_style))
elements.append(Paragraph("• Make one-page notes per topic as you go | Focus on bold text, tables, and diagrams", tips_style))
elements.append(Paragraph("• For MCQs: Supplement with Sparsh Gupta or Gobind Rai Garg", tips_style))
elements.append(Paragraph("• Draw diagrams for Inflammation, Cell Injury, Coagulation cascade", tips_style))
elements.append(Paragraph("• Coverage goal before pre-final: ~75-80% of total syllabus", tips_style))
elements.append(Spacer(1, 0.3*cm))
elements.append(HRFlowable(width="100%", thickness=1, color=colors.HexColor('#9fa8da')))
elements.append(Paragraph("Generated by Orris AI | For personal academic use only", ParagraphStyle('Footer',
parent=styles['Normal'], fontSize=8, textColor=colors.grey, alignment=TA_CENTER, spaceBefore=6)))
doc.build(elements)
print(f"PDF created: {output_path}")
python /home/daytona/workspace/path-study-plan/generate_pdf.py
Pathology Study Plan
PDF Document · PDF
also provide me sufficient diagram to draw in exam but easy to draw
~/path-study-plan/generate_diagrams_pdf.py
from reportlab.lib.pagesizes import A4
from reportlab.lib import colors
from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle
from reportlab.lib.units import cm
from reportlab.platypus import SimpleDocTemplate, Paragraph, Spacer, HRFlowable, PageBreak
from reportlab.platypus import Table, TableStyle
from reportlab.graphics.shapes import Drawing, Rect, String, Line, Circle, Ellipse, Polygon, Arrow
from reportlab.graphics import renderPDF
from reportlab.graphics.shapes import Group
from reportlab.lib.enums import TA_CENTER, TA_LEFT
from reportlab.platypus import Flowable
import math
output_path = "/home/daytona/workspace/path-study-plan/Pathology_Diagrams_CellInjury.pdf"
doc = SimpleDocTemplate(
output_path,
pagesize=A4,
rightMargin=1.8*cm,
leftMargin=1.8*cm,
topMargin=1.8*cm,
bottomMargin=1.8*cm
)
W, H = A4
styles = getSampleStyleSheet()
title_style = ParagraphStyle('T', parent=styles['Title'], fontSize=18,
textColor=colors.HexColor('#1a237e'), alignment=TA_CENTER, spaceAfter=4)
subtitle_style = ParagraphStyle('S', parent=styles['Normal'], fontSize=10,
textColor=colors.HexColor('#37474f'), alignment=TA_CENTER, spaceAfter=6)
diag_title_style = ParagraphStyle('DT', parent=styles['Heading1'], fontSize=13,
textColor=colors.white, backColor=colors.HexColor('#1a237e'),
spaceBefore=10, spaceAfter=6, leftIndent=6)
label_style = ParagraphStyle('L', parent=styles['Normal'], fontSize=9,
textColor=colors.HexColor('#212121'), spaceAfter=3, leftIndent=10)
tip_style = ParagraphStyle('Tip', parent=styles['Normal'], fontSize=9,
textColor=colors.HexColor('#1b5e20'), spaceAfter=3, leftIndent=10,
backColor=colors.HexColor('#f1f8e9'), borderPad=4)
class DrawingFlowable(Flowable):
def __init__(self, drawing):
Flowable.__init__(self)
self.drawing = drawing
self.width = drawing.width
self.height = drawing.height
def draw(self):
renderPDF.draw(self.drawing, self.canv, 0, 0)
elements = []
# =========================================================
# PAGE TITLE
# =========================================================
elements.append(Paragraph("PATHOLOGY DIAGRAMS", title_style))
elements.append(Paragraph("Cell Injury & Necrosis | Day 1-2 | Easy Exam Diagrams", subtitle_style))
elements.append(Paragraph("NIMSRC Medical College | KNRUHS 2nd Year MBBS", subtitle_style))
elements.append(HRFlowable(width="100%", thickness=2, color=colors.HexColor('#1a237e')))
elements.append(Spacer(1, 0.3*cm))
# =========================================================
# DIAGRAM 1: Causes of Cell Injury (Flowchart)
# =========================================================
elements.append(Paragraph(" DIAGRAM 1: Causes of Cell Injury", diag_title_style))
elements.append(Spacer(1, 0.2*cm))
dw = 16*cm
dh = 9*cm
d1 = Drawing(dw, dh)
# Central box
cx, cy = dw/2, dh/2 + 0.5*cm
bw, bh = 3.5*cm, 1.0*cm
d1.add(Rect(cx - bw/2, cy - bh/2, bw, bh, fillColor=colors.HexColor('#1a237e'), strokeColor=colors.HexColor('#1a237e')))
d1.add(String(cx, cy - 4, "CELL INJURY", fontSize=9, fillColor=colors.white, textAnchor='middle'))
# Surrounding boxes with arrows
causes = [
("Hypoxia /\nIschemia", 1.5*cm, cy),
("Physical\nAgents", 3.5*cm, dh - 1.2*cm),
("Chemical\nAgents", cx, dh - 1.2*cm),
("Infections", dw - 3.5*cm, dh - 1.2*cm),
("Immunologic\nRx", dw - 1.5*cm, cy),
("Nutritional\nImbalance", dw - 3.5*cm, 1.2*cm),
("Genetic\nDefects", cx, 1.2*cm),
("Aging", 3.5*cm, 1.2*cm),
]
box_color = colors.HexColor('#e8eaf6')
stroke_color = colors.HexColor('#3949ab')
for text, bx, by in causes:
sbw, sbh = 2.8*cm, 0.85*cm
d1.add(Rect(bx - sbw/2, by - sbh/2, sbw, sbh,
fillColor=box_color, strokeColor=stroke_color, strokeWidth=1))
lines = text.split('\n')
if len(lines) == 2:
d1.add(String(bx, by + 1, lines[0], fontSize=7.5, fillColor=colors.HexColor('#1a237e'), textAnchor='middle'))
d1.add(String(bx, by - 9, lines[1], fontSize=7.5, fillColor=colors.HexColor('#1a237e'), textAnchor='middle'))
else:
d1.add(String(bx, by - 4, text, fontSize=7.5, fillColor=colors.HexColor('#1a237e'), textAnchor='middle'))
# Arrow from box to center
dx = cx - bx
dy_ = cy - by
dist = math.sqrt(dx*dx + dy_*dy_) or 1
fx = bx + (sbw/2 + 2) * (dx/dist)
fy = by + (sbh/2 + 2) * (dy_/dist)
tx = cx - (bw/2 + 2) * (dx/dist)
ty = cy - (bh/2 + 2) * (dy_/dist)
d1.add(Line(fx, fy, tx, ty, strokeColor=colors.HexColor('#5c6bc0'), strokeWidth=1))
elements.append(DrawingFlowable(d1))
elements.append(Spacer(1, 0.1*cm))
elements.append(Paragraph("✏ Exam tip: Draw a central box 'CELL INJURY' and 8 surrounding boxes with arrows pointing inward. Takes 90 seconds.", tip_style))
elements.append(Spacer(1, 0.3*cm))
# =========================================================
# DIAGRAM 2: Reversible vs Irreversible Cell Injury
# =========================================================
elements.append(Paragraph(" DIAGRAM 2: Reversible vs Irreversible Cell Injury", diag_title_style))
elements.append(Spacer(1, 0.2*cm))
dw2 = 16*cm
dh2 = 7.5*cm
d2 = Drawing(dw2, dh2)
# Normal cell box
d2.add(Rect(0.5*cm, dh2/2 - 0.5*cm, 2.5*cm, 1.0*cm,
fillColor=colors.HexColor('#e3f2fd'), strokeColor=colors.HexColor('#1565c0'), strokeWidth=1.5))
d2.add(String(1.75*cm, dh2/2 - 2, "NORMAL\nCELL", fontSize=8, fillColor=colors.HexColor('#1565c0'), textAnchor='middle'))
# Arrow right to stressor
d2.add(Line(3.2*cm, dh2/2, 5.0*cm, dh2/2, strokeColor=colors.grey, strokeWidth=1.2))
d2.add(String(4.0*cm, dh2/2 + 3, "Injurious", fontSize=7, fillColor=colors.grey, textAnchor='middle'))
d2.add(String(4.0*cm, dh2/2 - 9, "Stimulus", fontSize=7, fillColor=colors.grey, textAnchor='middle'))
# Injured cell
d2.add(Rect(5.2*cm, dh2/2 - 0.6*cm, 2.8*cm, 1.2*cm,
fillColor=colors.HexColor('#fff9c4'), strokeColor=colors.HexColor('#f57f17'), strokeWidth=1.5))
d2.add(String(6.6*cm, dh2/2 + 1, "INJURED", fontSize=8, fillColor=colors.HexColor('#e65100'), textAnchor='middle'))
d2.add(String(6.6*cm, dh2/2 - 10, "CELL", fontSize=8, fillColor=colors.HexColor('#e65100'), textAnchor='middle'))
# Branch up - reversible
d2.add(Line(8.2*cm, dh2/2 + 0.3*cm, 10.0*cm, dh2 - 1.2*cm,
strokeColor=colors.HexColor('#2e7d32'), strokeWidth=1.2))
d2.add(Rect(10.0*cm, dh2 - 1.8*cm, 3.2*cm, 1.1*cm,
fillColor=colors.HexColor('#e8f5e9'), strokeColor=colors.HexColor('#2e7d32'), strokeWidth=1.5))
d2.add(String(11.6*cm, dh2 - 1.35*cm, "REVERSIBLE", fontSize=8, fillColor=colors.HexColor('#1b5e20'), textAnchor='middle'))
d2.add(String(11.6*cm, dh2 - 1.65*cm - 2, "Stimulus removed", fontSize=7, fillColor=colors.HexColor('#1b5e20'), textAnchor='middle'))
# Recovery arrow back
d2.add(Line(13.4*cm, dh2 - 1.2*cm, 14.5*cm, dh2/2 + 0.3*cm, strokeColor=colors.HexColor('#43a047'), strokeWidth=1))
d2.add(Rect(13.4*cm, dh2/2 - 0.35*cm, 3.0*cm, 0.9*cm,
fillColor=colors.HexColor('#c8e6c9'), strokeColor=colors.HexColor('#2e7d32'), strokeWidth=1))
d2.add(String(14.9*cm, dh2/2 - 0.1*cm - 4, "RECOVERY", fontSize=8, fillColor=colors.HexColor('#1b5e20'), textAnchor='middle'))
# Branch down - irreversible
d2.add(Line(8.2*cm, dh2/2 - 0.3*cm, 10.0*cm, 1.8*cm,
strokeColor=colors.HexColor('#c62828'), strokeWidth=1.2))
d2.add(Rect(10.0*cm, 1.0*cm, 3.2*cm, 1.1*cm,
fillColor=colors.HexColor('#ffebee'), strokeColor=colors.HexColor('#c62828'), strokeWidth=1.5))
d2.add(String(11.6*cm, 1.6*cm, "IRREVERSIBLE", fontSize=8, fillColor=colors.HexColor('#b71c1c'), textAnchor='middle'))
d2.add(String(11.6*cm, 1.6*cm - 10, "Stimulus persists", fontSize=7, fillColor=colors.HexColor('#b71c1c'), textAnchor='middle'))
# Cell death box
d2.add(Line(13.4*cm, 1.5*cm, 14.5*cm, dh2/2 - 0.3*cm, strokeColor=colors.HexColor('#e53935'), strokeWidth=1))
d2.add(Rect(13.4*cm, dh2/2 - 0.9*cm, 2.8*cm, 0.9*cm,
fillColor=colors.HexColor('#ffcdd2'), strokeColor=colors.HexColor('#c62828'), strokeWidth=1))
d2.add(String(14.8*cm, dh2/2 - 0.55*cm - 4, "CELL DEATH", fontSize=8, fillColor=colors.HexColor('#b71c1c'), textAnchor='middle'))
elements.append(DrawingFlowable(d2))
elements.append(Spacer(1, 0.1*cm))
elements.append(Paragraph("✏ Exam tip: Draw left-to-right. Normal → Injured → two branches (up=reversible, down=irreversible). Green for reversible, red for irreversible.", tip_style))
elements.append(PageBreak())
# =========================================================
# DIAGRAM 3: Mechanisms of Irreversible Cell Injury
# =========================================================
elements.append(Paragraph(" DIAGRAM 3: Mechanisms of Irreversible Cell Injury", diag_title_style))
elements.append(Spacer(1, 0.2*cm))
mech_data = [
["Mechanism", "What Happens", "Result"],
["ATP Depletion", "↓ Na/K ATPase pump → Na+ & water enter cell", "Cell swelling → membrane damage"],
["Mitochondrial\nDysfunction", "↓ Oxidative phosphorylation → ↓ ATP", "Energy failure → cell death"],
["Ca²⁺ Influx", "↑ Intracellular Ca²⁺ activates enzymes\n(ATPases, phospholipases, proteases, endonucleases)", "Membrane & nuclear destruction"],
["Free Radical\nInjury", "ROS damage lipids, proteins, DNA\n(Lipid peroxidation)", "Membrane disruption"],
["Membrane\nDamage", "Loss of phospholipids, cytoskeletal damage", "Cell contents leak out → DEATH"],
]
mt = Table(mech_data, colWidths=[3.5*cm, 7.5*cm, 5.4*cm])
mt.setStyle(TableStyle([
('BACKGROUND', (0,0), (-1,0), colors.HexColor('#b71c1c')),
('TEXTCOLOR', (0,0), (-1,0), colors.white),
('FONTNAME', (0,0), (-1,0), 'Helvetica-Bold'),
('FONTSIZE', (0,0), (-1,-1), 8.5),
('ROWBACKGROUNDS', (0,1), (-1,-1), [colors.HexColor('#ffebee'), colors.white]),
('GRID', (0,0), (-1,-1), 0.5, colors.HexColor('#ef9a9a')),
('VALIGN', (0,0), (-1,-1), 'MIDDLE'),
('TOPPADDING', (0,0), (-1,-1), 5),
('BOTTOMPADDING', (0,0), (-1,-1), 5),
('LEFTPADDING', (0,0), (-1,-1), 6),
('WORDWRAP', (0,0), (-1,-1), True),
]))
elements.append(mt)
elements.append(Spacer(1, 0.1*cm))
elements.append(Paragraph("✏ Exam tip: This table format itself is a great diagram to draw in exams. 3 columns, 5 rows. Always include Ca²⁺ influx - examiners love it.", tip_style))
elements.append(Spacer(1, 0.4*cm))
# =========================================================
# DIAGRAM 4: Types of Necrosis - Comparison Table
# =========================================================
elements.append(Paragraph(" DIAGRAM 4: Types of Necrosis (Easy Comparison)", diag_title_style))
elements.append(Spacer(1, 0.2*cm))
nec_data = [
["Type", "Gross Appearance", "Microscopy", "Classic Example"],
["Coagulative", "Firm, pale, preserved outline", "Ghost cells - outlines preserved,\nnuclei gone", "MI (heart), Renal infarct"],
["Liquefactive", "Soft, liquid, pus-like", "Digested debris, no cell outline", "Brain infarct, Abscess"],
["Caseous", "Cheese-like, white, crumbly", "Amorphous granular debris +\ngranuloma", "Tuberculosis (TB)"],
["Fat", "Chalky white deposits (saponification)", "Fat cells with Ca²⁺ deposits\n(ghost outlines)", "Acute pancreatitis"],
["Fibrinoid", "Vessel wall looks pink & glassy", "Fibrin-like material in vessel walls", "Malignant hypertension,\nAutoimmune"],
["Gangrenous", "Dry (coag) or Wet (liquef + coag)", "Mixed features", "Diabetic foot, Intestine"],
]
nt = Table(nec_data, colWidths=[2.8*cm, 3.8*cm, 4.8*cm, 4.0*cm])
nt.setStyle(TableStyle([
('BACKGROUND', (0,0), (-1,0), colors.HexColor('#4a148c')),
('TEXTCOLOR', (0,0), (-1,0), colors.white),
('FONTNAME', (0,0), (-1,0), 'Helvetica-Bold'),
('FONTSIZE', (0,0), (-1,-1), 8),
('ROWBACKGROUNDS', (0,1), (-1,-1), [colors.HexColor('#f3e5f5'), colors.white]),
('GRID', (0,0), (-1,-1), 0.5, colors.HexColor('#ce93d8')),
('VALIGN', (0,0), (-1,-1), 'MIDDLE'),
('TOPPADDING', (0,0), (-1,-1), 5),
('BOTTOMPADDING', (0,0), (-1,-1), 5),
('LEFTPADDING', (0,0), (-1,-1), 5),
('WORDWRAP', (0,0), (-1,-1), True),
]))
elements.append(nt)
elements.append(Spacer(1, 0.1*cm))
elements.append(Paragraph("✏ Exam tip: Most asked question = 'Describe types of necrosis'. Draw this table. Always add examples. Coagulative = MI is the #1 fact examiners check.", tip_style))
elements.append(PageBreak())
# =========================================================
# DIAGRAM 5: Apoptosis vs Necrosis
# =========================================================
elements.append(Paragraph(" DIAGRAM 5: Apoptosis vs Necrosis (Must-Know Comparison)", diag_title_style))
elements.append(Spacer(1, 0.2*cm))
ap_data = [
["Feature", "APOPTOSIS", "NECROSIS"],
["Type", "Programmed (physiological)", "Uncontrolled (pathological)"],
["Cause", "Programmed signals, DNA damage,\nFas-FasL, p53 activation", "Ischemia, toxins, trauma,\ninfection"],
["Cell size", "Shrinks (pyknosis)", "Swells (oncosis)"],
["Nucleus", "Karyorrhexis (fragmentation)", "Karyolysis or Pyknosis → lysis"],
["Membrane", "Intact (blebs form)", "Disrupted - contents leak"],
["Inflammation", "ABSENT (no leakage)", "PRESENT (contents spill)"],
["Apoptotic body", "PRESENT (phagocytosed)", "ABSENT"],
["Energy (ATP)", "Required (active process)", "Not required (passive)"],
["Examples", "Embryogenesis, thymus T-cell\nselection, menstrual endometrium", "MI, infarction, abscess,\ngangrene"],
]
at = Table(ap_data, colWidths=[4.0*cm, 6.3*cm, 6.1*cm])
at.setStyle(TableStyle([
('BACKGROUND', (0,0), (-1,0), colors.HexColor('#1b5e20')),
('TEXTCOLOR', (0,0), (-1,0), colors.white),
('FONTNAME', (0,0), (-1,0), 'Helvetica-Bold'),
('BACKGROUND', (1,0), (1,0), colors.HexColor('#1b5e20')),
('BACKGROUND', (2,0), (2,0), colors.HexColor('#b71c1c')),
('FONTSIZE', (0,0), (-1,-1), 8),
('ROWBACKGROUNDS', (0,1), (-1,-1), [colors.HexColor('#f1f8e9'), colors.white]),
('GRID', (0,0), (-1,-1), 0.5, colors.HexColor('#a5d6a7')),
('VALIGN', (0,0), (-1,-1), 'MIDDLE'),
('TOPPADDING', (0,0), (-1,-1), 5),
('BOTTOMPADDING', (0,0), (-1,-1), 5),
('LEFTPADDING', (0,0), (-1,-1), 5),
('WORDWRAP', (0,0), (-1,-1), True),
('FONTNAME', (0,1), (0,-1), 'Helvetica-Bold'),
('BACKGROUND', (0,1), (0,-1), colors.HexColor('#e8f5e9')),
]))
elements.append(at)
elements.append(Spacer(1, 0.1*cm))
elements.append(Paragraph("✏ Exam tip: This is the #1 most asked diagram/table in Cell Injury. Bold the key contrast points: Apoptosis = NO inflammation, ATP needed. Necrosis = inflammation present.", tip_style))
elements.append(Spacer(1, 0.4*cm))
# =========================================================
# DIAGRAM 6: Apoptosis Pathways (Simplified)
# =========================================================
elements.append(Paragraph(" DIAGRAM 6: Apoptosis Pathways (Intrinsic & Extrinsic)", diag_title_style))
elements.append(Spacer(1, 0.2*cm))
dw6 = 16*cm
dh6 = 9.5*cm
d6 = Drawing(dw6, dh6)
# --- Intrinsic pathway (left side) ---
# Trigger
d6.add(Rect(0.3*cm, dh6 - 1.5*cm, 4.0*cm, 0.9*cm,
fillColor=colors.HexColor('#fff3e0'), strokeColor=colors.HexColor('#e65100'), strokeWidth=1.2))
d6.add(String(2.3*cm, dh6 - 1.15*cm, "DNA damage / Hypoxia", fontSize=7.5,
fillColor=colors.HexColor('#bf360c'), textAnchor='middle'))
d6.add(Line(2.3*cm, dh6 - 1.5*cm, 2.3*cm, dh6 - 2.3*cm, strokeColor=colors.grey, strokeWidth=1))
# p53 box
d6.add(Rect(0.8*cm, dh6 - 3.1*cm, 3.0*cm, 0.9*cm,
fillColor=colors.HexColor('#fce4ec'), strokeColor=colors.HexColor('#880e4f'), strokeWidth=1.2))
d6.add(String(2.3*cm, dh6 - 2.75*cm, "↑ p53", fontSize=8, fillColor=colors.HexColor('#880e4f'), textAnchor='middle'))
d6.add(Line(2.3*cm, dh6 - 3.1*cm, 2.3*cm, dh6 - 3.9*cm, strokeColor=colors.grey, strokeWidth=1))
# Bax/Bcl2
d6.add(Rect(0.5*cm, dh6 - 4.7*cm, 3.6*cm, 0.9*cm,
fillColor=colors.HexColor('#f3e5f5'), strokeColor=colors.HexColor('#4a148c'), strokeWidth=1.2))
d6.add(String(2.3*cm, dh6 - 4.35*cm, "↑ Bax / ↓ Bcl-2", fontSize=7.5, fillColor=colors.HexColor('#4a148c'), textAnchor='middle'))
d6.add(Line(2.3*cm, dh6 - 4.7*cm, 2.3*cm, dh6 - 5.5*cm, strokeColor=colors.grey, strokeWidth=1))
# Cytochrome C
d6.add(Rect(0.5*cm, dh6 - 6.3*cm, 3.6*cm, 0.9*cm,
fillColor=colors.HexColor('#e8eaf6'), strokeColor=colors.HexColor('#1a237e'), strokeWidth=1.2))
d6.add(String(2.3*cm, dh6 - 5.95*cm, "Cytochrome C release", fontSize=7.5, fillColor=colors.HexColor('#1a237e'), textAnchor='middle'))
# Arrow to caspase
d6.add(Line(2.3*cm, dh6 - 6.3*cm, 2.3*cm, dh6 - 7.0*cm, strokeColor=colors.grey, strokeWidth=1))
d6.add(Line(2.3*cm, dh6 - 7.0*cm, 6.5*cm, dh6 - 7.6*cm, strokeColor=colors.HexColor('#1565c0'), strokeWidth=1.2))
# Label left
d6.add(String(1.2*cm, dh6 - 7.3*cm, "INTRINSIC", fontSize=7, fillColor=colors.HexColor('#1565c0'), textAnchor='middle'))
d6.add(String(1.2*cm, dh6 - 7.7*cm, "PATHWAY", fontSize=7, fillColor=colors.HexColor('#1565c0'), textAnchor='middle'))
# --- Extrinsic pathway (right side) ---
d6.add(Rect(10.5*cm, dh6 - 1.5*cm, 4.2*cm, 0.9*cm,
fillColor=colors.HexColor('#e0f7fa'), strokeColor=colors.HexColor('#006064'), strokeWidth=1.2))
d6.add(String(12.6*cm, dh6 - 1.15*cm, "Fas-L / TNF binding", fontSize=7.5,
fillColor=colors.HexColor('#004d40'), textAnchor='middle'))
d6.add(Line(12.6*cm, dh6 - 1.5*cm, 12.6*cm, dh6 - 2.3*cm, strokeColor=colors.grey, strokeWidth=1))
d6.add(Rect(10.5*cm, dh6 - 3.1*cm, 4.2*cm, 0.9*cm,
fillColor=colors.HexColor('#e0f2f1'), strokeColor=colors.HexColor('#004d40'), strokeWidth=1.2))
d6.add(String(12.6*cm, dh6 - 2.75*cm, "FADD adaptor protein", fontSize=7.5, fillColor=colors.HexColor('#004d40'), textAnchor='middle'))
d6.add(Line(12.6*cm, dh6 - 3.1*cm, 12.6*cm, dh6 - 3.9*cm, strokeColor=colors.grey, strokeWidth=1))
d6.add(Rect(10.5*cm, dh6 - 4.7*cm, 4.2*cm, 0.9*cm,
fillColor=colors.HexColor('#b2dfdb'), strokeColor=colors.HexColor('#004d40'), strokeWidth=1.2))
d6.add(String(12.6*cm, dh6 - 4.35*cm, "Caspase 8 activation", fontSize=7.5, fillColor=colors.HexColor('#004d40'), textAnchor='middle'))
d6.add(Line(12.6*cm, dh6 - 4.7*cm, 12.6*cm, dh6 - 5.5*cm, strokeColor=colors.grey, strokeWidth=1))
# Arrow to caspase
d6.add(Line(12.6*cm, dh6 - 5.5*cm, 8.5*cm, dh6 - 7.6*cm, strokeColor=colors.HexColor('#006064'), strokeWidth=1.2))
d6.add(String(13.5*cm, dh6 - 7.3*cm, "EXTRINSIC", fontSize=7, fillColor=colors.HexColor('#006064'), textAnchor='middle'))
d6.add(String(13.5*cm, dh6 - 7.7*cm, "PATHWAY", fontSize=7, fillColor=colors.HexColor('#006064'), textAnchor='middle'))
# --- Common final pathway ---
d6.add(Rect(5.0*cm, dh6 - 8.4*cm, 4.8*cm, 0.9*cm,
fillColor=colors.HexColor('#ffcdd2'), strokeColor=colors.HexColor('#b71c1c'), strokeWidth=1.5))
d6.add(String(7.4*cm, dh6 - 8.05*cm, "EFFECTOR CASPASE-3", fontSize=8, fillColor=colors.HexColor('#b71c1c'), textAnchor='middle'))
d6.add(Line(7.4*cm, dh6 - 8.4*cm, 7.4*cm, dh6 - 9.1*cm, strokeColor=colors.HexColor('#c62828'), strokeWidth=1.5))
d6.add(Rect(5.2*cm, dh6 - 9.5*cm, 4.4*cm, 0.9*cm - 0.3*cm,
fillColor=colors.HexColor('#b71c1c'), strokeColor=colors.HexColor('#b71c1c'), strokeWidth=1.5))
d6.add(String(7.4*cm, dh6 - 9.2*cm, "APOPTOSIS", fontSize=9, fillColor=colors.white, textAnchor='middle'))
elements.append(DrawingFlowable(d6))
elements.append(Spacer(1, 0.1*cm))
elements.append(Paragraph("✏ Exam tip: Two branches meeting at Caspase-3. Left = Intrinsic (mitochondria, p53, Bax/Bcl-2). Right = Extrinsic (Fas-FasL, Caspase-8). Both → Caspase-3 → Apoptosis.", tip_style))
# =========================================================
# Footer
# =========================================================
elements.append(Spacer(1, 0.4*cm))
elements.append(HRFlowable(width="100%", thickness=1, color=colors.HexColor('#9fa8da')))
footer_style = ParagraphStyle('F', parent=styles['Normal'], fontSize=8,
textColor=colors.grey, alignment=TA_CENTER, spaceBefore=4)
elements.append(Paragraph("Generated by Orris AI | Day 1-2 Diagrams: Cell Injury & Necrosis | For personal academic use", footer_style))
doc.build(elements)
print(f"PDF created: {output_path}")
python /home/daytona/workspace/path-study-plan/generate_diagrams_pdf.py
~/path-study-plan/generate_diagrams_pdf.py
Successfully replaced 1 instance(s) of the string in '/home/daytona/workspace/path-study-plan/generate_diagrams_pdf.py'
python /home/daytona/workspace/path-study-plan/generate_diagrams_pdf.py
Pathology Diagrams CellInjury
PDF Document · PDF
| # | Diagram | Type |
|---|---|---|
| 1 | Causes of Cell Injury | Flowchart (central box + 8 causes) |
| 2 | Reversible vs Irreversible Cell Injury | Left-to-right flowchart |
| 3 | Mechanisms of Irreversible Cell Injury | 3-column table |
| 4 | Types of Necrosis | Comparison table (6 types) |
| 5 | Apoptosis vs Necrosis | Side-by-side comparison (most asked!) |
| 6 | Apoptosis Pathways (Intrinsic + Extrinsic) | Two-branch flowchart |
u gave me flow charts i want diagrams ..... whenever ur teaching something that time add diagramns of that perticukar topic

| # | Cause | Example |
|---|---|---|
| 1 | Hypoxia / Ischemia | Blocked artery, anemia |
| 2 | Physical agents | Trauma, radiation, heat/cold |
| 3 | Chemical agents / Toxins | CCl4, alcohol, drugs |
| 4 | Infectious agents | Bacteria, viruses, parasites |
| 5 | Immunologic reactions | Autoimmune, allergy |
| 6 | Genetic abnormalities | Sickle cell, Down syndrome |
| 7 | Nutritional imbalances | Protein deficiency, obesity |
| 8 | Aging | Progressive cell deterioration |
Memory trick: H-P-C-I-I-G-N-A = "Healthy People Can't Ignore Illness - Get Nourished Always"

| Adaptation | Definition | Example |
|---|---|---|
| Hypertrophy | ↑ cell SIZE (not number) | Cardiac hypertrophy in hypertension |
| Hyperplasia | ↑ cell NUMBER | Endometrial hyperplasia (estrogen) |
| Atrophy | ↓ cell size + function | Muscle wasting in bedridden patients |
| Metaplasia | One cell type → another (reversible) | Squamous metaplasia in smokers (bronchi) |
| Dysplasia | Disordered growth (pre-malignant) | Cervical dysplasia (CIN) |

Key exam point: Membrane stays INTACT in apoptosis. No inflammation. Contrast this with necrosis where membrane BREAKS and inflammation occurs.
| Feature | Apoptosis | Necrosis |
|---|---|---|
| Cell size | Shrinks | Swells |
| Membrane | Intact | Disrupted |
| Inflammation | NO | YES |
| Apoptotic bodies | YES | NO |
| ATP needed | YES | NO |
| Nucleus | Karyorrhexis | Karyolysis/pyknosis |
| Cause | Physiological or controlled | Pathological |
| Example | Embryogenesis, thymus | MI, infarction, abscess |
u added good diagrams but i want diagrams easy to draw
~/path-study-plan/day1_diagrams.py
import matplotlib.pyplot as plt
import matplotlib.patches as mpatches
from matplotlib.patches import FancyArrowPatch, FancyBboxPatch, Circle, Ellipse
import matplotlib.patheffects as pe
import numpy as np
# ─────────────────────────────────────────────
# DIAGRAM 1: Sequence of Cell Injury (simple boxes)
# ─────────────────────────────────────────────
fig1, ax1 = plt.subplots(figsize=(7, 9))
ax1.set_xlim(0, 10)
ax1.set_ylim(0, 12)
ax1.axis('off')
ax1.set_facecolor('#f8f9ff')
fig1.patch.set_facecolor('#f8f9ff')
ax1.text(5, 11.5, 'DIAGRAM 1: Sequence of Cell Injury', fontsize=13,
fontweight='bold', ha='center', color='#1a237e')
def draw_box(ax, x, y, w, h, label, sublabel='', fc='#e3f2fd', ec='#1565c0', fs=11):
box = FancyBboxPatch((x - w/2, y - h/2), w, h,
boxstyle="round,pad=0.1", fc=fc, ec=ec, lw=2)
ax.add_patch(box)
ax.text(x, y + (0.18 if sublabel else 0), label, ha='center', va='center',
fontsize=fs, fontweight='bold', color='#1a237e')
if sublabel:
ax.text(x, y - 0.35, sublabel, ha='center', va='center',
fontsize=8.5, color='#37474f', style='italic')
def draw_arrow(ax, x, y1, y2, color='#f57f17'):
ax.annotate('', xy=(x, y2), xytext=(x, y1),
arrowprops=dict(arrowstyle='->', color=color, lw=2.5))
# Boxes
draw_box(ax1, 5, 10.3, 4, 0.9, 'HEALTHY CELL', '(homeostasis)', fc='#e3f2fd', ec='#1565c0')
draw_arrow(ax1, 5, 9.85, 9.1)
ax1.text(5.7, 9.5, 'Injurious stimulus', fontsize=9, color='#555', style='italic')
draw_box(ax1, 5, 8.6, 4, 0.9, 'REVERSIBLE INJURY', '', fc='#fff9c4', ec='#f57f17')
draw_arrow(ax1, 5, 8.15, 7.4)
ax1.text(5.7, 7.75, 'Severe / persistent', fontsize=9, color='#555', style='italic')
draw_box(ax1, 5, 6.9, 4, 0.9, 'IRREVERSIBLE INJURY', '', fc='#ffcdd2', ec='#c62828')
# Two branches
ax1.annotate('', xy=(3, 5.5), xytext=(4.2, 6.45),
arrowprops=dict(arrowstyle='->', color='#b71c1c', lw=2.2))
ax1.annotate('', xy=(7, 5.5), xytext=(5.8, 6.45),
arrowprops=dict(arrowstyle='->', color='#b71c1c', lw=2.2))
draw_box(ax1, 3, 5.0, 3.2, 0.9, 'NECROSIS', 'Pathological', fc='#ef9a9a', ec='#b71c1c')
draw_box(ax1, 7, 5.0, 3.2, 0.9, 'APOPTOSIS', 'Programmed', fc='#c8e6c9', ec='#2e7d32')
ax1.text(5, 3.8, 'CELL DEATH', fontsize=13, fontweight='bold', ha='center', color='#b71c1c')
# Recovery arrow
ax1.annotate('', xy=(2.5, 8.6), xytext=(2.5, 8.15),
arrowprops=dict(arrowstyle='<-', color='#2e7d32', lw=2))
ax1.text(1.0, 8.6, 'Recovery\n(if stimulus\nremoved)', fontsize=8, color='#2e7d32', ha='center', va='center')
ax1.text(5, 0.4, '✏ Draw tip: 3 boxes top-to-bottom, two branches at bottom', fontsize=9,
ha='center', color='#1b5e20',
bbox=dict(boxstyle='round,pad=0.3', fc='#f1f8e9', ec='#81c784'))
plt.tight_layout()
plt.savefig('/home/daytona/workspace/path-study-plan/diag1_sequence.png', dpi=150, bbox_inches='tight')
plt.close()
print("Diagram 1 saved")
# ─────────────────────────────────────────────
# DIAGRAM 2: Normal Cell vs Reversible vs Necrotic (3 cell drawings)
# ─────────────────────────────────────────────
fig2, axes = plt.subplots(1, 3, figsize=(13, 8))
fig2.patch.set_facecolor('#f8f9ff')
fig2.suptitle('DIAGRAM 2: Cell Changes - Normal → Reversible Injury → Necrosis',
fontsize=13, fontweight='bold', color='#1a237e', y=1.01)
titles = ['NORMAL CELL', 'REVERSIBLE INJURY', 'NECROSIS\n(Irreversible)']
bg_colors = ['#e3f2fd', '#fff9c4', '#ffebee']
title_colors = ['#1565c0', '#e65100', '#b71c1c']
for i, (ax, title, bg, tc) in enumerate(zip(axes, titles, bg_colors, title_colors)):
ax.set_xlim(-5, 5)
ax.set_ylim(-5, 5.5)
ax.set_facecolor(bg)
ax.axis('off')
ax.set_title(title, fontsize=11, fontweight='bold', color=tc, pad=8)
if i == 0:
# Normal cell - clean round cell
cell = Circle((0, 0), 4, fc='#bbdefb', ec='#1565c0', lw=2.5)
ax.add_patch(cell)
# Nucleus
nucleus = Ellipse((0, 0.3), 2.2, 1.6, fc='#7986cb', ec='#283593', lw=2)
ax.add_patch(nucleus)
ax.text(0, 0.3, 'N', ha='center', va='center', fontsize=14, color='white', fontweight='bold')
# Mitochondria
for mx, my, angle in [(-2.2, 1.5, 30), (2.0, 1.2, -20), (-1.8, -1.5, 10), (2.2, -1.2, 40)]:
mito = Ellipse((mx, my), 1.0, 0.5, angle=angle, fc='#ff8a65', ec='#bf360c', lw=1.2)
ax.add_patch(mito)
# ER (wavy line)
x_er = np.linspace(-3.2, -0.8, 30)
y_er = -0.5 + 0.3*np.sin(x_er * 3)
ax.plot(x_er, y_er, color='#795548', lw=2)
# Labels
ax.text(0, -4.6, '• Intact membrane\n• Normal nucleus\n• Organised organelles',
ha='center', va='bottom', fontsize=8, color='#1a237e',
bbox=dict(boxstyle='round,pad=0.3', fc='white', ec='#90caf9', alpha=0.8))
elif i == 1:
# Reversible injury - swollen, blebs on membrane
# Swollen cell
cell = Circle((0, 0), 4.2, fc='#fff176', ec='#f57f17', lw=2.5)
ax.add_patch(cell)
# Membrane blebs (small bumps)
for angle in [0, 45, 90, 135, 180, 225, 270, 315]:
rad = np.radians(angle)
bx = 4.0 * np.cos(rad)
by = 4.0 * np.sin(rad)
bleb = Circle((bx, by), 0.35, fc='#fff9c4', ec='#f57f17', lw=1.2)
ax.add_patch(bleb)
# Nucleus - clumped chromatin (darker, irregular)
nucleus = Ellipse((0, 0.3), 2.4, 1.7, fc='#9575cd', ec='#4527a0', lw=2)
ax.add_patch(nucleus)
ax.text(0, 0.3, 'N', ha='center', va='center', fontsize=14, color='white', fontweight='bold')
# Swollen mitochondria (bigger)
for mx, my, angle in [(-2.2, 1.5, 30), (2.0, 1.2, -20), (-1.8, -1.5, 10)]:
mito = Ellipse((mx, my), 1.3, 0.7, angle=angle, fc='#ffb74d', ec='#e65100', lw=1.5)
ax.add_patch(mito)
# Vacuoles
for vx, vy in [(1.5, -0.5), (-0.5, -1.5), (0.8, 1.8)]:
vac = Circle((vx, vy), 0.35, fc='white', ec='#90a4ae', lw=1)
ax.add_patch(vac)
ax.text(0, -4.6, '• Cell SWELLS\n• Membrane blebs\n• Vacuoles in cytoplasm\n• Chromatin clumps',
ha='center', va='bottom', fontsize=8, color='#e65100',
bbox=dict(boxstyle='round,pad=0.3', fc='white', ec='#ffe082', alpha=0.8))
elif i == 2:
# Necrosis - broken, irregular, fragmented
# Irregular broken cell border
angles = np.linspace(0, 2*np.pi, 20)
r = 3.8 + 0.6*np.random.RandomState(42).randn(20)
r = np.clip(r, 2.5, 4.5)
xs = r * np.cos(angles)
ys = r * np.sin(angles)
xs = np.append(xs, xs[0])
ys = np.append(ys, ys[0])
ax.fill(xs, ys, fc='#ffcdd2', ec='#c62828', lw=2, linestyle='--')
# Pyknotic nucleus (dark, small, irregular)
nuc = Ellipse((-0.5, 0.5), 1.2, 0.9, fc='#4a148c', ec='#311b92', lw=1.5)
ax.add_patch(nuc)
# Nuclear fragments (karyorrhexis)
for nx, ny in [(1.2, 1.5), (-1.5, -0.8), (0.3, -1.5)]:
frag = Circle((nx, ny), 0.25, fc='#7b1fa2', ec='#4a148c', lw=1)
ax.add_patch(frag)
# Ghost mitochondria
for mx, my, angle in [(-2.0, 1.8, 30), (1.8, 1.2, -20), (-1.5, -2.0, 10)]:
mito = Ellipse((mx, my), 1.0, 0.5, angle=angle, fc='#ef9a9a', ec='#c62828', lw=1, linestyle=':')
ax.add_patch(mito)
# Leaking dots (cell contents)
for lx, ly in [(-4.5, 1), (4.3, -0.5), (-3.8, -2), (3.5, 2), (0, 4.5)]:
ax.plot(lx, ly, 'o', color='#e53935', markersize=5)
# Inflammatory cells outside
for fx, fy in [(-4.8, -3), (4.5, -3), (0, -4.8)]:
cell_shape = Circle((fx, fy), 0.4, fc='#ef9a9a', ec='#b71c1c', lw=1)
ax.add_patch(cell_shape)
ax.text(fx, fy, '🔴', ha='center', va='center', fontsize=8)
ax.text(0, -4.6, '• Membrane BREAKS\n• Contents leak out\n• Nucleus: pyknosis/karyorrhexis\n• Inflammation occurs',
ha='center', va='bottom', fontsize=8, color='#b71c1c',
bbox=dict(boxstyle='round,pad=0.3', fc='white', ec='#ef9a9a', alpha=0.8))
ax1_note = fig2.add_axes([0.1, -0.06, 0.8, 0.05])
ax1_note.axis('off')
ax1_note.text(0.5, 0.5,
'✏ Draw tip: 3 circles in a row. Normal = neat. Reversible = bigger circle + bumps on edge + vacuoles inside. Necrosis = jagged/broken edge + dots leaking out.',
ha='center', va='center', fontsize=9, color='#1b5e20',
bbox=dict(boxstyle='round,pad=0.4', fc='#f1f8e9', ec='#81c784'))
plt.tight_layout()
plt.savefig('/home/daytona/workspace/path-study-plan/diag2_cell_changes.png', dpi=150, bbox_inches='tight')
plt.close()
print("Diagram 2 saved")
# ─────────────────────────────────────────────
# DIAGRAM 3: Apoptosis step by step (4 cells going down)
# ─────────────────────────────────────────────
fig3, ax3 = plt.subplots(figsize=(8, 12))
ax3.set_xlim(-1, 11)
ax3.set_ylim(-1, 17)
ax3.axis('off')
ax3.set_facecolor('#f8f9ff')
fig3.patch.set_facecolor('#f8f9ff')
ax3.text(5, 16.5, 'DIAGRAM 3: Apoptosis - Step by Step', fontsize=13,
fontweight='bold', ha='center', color='#1a237e')
steps = [
(5, 14, 'STEP 1: NORMAL CELL', '#e3f2fd', '#1565c0'),
(5, 10.5, 'STEP 2: CELL SHRINKS', '#e8f5e9', '#2e7d32'),
(5, 7, 'STEP 3: FRAGMENTATION\n(Apoptotic bodies)', '#fff9c4', '#f57f17'),
(5, 3.2, 'STEP 4: PHAGOCYTOSIS\nby macrophage', '#fce4ec', '#880e4f'),
]
for (cx, cy, label, fc, ec) in steps:
# Label above
ax3.text(cx, cy + 1.6, label, ha='center', va='center', fontsize=10,
fontweight='bold', color=ec)
for step_idx, (cx, cy, label, fc, ec) in enumerate(steps):
if step_idx == 0:
# Normal round cell
cell = Circle((cx, cy), 1.3, fc='#bbdefb', ec='#1565c0', lw=2)
ax3.add_patch(cell)
nuc = Ellipse((cx, cy), 0.9, 0.7, fc='#5c6bc0', ec='#1a237e', lw=1.5)
ax3.add_patch(nuc)
ax3.text(cx + 2.2, cy + 0.3, '• Round, normal size', fontsize=9, color='#1565c0')
ax3.text(cx + 2.2, cy - 0.15, '• Intact membrane', fontsize=9, color='#1565c0')
ax3.text(cx + 2.2, cy - 0.6, '• Normal nucleus', fontsize=9, color='#1565c0')
elif step_idx == 1:
# Shrunken cell with blebs, dense chromatin
cell = Circle((cx, cy), 1.0, fc='#c8e6c9', ec='#2e7d32', lw=2)
ax3.add_patch(cell)
# Dense dark nucleus (peripheral condensation)
nuc = Ellipse((cx, cy), 0.75, 0.55, fc='#1b5e20', ec='#003300', lw=1.5)
ax3.add_patch(nuc)
# Small blebs
for angle in [30, 90, 150, 210, 300]:
rad = np.radians(angle)
bx2 = cx + 1.0*np.cos(rad)
by2 = cy + 1.0*np.sin(rad)
bleb = Circle((bx2, by2), 0.2, fc='#a5d6a7', ec='#2e7d32', lw=1)
ax3.add_patch(bleb)
ax3.text(cx + 2.2, cy + 0.5, '• Cell SHRINKS', fontsize=9, color='#2e7d32', fontweight='bold')
ax3.text(cx + 2.2, cy + 0.05, '• Chromatin condenses', fontsize=9, color='#2e7d32')
ax3.text(cx + 2.2, cy - 0.4, ' at periphery', fontsize=9, color='#2e7d32')
ax3.text(cx + 2.2, cy - 0.85, '• Membrane blebs form', fontsize=9, color='#2e7d32')
elif step_idx == 2:
# Fragmented cell - multiple small apoptotic bodies
positions = [(cx - 1.5, cy + 0.3), (cx - 0.3, cy + 0.8),
(cx + 0.9, cy + 0.4), (cx + 0.2, cy - 0.6), (cx - 1.0, cy - 0.7)]
for bx3, by3 in positions:
body = Circle((bx3, by3), 0.45, fc='#fff176', ec='#f9a825', lw=1.5)
ax3.add_patch(body)
# small dark dot inside (nuclear fragment)
ax3.add_patch(Circle((bx3, by3), 0.18, fc='#4a148c', ec='#4a148c'))
ax3.text(cx + 1.8, cy + 0.5, '• Cell breaks into', fontsize=9, color='#e65100', fontweight='bold')
ax3.text(cx + 1.8, cy + 0.05, ' APOPTOTIC BODIES', fontsize=9, color='#e65100', fontweight='bold')
ax3.text(cx + 1.8, cy - 0.4, '• Membrane still INTACT', fontsize=9, color='#e65100')
ax3.text(cx + 1.8, cy - 0.85, '• NO leakage of contents', fontsize=9, color='#e65100')
elif step_idx == 3:
# Macrophage engulfing
# Big irregular macrophage
macro_xs = [cx - 2.5, cx - 2.8, cx - 2.2, cx - 1.0, cx + 0.5, cx + 1.8, cx + 2.5, cx + 2.2, cx + 1.5, cx + 0.5, cx - 0.5, cx - 1.5, cx - 2.5]
macro_ys = [cy + 1.2, cy + 0.2, cy - 0.8, cy - 1.2, cy - 1.4, cy - 1.0, cy - 0.2, cy + 0.8, cy + 1.4, cy + 1.5, cy + 1.5, cy + 1.3, cy + 1.2]
ax3.fill(macro_xs, macro_ys, fc='#f8bbd0', ec='#880e4f', lw=2)
# Macrophage nucleus
mnuc = Ellipse((cx - 0.5, cy + 0.2), 1.0, 0.6, fc='#ad1457', ec='#880e4f', lw=1.5)
ax3.add_patch(mnuc)
# Engulfed apoptotic bodies inside
for bx4, by4 in [(cx + 0.8, cy - 0.3), (cx + 0.2, cy - 0.6), (cx + 1.2, cy + 0.4)]:
body = Circle((bx4, by4), 0.35, fc='#fff9c4', ec='#f9a825', lw=1)
ax3.add_patch(body)
ax3.add_patch(Circle((bx4, by4), 0.14, fc='#4a148c', ec='#4a148c'))
ax3.text(cx - 0.5, cy + 0.2, 'M', ha='center', va='center',
fontsize=12, color='white', fontweight='bold')
ax3.text(cx + 2.8, cy + 0.5, 'MACROPHAGE', fontsize=9, color='#880e4f', fontweight='bold')
ax3.text(cx + 2.8, cy + 0.0, 'engulfs bodies', fontsize=9, color='#880e4f')
ax3.text(cx + 2.8, cy - 0.5, '• NO inflammation', fontsize=9, color='#880e4f', fontweight='bold')
# Arrow down (except last)
if step_idx < 3:
next_cy = steps[step_idx + 1][1]
ax3.annotate('', xy=(cx, next_cy + 1.7), xytext=(cx, cy - 1.5),
arrowprops=dict(arrowstyle='->', color='#f57f17', lw=2.5))
ax3.text(5, 0.1,
'✏ Draw tip: 4 cells going down. 1) Round normal cell. 2) Smaller, bumpy edges, dark nucleus. 3) Broken into 4-5 small circles. 4) Big irregular macrophage eating them.',
ha='center', va='center', fontsize=8.5, color='#1b5e20', wrap=True,
bbox=dict(boxstyle='round,pad=0.4', fc='#f1f8e9', ec='#81c784'))
plt.tight_layout()
plt.savefig('/home/daytona/workspace/path-study-plan/diag3_apoptosis.png', dpi=150, bbox_inches='tight')
plt.close()
print("Diagram 3 saved")
# ─────────────────────────────────────────────
# DIAGRAM 4: Cell Adaptations (simple icons)
# ─────────────────────────────────────────────
fig4, axes4 = plt.subplots(1, 4, figsize=(14, 6))
fig4.patch.set_facecolor('#f8f9ff')
fig4.suptitle('DIAGRAM 4: Cell Adaptations', fontsize=14, fontweight='bold', color='#1a237e', y=1.02)
adapt_titles = ['HYPERTROPHY', 'HYPERPLASIA', 'ATROPHY', 'METAPLASIA']
adapt_colors = ['#e3f2fd', '#e8f5e9', '#fff9c4', '#fce4ec']
adapt_ec = ['#1565c0', '#2e7d32', '#f57f17', '#880e4f']
for idx, (ax, title, bg, ec) in enumerate(zip(axes4, adapt_titles, adapt_colors, adapt_ec)):
ax.set_xlim(-1, 7)
ax.set_ylim(-0.5, 7.5)
ax.set_facecolor(bg)
ax.axis('off')
ax.set_title(title, fontsize=10, fontweight='bold', color=ec, pad=6)
if idx == 0: # Hypertrophy: 1 small cell → 1 big cell
# Before
c1 = Circle((1.5, 4.5), 0.7, fc='#bbdefb', ec='#1565c0', lw=1.5)
ax.add_patch(c1)
ax.add_patch(Ellipse((1.5, 4.5), 0.5, 0.38, fc='#5c6bc0', ec='#1a237e', lw=1))
ax.text(1.5, 3.5, 'BEFORE\n(1 cell, small)', ha='center', fontsize=8, color='#1565c0')
ax.annotate('', xy=(3.5, 4.5), xytext=(2.5, 4.5),
arrowprops=dict(arrowstyle='->', color=ec, lw=2))
# After
c2 = Circle((5.2, 4.5), 1.2, fc='#1565c0', ec='#0d47a1', lw=2)
ax.add_patch(c2)
ax.add_patch(Ellipse((5.2, 4.5), 0.8, 0.6, fc='white', ec='white', lw=1))
ax.text(5.2, 3.0, 'AFTER\n(1 cell, BIG ↑)', ha='center', fontsize=8, color='#0d47a1', fontweight='bold')
ax.text(3.0, 2.0, '↑ cell SIZE\nSame number\nEx: Heart in HTN', ha='center', fontsize=8.5, color='#1a237e',
bbox=dict(boxstyle='round,pad=0.3', fc='white', ec='#90caf9'))
elif idx == 1: # Hyperplasia: few cells → many cells
for cx2, cy2 in [(1.5, 5), (1.5, 3.5), (1.5, 2)]:
ax.add_patch(Circle((cx2, cy2), 0.5, fc='#c8e6c9', ec='#2e7d32', lw=1.5))
ax.add_patch(Ellipse((cx2, cy2), 0.35, 0.27, fc='#388e3c', ec='#1b5e20'))
ax.text(1.5, 1.0, 'BEFORE\n(few cells)', ha='center', fontsize=8, color='#2e7d32')
ax.annotate('', xy=(3.2, 3.5), xytext=(2.3, 3.5),
arrowprops=dict(arrowstyle='->', color=ec, lw=2))
for cx3, cy3 in [(4.3, 5.5),(5.2, 5.5),(4.3, 4.5),(5.2, 4.5),(4.3, 3.5),(5.2, 3.5),(4.3, 2.5),(5.2, 2.5)]:
ax.add_patch(Circle((cx3, cy3), 0.38, fc='#2e7d32', ec='#1b5e20', lw=1.2))
ax.add_patch(Ellipse((cx3, cy3), 0.26, 0.2, fc='white', ec='white'))
ax.text(4.75, 1.0, 'AFTER\n(MORE cells ↑)', ha='center', fontsize=8, color='#1b5e20', fontweight='bold')
ax.text(3.0, 0.0, '↑ cell NUMBER\nEx: Endometrial\nhyperplasia', ha='center', fontsize=8, color='#1b5e20',
bbox=dict(boxstyle='round,pad=0.3', fc='white', ec='#a5d6a7'))
elif idx == 2: # Atrophy: big cell → small cell
c1 = Circle((1.5, 4.5), 1.1, fc='#fff176', ec='#f57f17', lw=2)
ax.add_patch(c1)
ax.add_patch(Ellipse((1.5, 4.5), 0.7, 0.5, fc='#f57f17', ec='#e65100', lw=1.2))
ax.text(1.5, 3.0, 'BEFORE\n(normal)', ha='center', fontsize=8, color='#e65100')
ax.annotate('', xy=(3.5, 4.5), xytext=(2.8, 4.5),
arrowprops=dict(arrowstyle='->', color=ec, lw=2))
c2 = Circle((5.0, 4.5), 0.55, fc='#ffcc02', ec='#f57f17', lw=1.5, alpha=0.7)
ax.add_patch(c2)
ax.add_patch(Ellipse((5.0, 4.5), 0.38, 0.28, fc='#e65100', ec='#bf360c', lw=1))
ax.text(5.0, 3.0, 'AFTER\n(shrunken ↓)', ha='center', fontsize=8, color='#bf360c', fontweight='bold')
ax.text(3.0, 1.8, '↓ cell SIZE & function\nEx: Muscle wasting\nin bed rest', ha='center', fontsize=8, color='#bf360c',
bbox=dict(boxstyle='round,pad=0.3', fc='white', ec='#ffe082'))
elif idx == 3: # Metaplasia: columnar → squamous
# Columnar (tall rectangle cells)
for cx4 in [0.5, 1.2, 1.9, 2.6]:
ax.add_patch(mpatches.FancyBboxPatch((cx4, 3.5), 0.5, 1.8,
boxstyle='round,pad=0.05', fc='#f8bbd0', ec='#880e4f', lw=1.2))
ax.text(1.5, 3.0, 'BEFORE\n(Columnar cells)', ha='center', fontsize=8, color='#880e4f')
ax.annotate('', xy=(4.0, 4.5), xytext=(3.3, 4.5),
arrowprops=dict(arrowstyle='->', color=ec, lw=2))
# Squamous (flat rectangle cells)
for cy5 in [3.8, 4.3, 4.8, 5.3]:
ax.add_patch(mpatches.FancyBboxPatch((4.2, cy5), 2.2, 0.38,
boxstyle='round,pad=0.04', fc='#e91e63', ec='#880e4f', lw=1.2, alpha=0.8))
ax.text(5.3, 3.0, 'AFTER\n(Squamous cells)', ha='center', fontsize=8, color='#880e4f', fontweight='bold')
ax.text(3.0, 1.8, 'One cell type → another\nEx: Smoker bronchi\nColumnar → Squamous', ha='center', fontsize=7.5, color='#880e4f',
bbox=dict(boxstyle='round,pad=0.3', fc='white', ec='#f48fb1'))
plt.tight_layout()
ax_note = fig4.add_axes([0.05, -0.08, 0.9, 0.06])
ax_note.axis('off')
ax_note.text(0.5, 0.5,
'✏ Draw tip: Hypertrophy = 1 small → 1 big cell. Hyperplasia = few → many cells. Atrophy = big → small faded cell. Metaplasia = tall cells → flat cells.',
ha='center', va='center', fontsize=9, color='#1b5e20',
bbox=dict(boxstyle='round,pad=0.4', fc='#f1f8e9', ec='#81c784'))
plt.savefig('/home/daytona/workspace/path-study-plan/diag4_adaptations.png', dpi=150, bbox_inches='tight')
plt.close()
print("Diagram 4 saved")
print("\nAll 4 diagrams saved successfully!")
python /home/daytona/workspace/path-study-plan/day1_diagrams.py




Continue with Day 2 - Types of Necrosis now task agin
~/path-study-plan/day2_necrosis_diagrams.py
import matplotlib.pyplot as plt
import matplotlib.patches as mpatches
from matplotlib.patches import FancyBboxPatch, Circle, Ellipse, FancyArrowPatch
import numpy as np
# ─────────────────────────────────────────────────────────────────
# DIAGRAM 1: Nuclear changes in Necrosis (Pyknosis → Karyorrhexis → Karyolysis)
# ─────────────────────────────────────────────────────────────────
fig1, ax = plt.subplots(figsize=(13, 5))
ax.set_xlim(0, 13)
ax.set_ylim(0, 5)
ax.axis('off')
ax.set_facecolor('#f8f9ff')
fig1.patch.set_facecolor('#f8f9ff')
ax.text(6.5, 4.7, 'DIAGRAM 1: Nuclear Changes in Necrosis', fontsize=13,
fontweight='bold', ha='center', color='#1a237e')
# Step 1 - Normal nucleus
step_x = [1.5, 4.5, 7.5, 10.5]
labels = ['NORMAL\nNUCLEUS', 'PYKNOSIS\n(Shrinks + darkens)', 'KARYORRHEXIS\n(Fragments)', 'KARYOLYSIS\n(Dissolves/fades)']
colors_nuc = ['#90caf9', '#7b1fa2', '#c62828', '#bdbdbd']
ec_colors = ['#1565c0', '#4a148c', '#b71c1c', '#757575']
descriptions = [
'Round, pale\nblue nucleus\n(normal)',
'Nucleus shrinks\nbecomes dark\n& small',
'Dark nucleus\nbreaks into\nsmall pieces',
'Nucleus fades\ncompletely\nghost outline'
]
for i, (x, lbl, fc, ec, desc) in enumerate(zip(step_x, labels, colors_nuc, ec_colors, descriptions)):
# Cell body
cell = Circle((x, 2.5), 1.1, fc='#e3f2fd', ec='#90a4ae', lw=1.5)
ax.add_patch(cell)
if i == 0: # normal
nuc = Circle((x, 2.5), 0.55, fc='#90caf9', ec='#1565c0', lw=2)
ax.add_patch(nuc)
elif i == 1: # pyknosis
nuc = Circle((x, 2.5), 0.3, fc='#4a148c', ec='#311b92', lw=2)
ax.add_patch(nuc)
elif i == 2: # karyorrhexis
for angle in [0, 72, 144, 216, 288]:
rad = np.radians(angle)
fx = x + 0.38 * np.cos(rad)
fy = 2.5 + 0.38 * np.sin(rad)
frag = Circle((fx, fy), 0.14, fc='#c62828', ec='#b71c1c', lw=1)
ax.add_patch(frag)
elif i == 3: # karyolysis
nuc = Circle((x, 2.5), 0.55, fc='#eeeeee', ec='#bdbdbd', lw=1.5, alpha=0.4)
ax.add_patch(nuc)
ax.text(x, 1.1, lbl, ha='center', va='center', fontsize=8.5,
fontweight='bold', color=ec, linespacing=1.4)
ax.text(x, 0.25, desc, ha='center', va='center', fontsize=7.5,
color='#37474f', linespacing=1.3,
bbox=dict(boxstyle='round,pad=0.2', fc='white', ec='#cfd8dc', alpha=0.8))
if i < 3:
ax.annotate('', xy=(step_x[i+1] - 1.2, 2.5), xytext=(x + 1.2, 2.5),
arrowprops=dict(arrowstyle='->', color='#f57f17', lw=2.2))
ax.text(6.5, -0.2,
'✏ Draw tip: 4 cells in a row. 1) Blue circle = normal nucleus. 2) Tiny dark dot = pyknosis. 3) 4-5 tiny dots scattered = karyorrhexis. 4) Faint ghost circle = karyolysis.',
ha='center', fontsize=8.5, color='#1b5e20',
bbox=dict(boxstyle='round,pad=0.3', fc='#f1f8e9', ec='#81c784'))
plt.tight_layout()
plt.savefig('/home/daytona/workspace/path-study-plan/nec_diag1_nuclear.png', dpi=150, bbox_inches='tight')
plt.close()
print("Nuclear changes diagram saved")
# ─────────────────────────────────────────────────────────────────
# DIAGRAM 2: 6 Types of Necrosis - tissue appearance diagrams
# ─────────────────────────────────────────────────────────────────
fig2, axes = plt.subplots(2, 3, figsize=(15, 10))
fig2.patch.set_facecolor('#f8f9ff')
fig2.suptitle('DIAGRAM 2: Six Types of Necrosis - How They Look', fontsize=14,
fontweight='bold', color='#1a237e', y=1.01)
types = [
('COAGULATIVE', '#fff3e0', '#e65100'),
('LIQUEFACTIVE', '#e3f2fd', '#1565c0'),
('CASEOUS', '#fce4ec', '#880e4f'),
('FAT', '#f3e5f5', '#6a1b9a'),
('FIBRINOID', '#e8f5e9', '#2e7d32'),
('GANGRENOUS', '#efebe9', '#4e342e'),
]
for idx, (ax2, (title, bg, ec2)) in enumerate(zip(axes.flat, types)):
ax2.set_xlim(0, 10)
ax2.set_ylim(0, 10)
ax2.axis('off')
ax2.set_facecolor(bg)
ax2.set_title(title + ' NECROSIS', fontsize=11, fontweight='bold', color=ec2, pad=8)
rng = np.random.RandomState(idx * 7)
if idx == 0: # COAGULATIVE - ghost cells, outlines preserved
# Grid of ghost cells - outlines visible, no nucleus
for row in range(3):
for col in range(4):
cx = 1.5 + col * 2.2
cy = 2.5 + row * 2.4
cell = Circle((cx, cy), 0.7, fc='#ffe0b2', ec='#e65100', lw=1.5)
ax2.add_patch(cell)
# Ghost nucleus - faint outline only
ax2.add_patch(Circle((cx, cy), 0.3, fc='none', ec='#ffcc80', lw=1, alpha=0.5))
ax2.text(5, 0.8, 'Ghost cells: outlines PRESERVED\nbut nuclei GONE',
ha='center', fontsize=9, color=ec2, fontweight='bold',
bbox=dict(boxstyle='round', fc='white', ec=ec2, alpha=0.8))
ax2.text(5, 9.3, 'Ex: MI, Renal infarct', ha='center', fontsize=9,
color='#37474f', style='italic')
elif idx == 1: # LIQUEFACTIVE - fluid-filled cavity
# Large irregular cavity (pus/liquid)
cavity_x = [2, 1.5, 1.8, 2.5, 4, 6, 7.5, 8, 7.8, 6.5, 5, 3.5, 2.5, 2]
cavity_y = [5, 6, 7.5, 8.5, 8.8, 8.5, 7.5, 6, 4.5, 3.5, 3.2, 3.5, 4.5, 5]
ax2.fill(cavity_x, cavity_y, fc='#bbdefb', ec='#1565c0', lw=2)
# Pus dots inside
for _ in range(18):
px = rng.uniform(2.5, 7)
py = rng.uniform(4, 8)
ax2.add_patch(Circle((px, py), 0.18, fc='#1565c0', ec='#0d47a1', alpha=0.6))
# Surrounding normal tissue
for gx, gy in [(0.8, 2), (0.8, 8), (9, 2), (9, 8)]:
ax2.add_patch(Circle((gx, gy), 0.5, fc='#e3f2fd', ec='#90caf9', lw=1))
ax2.text(5, 0.8, 'Liquefied cavity filled with\npus / fluid (ABSCESS)',
ha='center', fontsize=9, color=ec2, fontweight='bold',
bbox=dict(boxstyle='round', fc='white', ec=ec2, alpha=0.8))
ax2.text(5, 9.3, 'Ex: Brain infarct, Abscess', ha='center', fontsize=9,
color='#37474f', style='italic')
elif idx == 2: # CASEOUS - cheese-like central area + granuloma ring
# Central caseous area (amorphous pink)
caseax = [3, 2.5, 2.8, 3.5, 5, 6.5, 7.2, 7, 6, 4.5, 3.5, 3]
caseay = [5, 6, 7.2, 8, 8.3, 8, 7, 5.8, 4.8, 4.5, 4.8, 5]
ax2.fill(caseax, caseay, fc='#f8bbd0', ec='#880e4f', lw=1.5, alpha=0.8)
ax2.text(5, 6.5, 'CASEOUS\nDEBRIS\n(cheese-like)', ha='center',
fontsize=9, fontweight='bold', color='#880e4f')
# Granuloma - ring of macrophages around
for angle in range(0, 360, 30):
rad = np.radians(angle)
mx = 5 + 2.8 * np.cos(rad)
my = 6.5 + 2.2 * np.sin(rad)
if 1.5 < mx < 8.5 and 1.5 < my < 9:
ax2.add_patch(Circle((mx, my), 0.38, fc='#f06292', ec='#880e4f', lw=1))
ax2.text(5, 0.8, 'Amorphous debris + Granuloma ring\n(no cell outlines preserved)',
ha='center', fontsize=9, color=ec2, fontweight='bold',
bbox=dict(boxstyle='round', fc='white', ec=ec2, alpha=0.8))
ax2.text(5, 9.3, 'Ex: Tuberculosis (TB)', ha='center', fontsize=9,
color='#37474f', style='italic')
elif idx == 3: # FAT - chalky white deposits
# Fat cells (large adipocytes - big clear circles)
fat_positions = [(2.5,7),(4.5,7.5),(6.5,7),(8,6.5),(1.8,5),(3.5,5.5),(5.5,5),(7.5,5),
(2,3),(4,3.5),(6,3),(8,3.5)]
for fx2, fy2 in fat_positions:
fat_cell = Circle((fx2, fy2), 0.75, fc='#e1bee7', ec='#6a1b9a', lw=1.5)
ax2.add_patch(fat_cell)
# Chalky calcium deposit (white with blue border = saponification)
ax2.add_patch(Circle((fx2 + rng.uniform(-0.2, 0.2), fy2 + rng.uniform(-0.2, 0.2)),
0.3, fc='white', ec='#4a148c', lw=2))
ax2.text(5, 0.8, 'Fat cells with chalky Ca²⁺ deposits\n(Saponification)',
ha='center', fontsize=9, color=ec2, fontweight='bold',
bbox=dict(boxstyle='round', fc='white', ec=ec2, alpha=0.8))
ax2.text(5, 9.3, 'Ex: Acute pancreatitis', ha='center', fontsize=9,
color='#37474f', style='italic')
elif idx == 4: # FIBRINOID - vessel wall
# Blood vessel cross section
# Outer vessel wall
outer = Circle((5, 5.5), 3.5, fc='none', ec='#2e7d32', lw=2.5)
ax2.add_patch(outer)
# FIBRINOID material in wall (bright pink ring)
fibrin_ring = Circle((5, 5.5), 3.5, fc='none', ec='#a5d6a7', lw=12, alpha=0.6)
ax2.add_patch(fibrin_ring)
# Inner lumen
inner = Circle((5, 5.5), 2.0, fc='#ffcdd2', ec='#e57373', lw=1.5)
ax2.add_patch(inner)
ax2.text(5, 5.5, 'LUMEN', ha='center', va='center', fontsize=9,
color='#c62828', fontweight='bold')
# Label arrows
ax2.annotate('', xy=(5, 8.8), xytext=(5, 8.3),
arrowprops=dict(arrowstyle='->', color='#2e7d32', lw=1.5))
ax2.text(5, 9.2, 'FIBRINOID (pink) in wall', ha='center', fontsize=8.5,
color='#2e7d32', fontweight='bold')
ax2.text(5, 0.8, 'Bright pink amorphous material\nin vessel WALL',
ha='center', fontsize=9, color=ec2, fontweight='bold',
bbox=dict(boxstyle='round', fc='white', ec=ec2, alpha=0.8))
ax2.text(5, 9.5, 'Ex: Malignant HTN, Vasculitis', ha='center', fontsize=8,
color='#37474f', style='italic')
elif idx == 5: # GANGRENOUS
# Limb cross-section
# Dead black tissue (dry gangrene zone)
dry_xs = [1, 1.5, 2.5, 3.5, 4.5, 5, 5, 4.5, 3.5, 2.5, 1.5, 1]
dry_ys = [3, 2, 1.5, 1.8, 2, 3, 7, 8, 8.2, 8, 7.5, 7]
ax2.fill(dry_xs, dry_ys, fc='#3e2723', ec='#1a0000', lw=2, label='Dry (coagulative)')
ax2.text(2.8, 5, 'DRY\n(BLACK)\nDead', ha='center', fontsize=8.5,
color='white', fontweight='bold')
# Wet zone - liquefactive (green/grey)
wet_xs = [5, 5.5, 6.5, 7.5, 8.5, 9, 9, 8.5, 7.5, 6.5, 5.5, 5]
wet_ys = [3, 2, 1.8, 2, 2.5, 3, 7, 7.5, 8, 8, 7.5, 7]
ax2.fill(wet_xs, wet_ys, fc='#795548', ec='#4e342e', lw=2, alpha=0.85)
ax2.text(7.2, 5, 'WET\n(+bacteria)\nPus', ha='center', fontsize=8.5,
color='white', fontweight='bold')
# Demarcation line
ax2.plot([5, 5], [1.5, 9], color='#f57f17', lw=3, linestyle='--')
ax2.text(5, 9.3, '← Line of demarcation →', ha='center', fontsize=8.5,
color='#f57f17', fontweight='bold')
ax2.text(5, 0.5, 'Dry = Coagulative | Wet = Coagulative + Liquefactive',
ha='center', fontsize=8.5, color=ec2, fontweight='bold',
bbox=dict(boxstyle='round', fc='white', ec=ec2, alpha=0.8))
plt.tight_layout(pad=1.5)
note_ax = fig2.add_axes([0.05, -0.05, 0.9, 0.04])
note_ax.axis('off')
note_ax.text(0.5, 0.5,
'✏ Draw tip: Each box = one type. Coagulative = cells with outlines but no nucleus. Liquefactive = empty cavity with dots. Caseous = amorphous blob with ring around. Fat = circles with white dot. Fibrinoid = vessel cross-section. Gangrenous = two halves.',
ha='center', va='center', fontsize=8.5, color='#1b5e20',
bbox=dict(boxstyle='round,pad=0.3', fc='#f1f8e9', ec='#81c784'))
plt.savefig('/home/daytona/workspace/path-study-plan/nec_diag2_types.png', dpi=150, bbox_inches='tight')
plt.close()
print("Types of necrosis diagram saved")
# ─────────────────────────────────────────────────────────────────
# DIAGRAM 3: Coagulative necrosis - before/after tissue (most important)
# ─────────────────────────────────────────────────────────────────
fig3, axes3 = plt.subplots(1, 2, figsize=(12, 6))
fig3.patch.set_facecolor('#f8f9ff')
fig3.suptitle('DIAGRAM 3: Coagulative Necrosis - Normal Tissue vs Infarcted',
fontsize=13, fontweight='bold', color='#1a237e', y=1.02)
# NORMAL tissue
ax_n = axes3[0]
ax_n.set_xlim(0, 10)
ax_n.set_ylim(0, 10)
ax_n.axis('off')
ax_n.set_facecolor('#e3f2fd')
ax_n.set_title('NORMAL TISSUE', fontsize=11, fontweight='bold', color='#1565c0', pad=6)
rng2 = np.random.RandomState(1)
for row in range(4):
for col in range(4):
cx = 1.5 + col * 2.1
cy = 1.5 + row * 2.1
ax_n.add_patch(Circle((cx, cy), 0.75, fc='#90caf9', ec='#1565c0', lw=1.5))
ax_n.add_patch(Circle((cx, cy), 0.35, fc='#1a237e', ec='#0d47a1', lw=1))
ax_n.text(5, 0.3, 'Normal cells: intact membrane + dark nucleus',
ha='center', fontsize=9, color='#1565c0',
bbox=dict(boxstyle='round', fc='white', ec='#90caf9'))
# COAGULATIVE NECROSIS tissue
ax_c = axes3[1]
ax_c.set_xlim(0, 10)
ax_c.set_ylim(0, 10)
ax_c.axis('off')
ax_c.set_facecolor('#fff3e0')
ax_c.set_title('COAGULATIVE NECROSIS\n(e.g. Renal / MI infarct)', fontsize=11,
fontweight='bold', color='#e65100', pad=6)
for row in range(4):
for col in range(4):
cx2 = 1.5 + col * 2.1
cy2 = 1.5 + row * 2.1
# Ghost cell - pale, outline preserved, NO nucleus
ax_c.add_patch(Circle((cx2, cy2), 0.75, fc='#ffe0b2', ec='#e65100', lw=1.5, alpha=0.7))
# NO nucleus (just faint ghost)
ax_c.add_patch(Circle((cx2, cy2), 0.32, fc='none', ec='#ffcc80', lw=0.8, alpha=0.4))
ax_c.text(5, 0.3, 'GHOST CELLS: Outline preserved, NO nucleus',
ha='center', fontsize=9, color='#e65100', fontweight='bold',
bbox=dict(boxstyle='round', fc='white', ec='#ffcc80'))
plt.tight_layout()
tip_ax = fig3.add_axes([0.05, -0.08, 0.9, 0.06])
tip_ax.axis('off')
tip_ax.text(0.5, 0.5,
'✏ Draw tip: Left side = normal cells (blue circles with dark nucleus). Right side = SAME shape cells (outlines intact) but NO nucleus inside = GHOST CELLS. This is the hallmark of coagulative necrosis.',
ha='center', va='center', fontsize=9, color='#1b5e20',
bbox=dict(boxstyle='round,pad=0.3', fc='#f1f8e9', ec='#81c784'))
plt.savefig('/home/daytona/workspace/path-study-plan/nec_diag3_coagulative.png', dpi=150, bbox_inches='tight')
plt.close()
print("Coagulative necrosis diagram saved")
# ─────────────────────────────────────────────────────────────────
# DIAGRAM 4: Caseous Necrosis + Granuloma (TB pattern - very important)
# ─────────────────────────────────────────────────────────────────
fig4, ax4 = plt.subplots(figsize=(9, 9))
ax4.set_xlim(0, 10)
ax4.set_ylim(0, 10)
ax4.axis('off')
ax4.set_facecolor('#fce4ec')
fig4.patch.set_facecolor('#fce4ec')
ax4.set_title('DIAGRAM 4: Caseous Necrosis with Granuloma (TB)\n',
fontsize=13, fontweight='bold', color='#880e4f', pad=8)
# Central caseous area
caseous = Ellipse((5, 5.5), 3.5, 2.8, fc='#f8bbd0', ec='#880e4f', lw=2.5)
ax4.add_patch(caseous)
ax4.text(5, 5.5, 'CASEOUS DEBRIS\n(Amorphous, granular\ncheeselike, pink)\nNO cell outlines',
ha='center', va='center', fontsize=9, color='#880e4f', fontweight='bold')
# Ring 1 - Epithelioid macrophages
for angle in range(0, 360, 22):
rad = np.radians(angle)
mx = 5 + 2.6 * np.cos(rad)
my = 5.5 + 2.2 * np.sin(rad)
# Epithelioid macrophage = elongated cell
mac = Ellipse((mx, my), 0.65, 0.4, angle=np.degrees(rad),
fc='#f48fb1', ec='#c2185b', lw=1.2)
ax4.add_patch(mac)
# Langhans giant cell (horseshoe nucleus)
lg_cell = Ellipse((5, 8.5), 2.2, 1.2, fc='#f06292', ec='#880e4f', lw=2)
ax4.add_patch(lg_cell)
# Horseshoe arrangement of nuclei
for angle in range(-60, 240, 30):
rad = np.radians(angle)
nx = 5 + 0.7 * np.cos(rad)
ny = 8.5 + 0.35 * np.sin(rad)
ax4.add_patch(Circle((nx, ny), 0.1, fc='#4a148c', ec='#311b92'))
ax4.text(5, 8.5, '', ha='center', va='center')
ax4.annotate('Langhans Giant Cell\n(horseshoe nuclei)',
xy=(5, 8.0), xytext=(7.5, 8.8),
fontsize=8.5, color='#4a148c', fontweight='bold',
arrowprops=dict(arrowstyle='->', color='#880e4f', lw=1.2))
# Ring 2 - Lymphocytes (outer ring)
for angle in range(10, 360, 18):
rad = np.radians(angle)
lx = 5 + 4.2 * np.cos(rad)
ly = 5.5 + 3.8 * np.sin(rad)
if 0.3 < lx < 9.7 and 0.3 < ly < 9.7:
ax4.add_patch(Circle((lx, ly), 0.22, fc='#7986cb', ec='#1a237e', lw=0.8))
# Labels
ax4.annotate('Epithelioid\nMacrophages',
xy=(7.4, 5.5), xytext=(8.5, 7.0),
fontsize=8.5, color='#c2185b', fontweight='bold',
arrowprops=dict(arrowstyle='->', color='#c2185b', lw=1.2))
ax4.annotate('Lymphocytes\n(outer ring)',
xy=(1.2, 5.5), xytext=(0.1, 2.5),
fontsize=8.5, color='#1a237e', fontweight='bold',
arrowprops=dict(arrowstyle='->', color='#1a237e', lw=1.2))
ax4.text(5, 0.7,
'✏ Draw tip: Big central blob = caseous area. Surround it with oval cells = epithelioid macrophages.\nOuter ring of small circles = lymphocytes. One big oval cell at top = Langhans giant cell with ring of nuclei.',
ha='center', fontsize=8.5, color='#1b5e20',
bbox=dict(boxstyle='round,pad=0.3', fc='#f1f8e9', ec='#81c784'))
plt.tight_layout()
plt.savefig('/home/daytona/workspace/path-study-plan/nec_diag4_caseous.png', dpi=150, bbox_inches='tight')
plt.close()
print("Caseous necrosis diagram saved")
print("\nAll necrosis diagrams saved!")
python /home/daytona/workspace/path-study-plan/day2_necrosis_diagrams.py
Cell Injury & Adaptation
~/path-study-plan/ci_diagrams.py
import matplotlib.pyplot as plt
import matplotlib.patches as mpatches
from matplotlib.patches import FancyBboxPatch, Circle, Ellipse
import numpy as np
out = '/home/daytona/workspace/path-study-plan/'
# ══════════════════════════════════════════════════════════
# DIAGRAM A: Causes of Cell Injury (spider/star layout)
# ══════════════════════════════════════════════════════════
fig, ax = plt.subplots(figsize=(10, 10))
ax.set_xlim(0,10); ax.set_ylim(0,10)
ax.axis('off'); ax.set_facecolor('#f0f4ff')
fig.patch.set_facecolor('#f0f4ff')
ax.text(5, 9.6, 'DIAGRAM A: Causes of Cell Injury', fontsize=14, fontweight='bold', ha='center', color='#1a237e')
# Central box
cx, cy = 5, 5
ax.add_patch(FancyBboxPatch((3.5,4.3),3,1.4, boxstyle='round,pad=0.2', fc='#1a237e', ec='#0d1b6e', lw=2))
ax.text(5, 5.05, 'CELL INJURY', ha='center', va='center', fontsize=13, fontweight='bold', color='white')
causes = [
('Hypoxia /\nIschemia', 5, 8.3, '#e57373', '#c62828'),
('Physical\nAgents', 2, 7.5, '#ff8a65', '#bf360c'),
('Chemical\nToxins', 0.7, 5.5, '#ffb74d', '#e65100'),
('Infectious\nAgents', 1.5, 2.8, '#81c784', '#2e7d32'),
('Immunologic\nReactions', 4, 1.3, '#4fc3f7', '#01579b'),
('Genetic\nDefects', 6, 1.3, '#ce93d8', '#6a1b9a'),
('Nutritional\nImbalance', 8.3, 2.8, '#f06292', '#880e4f'),
('Aging', 9.2, 5.5, '#a5d6a7', '#1b5e20'),
]
for label, bx, by, fc, ec in causes:
# Draw box
ax.add_patch(FancyBboxPatch((bx-1.1, by-0.45), 2.2, 0.9,
boxstyle='round,pad=0.15', fc=fc, ec=ec, lw=1.8))
lines = label.split('\n')
ax.text(bx, by+0.13, lines[0], ha='center', va='center', fontsize=9, fontweight='bold', color='#1a237e')
if len(lines) > 1:
ax.text(bx, by-0.22, lines[1], ha='center', va='center', fontsize=9, color='#1a237e')
# Arrow to center
dx = cx - bx; dy = cy - by
dist = np.sqrt(dx**2 + dy**2)
sx = bx + 1.15*(dx/dist); sy = by + 0.5*(dy/dist)
ex = cx - 1.6*(dx/dist); ey = cy - 0.75*(dy/dist)
ax.annotate('', xy=(ex,ey), xytext=(sx,sy),
arrowprops=dict(arrowstyle='->', color=ec, lw=1.8))
ax.text(5, 0.35, '✏ Draw: Central box "CELL INJURY" → 8 surrounding boxes with arrows pointing inward. Takes 2 min.',
ha='center', fontsize=9, color='#1b5e20',
bbox=dict(boxstyle='round,pad=0.3', fc='#f1f8e9', ec='#81c784'))
plt.tight_layout()
plt.savefig(out+'ci_A_causes.png', dpi=150, bbox_inches='tight')
plt.close()
print("A saved")
# ══════════════════════════════════════════════════════════
# DIAGRAM B: Sequence of Events (Healthy→Reversible→Irreversible→Death)
# with 3 cell drawings
# ══════════════════════════════════════════════════════════
fig, axes = plt.subplots(1, 4, figsize=(16, 7))
fig.patch.set_facecolor('#f0f4ff')
fig.suptitle('DIAGRAM B: Sequence of Cell Injury', fontsize=14, fontweight='bold', color='#1a237e', y=1.02)
panels = [
('NORMAL\nCELL', '#e3f2fd', '#1565c0'),
('REVERSIBLE\nINJURY', '#fff9c4', '#f57f17'),
('IRREVERSIBLE\nINJURY', '#ffccbc', '#bf360c'),
('CELL DEATH\n(Necrosis)', '#ffebee', '#c62828'),
]
for i, (ax2, (title, bg, ec)) in enumerate(zip(axes, panels)):
ax2.set_xlim(-5,5); ax2.set_ylim(-6,6)
ax2.axis('off'); ax2.set_facecolor(bg)
ax2.set_title(title, fontsize=11, fontweight='bold', color=ec, pad=6, linespacing=1.4)
if i == 0: # Normal - neat round
ax2.add_patch(Circle((0,0.5), 3.5, fc='#bbdefb', ec='#1565c0', lw=2.5))
ax2.add_patch(Circle((0,0.5), 1.3, fc='#3949ab', ec='#1a237e', lw=2)) # nucleus
ax2.text(0, 0.5, 'N', ha='center', va='center', fontsize=14, color='white', fontweight='bold')
# Mitochondria
for mx,my,ang in [(-2,1.5,30),(2,1.5,-20),(-2,-1,15),(2,-1,40)]:
ax2.add_patch(Ellipse((mx,my),1.1,0.5,angle=ang, fc='#ff8a65', ec='#e64a19', lw=1.2))
ax2.text(0,-4.5,'• Round cell\n• Intact membrane\n• Clear nucleus\n• Normal mitochondria',
ha='center', fontsize=8.5, color='#1565c0',
bbox=dict(boxstyle='round,pad=0.3',fc='white',ec='#90caf9'))
elif i == 1: # Reversible - swollen, blebs
ax2.add_patch(Circle((0,0.5), 4.0, fc='#fff9c4', ec='#f57f17', lw=2.5))
# Membrane blebs (bumps)
for ang in range(0,360,40):
r=np.radians(ang)
ax2.add_patch(Circle((4.0*np.cos(r), 0.5+4.0*np.sin(r)), 0.45, fc='#fff59d', ec='#f57f17', lw=1.2))
ax2.add_patch(Circle((0,0.5), 1.4, fc='#5e35b1', ec='#311b92', lw=2)) # nucleus clumped
ax2.text(0, 0.5, 'N', ha='center', va='center', fontsize=13, color='white', fontweight='bold')
# Vacuoles
for vx,vy in [(1.5,-0.8),(-1.5,-0.5),(0.5,2.2)]:
ax2.add_patch(Circle((vx,vy),0.5, fc='white', ec='#90a4ae', lw=1))
ax2.text(0,-4.5,'• SWOLLEN cell (↑ size)\n• Blebs on membrane\n• Vacuoles inside\n• Chromatin clumps',
ha='center', fontsize=8.5, color='#e65100',
bbox=dict(boxstyle='round,pad=0.3',fc='white',ec='#ffe082'))
elif i == 2: # Irreversible - very swollen, large deposits
ax2.add_patch(Circle((0,0.5), 4.2, fc='#ffccbc', ec='#bf360c', lw=2.5))
for ang in range(0,360,30):
r=np.radians(ang)
ax2.add_patch(Circle((4.0*np.cos(r), 0.5+4.0*np.sin(r)), 0.6, fc='#ffab91', ec='#bf360c', lw=1.2))
# Pyknotic nucleus (dark small)
ax2.add_patch(Circle((-0.3, 0.8), 0.7, fc='#4a148c', ec='#311b92', lw=1.5))
# Big amorphous mitochondrial deposits
for mx,my in [(-2,1.5),(2,1.5),(-1.8,-1.5),(2,-1)]:
ax2.add_patch(Ellipse((mx,my),1.3,0.7, fc='#ef9a9a', ec='#c62828', lw=1.5))
ax2.add_patch(Circle((mx,my), 0.3, fc='#c62828', ec='#b71c1c')) # large deposit inside
ax2.text(0,-4.5,'• Extremely swollen\n• Large mito deposits\n• Pyknotic nucleus\n• Membrane near rupture',
ha='center', fontsize=8.5, color='#bf360c',
bbox=dict(boxstyle='round,pad=0.3',fc='white',ec='#ef9a9a'))
elif i == 3: # Necrosis - broken, contents leaking
rng = np.random.RandomState(7)
angs = np.linspace(0,2*np.pi,20)
r_vals = 3.5 + 0.9*rng.randn(20); r_vals=np.clip(r_vals,2,4.5)
xs=r_vals*np.cos(angs); ys=0.5+r_vals*np.sin(angs)
ax2.fill(np.append(xs,xs[0]), np.append(ys,ys[0]), fc='#ffebee', ec='#c62828', lw=2, linestyle='--')
# Dissolved nucleus (ghost)
ax2.add_patch(Circle((0,0.5),0.9, fc='none', ec='#bdbdbd', lw=1, alpha=0.4))
# Leaking dots
for lx,ly in [(-4.8,1.5),(4.8,0),(0,-5.3),(4,3),(-4,3),(-3,-3.5),(3.5,-3)]:
ax2.plot(lx,ly,'o',color='#e53935',markersize=6)
# Inflammatory cells
for fx,fy in [(-4.5,-4),(4.5,-4),(0,5.3)]:
ax2.add_patch(Circle((fx,fy),0.55,fc='#ef9a9a',ec='#c62828',lw=1.2))
ax2.text(0,-4.5,'• Broken membrane\n• Contents LEAK out\n• No nucleus\n• Inflammation',
ha='center', fontsize=8.5, color='#c62828',
bbox=dict(boxstyle='round,pad=0.3',fc='white',ec='#ef9a9a'))
# Add arrows between panels
for i in range(3):
fig.add_artist(mpatches.FancyArrowPatch(
posA=((i+1)*0.25+0.01, 0.5), posB=((i+1)*0.25+0.23, 0.5),
arrowstyle='->', color='#f57f17', lw=2.5,
transform=fig.transFigure, mutation_scale=20))
tip = fig.add_axes([0.05,-0.07,0.9,0.05]); tip.axis('off')
tip.text(0.5,0.5,'✏ Draw: 4 circles in a row. 1=neat circle. 2=bigger circle+bumps on edge+small vacuoles inside. 3=very large circle+bumps+small dark dot nucleus+dark dots in mitochondria. 4=jagged broken circle+dots leaking outside.',
ha='center',va='center',fontsize=9,color='#1b5e20',
bbox=dict(boxstyle='round,pad=0.3',fc='#f1f8e9',ec='#81c784'))
plt.tight_layout()
plt.savefig(out+'ci_B_sequence.png', dpi=150, bbox_inches='tight')
plt.close()
print("B saved")
# ══════════════════════════════════════════════════════════
# DIAGRAM C: Mechanisms of Irreversible Cell Injury (5-step cascade)
# ══════════════════════════════════════════════════════════
fig, ax = plt.subplots(figsize=(10,12))
ax.set_xlim(0,10); ax.set_ylim(0,13)
ax.axis('off'); ax.set_facecolor('#fff8f0')
fig.patch.set_facecolor('#fff8f0')
ax.text(5,12.6,'DIAGRAM C: Mechanisms of Irreversible Cell Injury',
fontsize=13,fontweight='bold',ha='center',color='#1a237e')
ax.text(5,12.1,'(Sequence that leads to cell death)',
fontsize=10,ha='center',color='#37474f',style='italic')
steps = [
(5, 11.0, 'HYPOXIA / ISCHEMIA\n(or other injurious stimulus)', '#e3f2fd','#1565c0'),
(5, 9.3, '↓ ATP (Mitochondrial failure)', '#fff9c4','#f57f17'),
(5, 7.6, '↓ Na⁺/K⁺ ATPase pump\n→ Na⁺ & water enter cell', '#fff3e0','#e65100'),
(5, 5.9, '↑ Intracellular Ca²⁺\n(activates ATPases, proteases,\nphospholipases, endonucleases)', '#fce4ec','#880e4f'),
(5, 3.8, 'Free Radical (ROS) injury\n(Lipid peroxidation of membranes)', '#f3e5f5','#6a1b9a'),
(5, 2.0, 'MEMBRANE DAMAGE\n→ Cell contents leak → NECROSIS', '#ffebee','#c62828'),
]
bw, bh = 6.5, 0.95
for sx, sy, label, fc, ec in steps:
ax.add_patch(FancyBboxPatch((sx-bw/2, sy-bh/2), bw, bh,
boxstyle='round,pad=0.15', fc=fc, ec=ec, lw=2))
lines = label.split('\n')
total = len(lines)
for li, line in enumerate(lines):
yoff = 0.2*(total-1)/2 - 0.2*li
ax.text(sx, sy+yoff, line, ha='center', va='center', fontsize=9.5, color='#1a237e',
fontweight='bold' if li==0 else 'normal')
# Side annotations
annotations = [
(5,10.15, '↓ Oxidative phosphorylation', '#f57f17'),
(5, 8.45, '→ Cell SWELLING + ER dilation', '#e65100'),
(5, 6.85, '→ Cytoskeletal disruption,\n lysosome activation', '#880e4f'),
(5, 4.85, '→ DNA damage, protein damage', '#6a1b9a'),
]
for ix in range(len(steps)-1):
y_from = steps[ix][1] - bh/2
y_to = steps[ix+1][1] + bh/2
ax.annotate('', xy=(5, y_to+0.05), xytext=(5, y_from-0.05),
arrowprops=dict(arrowstyle='->', color='#f57f17', lw=2.5))
# Side note box
ax.add_patch(FancyBboxPatch((7.2, 3.5), 2.5, 5.5,
boxstyle='round,pad=0.2', fc='#fff3e0', ec='#ff8f00', lw=1.5))
ax.text(8.45, 9.2, 'KEY\nACTIVATED\nENZYMES', ha='center', fontsize=9, fontweight='bold', color='#e65100')
enzymes = ['ATPases\n(↓ ATP)', 'Phospholipases\n(membrane damage)', 'Proteases\n(cytoskeleton)',
'Endonucleases\n(DNA fragmentation)']
for ei, enz in enumerate(enzymes):
ax.text(8.45, 8.5 - ei*1.2, enz, ha='center', fontsize=8, color='#bf360c')
ax.annotate('', xy=(7.2, 6.5), xytext=(6.7, 6.0),
arrowprops=dict(arrowstyle='->', color='#880e4f', lw=1.5))
ax.text(5, 0.5,
'✏ Draw: 6 boxes top to bottom with arrows. Trigger → ↓ATP → Cell swelling → ↑Ca²⁺ → Free radicals → Membrane damage.',
ha='center', fontsize=9, color='#1b5e20',
bbox=dict(boxstyle='round,pad=0.3', fc='#f1f8e9', ec='#81c784'))
plt.tight_layout()
plt.savefig(out+'ci_C_mechanisms.png', dpi=150, bbox_inches='tight')
plt.close()
print("C saved")
# ══════════════════════════════════════════════════════════
# DIAGRAM D: Apoptosis Pathways (Intrinsic + Extrinsic → Caspase-3)
# ══════════════════════════════════════════════════════════
fig, ax = plt.subplots(figsize=(12, 11))
ax.set_xlim(0,12); ax.set_ylim(0,12)
ax.axis('off'); ax.set_facecolor('#f1f8e9')
fig.patch.set_facecolor('#f1f8e9')
ax.text(6,11.6,'DIAGRAM D: Apoptosis - Two Pathways', fontsize=14,fontweight='bold',ha='center',color='#1a237e')
def box(ax,x,y,w,h,text,fc,ec,fs=9):
ax.add_patch(FancyBboxPatch((x-w/2,y-h/2),w,h, boxstyle='round,pad=0.12',fc=fc,ec=ec,lw=1.8))
lines=text.split('\n'); n=len(lines)
for i,l in enumerate(lines):
yoff=0.18*(n-1)/2-0.18*i
ax.text(x,y+yoff,l,ha='center',va='center',fontsize=fs,color='#1a237e',
fontweight='bold' if i==0 else 'normal')
def arr(ax,x1,y1,x2,y2,col='#f57f17',lw=2):
ax.annotate('',xy=(x2,y2),xytext=(x1,y1),arrowprops=dict(arrowstyle='->',color=col,lw=lw))
# ─ INTRINSIC (left column) ─
ax.text(3,10.8,'INTRINSIC PATHWAY\n(Mitochondrial)',ha='center',fontsize=11,fontweight='bold',color='#1565c0')
intrinsic = [
(3,10.0,'DNA damage\nHypoxia / Toxins', '#e3f2fd','#1565c0'),
(3, 8.6,'↑ p53 activation', '#e8eaf6','#3949ab'),
(3, 7.3,'↑ BAX / ↓ BCL-2\n(pro-apoptotic wins)', '#c5cae9','#1a237e'),
(3, 6.0,'Cytochrome c\nrelease from mito', '#bbdefb','#1565c0'),
(3, 4.8,'Caspase-9\nactivation', '#90caf9','#0d47a1'),
]
for ix, (x,y,t,fc,ec) in enumerate(intrinsic):
box(ax,x,y,4.5,0.85,t,fc,ec)
if ix < len(intrinsic)-1:
arr(ax,x,y-0.42,x,intrinsic[ix+1][1]+0.42,'#1565c0')
# ─ EXTRINSIC (right column) ─
ax.text(9,10.8,'EXTRINSIC PATHWAY\n(Death receptor)',ha='center',fontsize=11,fontweight='bold',color='#2e7d32')
extrinsic = [
(9,10.0,'Fas-Ligand / TNF\nbinds receptor', '#e8f5e9','#2e7d32'),
(9, 8.6,'FADD adaptor\nprotein recruited', '#c8e6c9','#388e3c'),
(9, 7.3,'Caspase-8\nactivation', '#a5d6a7','#2e7d32'),
]
for ix,(x,y,t,fc,ec) in enumerate(extrinsic):
box(ax,x,y,4.5,0.85,t,fc,ec)
if ix < len(extrinsic)-1:
arr(ax,x,y-0.42,x,extrinsic[ix+1][1]+0.42,'#2e7d32')
# ─ Converge to Caspase-3 ─
ax.annotate('',xy=(6,3.5),xytext=(3,4.37),
arrowprops=dict(arrowstyle='->',color='#1565c0',lw=2.5))
ax.annotate('',xy=(6,3.5),xytext=(9,6.87),
arrowprops=dict(arrowstyle='->',color='#2e7d32',lw=2.5))
box(ax,6,3.0,5,0.9,'CASPASE-3\n(Effector / Executioner)','#ffccbc','#bf360c',fs=10)
arr(ax,6,2.55,6,2.05,'#c62828',lw=2.5)
box(ax,6,1.5,5,0.9,'APOPTOSIS','#c62828','#b71c1c',fs=12)
ax.text(6,1.5,'APOPTOSIS',ha='center',va='center',fontsize=14,fontweight='bold',color='white')
ax.text(6,0.4,
'✏ Draw: Two columns. Left = Intrinsic (4 steps down). Right = Extrinsic (3 steps down). Both arrows meet at "Caspase-3" box. Then one arrow down to "APOPTOSIS".',
ha='center',fontsize=9,color='#1b5e20',
bbox=dict(boxstyle='round,pad=0.3',fc='#f1f8e9',ec='#81c784'))
plt.tight_layout()
plt.savefig(out+'ci_D_apoptosis.png', dpi=150, bbox_inches='tight')
plt.close()
print("D saved")
# ══════════════════════════════════════════════════════════
# DIAGRAM E: Cell Adaptations - 5 types with simple drawings
# ══════════════════════════════════════════════════════════
fig, axes = plt.subplots(1, 5, figsize=(18,7))
fig.patch.set_facecolor('#f8f9ff')
fig.suptitle('DIAGRAM E: Cell Adaptations to Stress', fontsize=14,fontweight='bold',color='#1a237e',y=1.02)
adapt_info = [
('HYPERTROPHY', '#e3f2fd','#1565c0', '↑ cell SIZE\nSame number\nEx: Heart in HTN'),
('HYPERPLASIA', '#e8f5e9','#2e7d32', '↑ cell NUMBER\nEx: Endometrial\nhyperplasia'),
('ATROPHY', '#fff9c4','#f57f17', '↓ cell size\n+ function\nEx: Muscle wasting'),
('METAPLASIA', '#fce4ec','#880e4f', 'One type →\nanother\nEx: Smoker bronchi'),
('DYSPLASIA', '#f3e5f5','#6a1b9a', 'Disordered growth\nPre-malignant!\nEx: CIN (cervix)'),
]
for idx,(ax2,(title,bg,ec,note)) in enumerate(zip(axes,adapt_info)):
ax2.set_xlim(0,10); ax2.set_ylim(0,10)
ax2.axis('off'); ax2.set_facecolor(bg)
ax2.set_title(title,fontsize=10,fontweight='bold',color=ec,pad=6)
if idx==0: # Hypertrophy: 1 small → 1 BIG
ax2.add_patch(Circle((2.5,6),1.0, fc='#bbdefb',ec='#1565c0',lw=1.5))
ax2.add_patch(Circle((2.5,6),0.45,fc='#3949ab',ec='#1a237e',lw=1))
ax2.text(2.5,4.5,'BEFORE\n(small)',ha='center',fontsize=8.5,color='#1565c0')
ax2.annotate('',xy=(6,6),xytext=(4.2,6),arrowprops=dict(arrowstyle='->',color=ec,lw=2.2))
ax2.add_patch(Circle((8,6),1.9, fc='#1565c0',ec='#0d47a1',lw=2))
ax2.add_patch(Circle((8,6),0.7, fc='white',ec='white',lw=1))
ax2.text(8,3.5,'AFTER\n(BIGGER ↑)',ha='center',fontsize=8.5,color='#0d47a1',fontweight='bold')
elif idx==1: # Hyperplasia: 3 → 8 cells
for cy2 in [4.5,6.5,8.5]:
ax2.add_patch(Circle((2.5,cy2),0.6,fc='#c8e6c9',ec='#2e7d32',lw=1.5))
ax2.add_patch(Circle((2.5,cy2),0.25,fc='#388e3c',ec='#1b5e20',lw=1))
ax2.text(2.5,3.0,'BEFORE\n(3 cells)',ha='center',fontsize=8.5,color='#2e7d32')
ax2.annotate('',xy=(5,6),xytext=(4,6),arrowprops=dict(arrowstyle='->',color=ec,lw=2.2))
for cx3,cy3 in [(6.5,4),(8.5,4),(6.5,6),(8.5,6),(6.5,8),(8.5,8),(7.5,5),(7.5,7)]:
ax2.add_patch(Circle((cx3,cy3),0.55,fc='#2e7d32',ec='#1b5e20',lw=1.2))
ax2.add_patch(Circle((cx3,cy3),0.22,fc='white',ec='white'))
ax2.text(7.5,2.5,'AFTER\n(MORE cells ↑)',ha='center',fontsize=8.5,color='#1b5e20',fontweight='bold')
elif idx==2: # Atrophy: big → small, faded
ax2.add_patch(Circle((2.5,6),1.8,fc='#fff176',ec='#f57f17',lw=2))
ax2.add_patch(Circle((2.5,6),0.75,fc='#f57f17',ec='#e65100',lw=1.5))
ax2.text(2.5,3.5,'BEFORE\n(normal)',ha='center',fontsize=8.5,color='#e65100')
ax2.annotate('',xy=(5.5,6),xytext=(4.5,6),arrowprops=dict(arrowstyle='->',color=ec,lw=2.2))
ax2.add_patch(Circle((7.5,6),0.9,fc='#fff9c4',ec='#f57f17',lw=1.5,alpha=0.6))
ax2.add_patch(Circle((7.5,6),0.35,fc='#e65100',ec='#bf360c',lw=1,alpha=0.7))
ax2.text(7.5,3.5,'AFTER\n(small, faded ↓)',ha='center',fontsize=8.5,color='#bf360c',fontweight='bold')
elif idx==3: # Metaplasia: tall cells → flat cells
for cx4 in [1,2.5,4]:
ax2.add_patch(FancyBboxPatch((cx4-0.35,4),0.7,3.5,boxstyle='round,pad=0.05',
fc='#f8bbd0',ec='#880e4f',lw=1.5))
ax2.add_patch(Circle((cx4,5.75),0.35,fc='#880e4f',ec='#880e4f'))
ax2.text(2.5,3.0,'Columnar\n(tall cells)',ha='center',fontsize=8.5,color='#880e4f')
ax2.annotate('',xy=(5.8,6),xytext=(4.8,6),arrowprops=dict(arrowstyle='->',color=ec,lw=2.2))
for ry in [4.5,5.5,6.5,7.5]:
ax2.add_patch(FancyBboxPatch((6,ry),3.5,0.7,boxstyle='round,pad=0.05',
fc='#e91e63',ec='#880e4f',lw=1.2,alpha=0.85))
ax2.text(7.75,3.0,'Squamous\n(flat cells)',ha='center',fontsize=8.5,color='#880e4f',fontweight='bold')
elif idx==4: # Dysplasia: irregular, variable sizes
# Normal cells left
for cx5,cy5 in [(1.5,5),(2.5,7),(2,3)]:
ax2.add_patch(Circle((cx5,cy5),0.6,fc='#e1bee7',ec='#6a1b9a',lw=1.2))
ax2.add_patch(Circle((cx5,cy5),0.25,fc='#6a1b9a',ec='#4a148c',lw=1))
ax2.text(2,1.8,'Normal',ha='center',fontsize=8.5,color='#6a1b9a')
ax2.annotate('',xy=(5,5.5),xytext=(3.8,5.5),arrowprops=dict(arrowstyle='->',color=ec,lw=2.2))
# Dysplastic - irregular sizes, dark nuclei
rng2=np.random.RandomState(3)
for cx6,cy6 in [(6,8),(7.5,7),(8.5,5.5),(6.5,4.5),(8,3.5),(7,6),(9,7.5)]:
r2=rng2.uniform(0.4,1.1)
ax2.add_patch(Circle((cx6,cy6),r2,fc='#ce93d8',ec='#6a1b9a',lw=1.5))
ax2.add_patch(Circle((cx6,cy6),r2*0.55,fc='#4a148c',ec='#311b92',lw=1))
ax2.text(7.5,1.8,'Dysplastic\n(irregular!)',ha='center',fontsize=8.5,color='#4a148c',fontweight='bold')
ax2.text(5,0.8,note,ha='center',fontsize=8.5,color=ec,
bbox=dict(boxstyle='round,pad=0.3',fc='white',ec=ec,alpha=0.9))
tip2=fig.add_axes([0.03,-0.08,0.94,0.05]); tip2.axis('off')
tip2.text(0.5,0.5,'✏ Draw: 5 boxes side by side. Hypertrophy=small→big circle. Hyperplasia=few→many circles. Atrophy=big faded→small faded. Metaplasia=tall rectangles→flat rectangles. Dysplasia=irregular sizes+big dark nuclei.',
ha='center',va='center',fontsize=9,color='#1b5e20',
bbox=dict(boxstyle='round,pad=0.3',fc='#f1f8e9',ec='#81c784'))
plt.tight_layout()
plt.savefig(out+'ci_E_adaptations.png', dpi=150, bbox_inches='tight')
plt.close()
print("E saved")
# ══════════════════════════════════════════════════════════
# DIAGRAM F: Apoptosis vs Necrosis (cell comparison side by side)
# ══════════════════════════════════════════════════════════
fig, axes = plt.subplots(1,2,figsize=(13,8))
fig.patch.set_facecolor('#f8f9ff')
fig.suptitle('DIAGRAM F: Apoptosis vs Necrosis – Cell Appearance',fontsize=14,fontweight='bold',color='#1a237e',y=1.02)
for i,ax3 in enumerate(axes):
ax3.set_xlim(-6,6); ax3.set_ylim(-7,7)
ax3.axis('off')
if i==0: # APOPTOSIS
ax3.set_facecolor('#e8f5e9')
ax3.set_title('APOPTOSIS',fontsize=13,fontweight='bold',color='#1b5e20',pad=8)
# Shrunken cell
ax3.add_patch(Circle((0,1),2.8,fc='#a5d6a7',ec='#2e7d32',lw=2.5))
# Dense condensed nucleus (crescent)
ax3.add_patch(Ellipse((0,1),2.0,1.3,fc='#1b5e20',ec='#003300',lw=1.5))
# Blebs all around
for ang in range(0,360,45):
r=np.radians(ang)
ax3.add_patch(Circle((2.8*np.cos(r), 1+2.8*np.sin(r)),0.4,fc='#c8e6c9',ec='#2e7d32',lw=1))
ax3.text(0,1,'','ha','center')
# Apoptotic bodies scattered below
for bx4,by4 in [(-3,-3),(0,-3.5),(3,-3),(-1.5,-4.5),(1.5,-4.5)]:
ax3.add_patch(Circle((bx4,by4),0.6,fc='#81c784',ec='#388e3c',lw=1.5))
ax3.add_patch(Circle((bx4,by4),0.25,fc='#1b5e20',ec='#003300'))
ax3.text(0,-3.8,'Apoptotic bodies',ha='center',fontsize=9,color='#2e7d32',fontweight='bold')
# Macrophage engulfing
ax3.add_patch(Ellipse((-4.5,-1),2.5,2.0,fc='#ffcc80',ec='#e65100',lw=1.5))
ax3.add_patch(Circle((-4.8,-0.8),0.5,fc='#ef6c00',ec='#e65100',lw=1))
ax3.add_patch(Circle((-4.2,-1.2),0.35,fc='#81c784',ec='#388e3c',lw=1)) # engulfed body inside
ax3.text(-4.5,-2.4,'Macrophage\n(eating bodies)',ha='center',fontsize=8,color='#e65100')
# Labels
ax3.annotate('Shrunken cell',xy=(2.2,3.5),xytext=(3.5,5),fontsize=8.5,color='#2e7d32',
arrowprops=dict(arrowstyle='->',color='#2e7d32',lw=1.2))
ax3.annotate('Dense nucleus\n(chromatin condensed)',xy=(0,1.5),xytext=(1.5,4.5),fontsize=8.5,color='#1b5e20',
arrowprops=dict(arrowstyle='->',color='#1b5e20',lw=1.2))
ax3.annotate('Membrane blebs\n(INTACT)',xy=(0,-1.8),xytext=(-4.5,0),fontsize=8.5,color='#2e7d32',
arrowprops=dict(arrowstyle='->',color='#2e7d32',lw=1.2))
ax3.text(0,-6.3,'NO inflammation • Membrane INTACT\nATP needed • Programmed',
ha='center',fontsize=9,fontweight='bold',color='#1b5e20',
bbox=dict(boxstyle='round,pad=0.3',fc='white',ec='#81c784'))
else: # NECROSIS
ax3.set_facecolor('#ffebee')
ax3.set_title('NECROSIS',fontsize=13,fontweight='bold',color='#c62828',pad=8)
rng3=np.random.RandomState(5)
angs2=np.linspace(0,2*np.pi,22)
rv=3.8+rng3.randn(22)*0.7; rv=np.clip(rv,2.5,4.8)
xs2=rv*np.cos(angs2); ys2=1+rv*np.sin(angs2)
ax3.fill(np.append(xs2,xs2[0]),np.append(ys2,ys2[0]),fc='#ef9a9a',ec='#c62828',lw=2,linestyle='--')
# Ghost nucleus
ax3.add_patch(Circle((0.3,1.5),1.0,fc='none',ec='#bdbdbd',lw=1,alpha=0.35))
# Pyknotic dark dot alternative
ax3.add_patch(Circle((-0.5,0.5),0.5,fc='#4a148c',ec='#311b92',lw=1.5))
# Fragments
for fx2,fy2 in [(1.5,2.5),(-1,2.8),(1,-0.5)]:
ax3.add_patch(Circle((fx2,fy2),0.25,fc='#7b1fa2',ec='#4a148c',lw=1))
# Leaking contents - red dots outside
for lx2,ly2 in [(-5.3,0.5),(5,1),(0,5.5),(4.5,4),(4.5,-2),(0,-4.3),(-4.8,-1.5)]:
ax3.plot(lx2,ly2,'o',color='#e53935',markersize=7)
# Inflammatory cells
for fx3,fy3 in [(-5,-3),(5,-3),(0,-5.5),(4.5,5),(-4.5,4)]:
ax3.add_patch(Circle((fx3,fy3),0.65,fc='#ef9a9a',ec='#c62828',lw=1.5))
ax3.annotate('SWOLLEN cell\n(↑ size)',xy=(3,4.5),xytext=(0,5.5),fontsize=8.5,color='#c62828',
arrowprops=dict(arrowstyle='->',color='#c62828',lw=1.2))
ax3.annotate('Broken\nmembrane',xy=(4.2,1),xytext=(4,4),fontsize=8.5,color='#c62828',
arrowprops=dict(arrowstyle='->',color='#c62828',lw=1.2))
ax3.annotate('Contents\nleaking out',xy=(4.8,-1.5),xytext=(2,-4),fontsize=8.5,color='#e53935',
arrowprops=dict(arrowstyle='->',color='#e53935',lw=1.2))
ax3.text(0,-6.3,'INFLAMMATION present • Membrane BREAKS\nNo ATP needed • Pathological',
ha='center',fontsize=9,fontweight='bold',color='#c62828',
bbox=dict(boxstyle='round,pad=0.3',fc='white',ec='#ef9a9a'))
tip3=fig.add_axes([0.05,-0.07,0.9,0.05]); tip3.axis('off')
tip3.text(0.5,0.5,'✏ Draw: Left side = shrunken green cell, blebs, apoptotic bodies below, macrophage eating them. Right side = swollen jagged red cell, dots leaking outside, inflammatory cells around it.',
ha='center',va='center',fontsize=9,color='#1b5e20',
bbox=dict(boxstyle='round,pad=0.3',fc='#f1f8e9',ec='#81c784'))
plt.tight_layout()
plt.savefig(out+'ci_F_apoptosis_vs_necrosis.png', dpi=150, bbox_inches='tight')
plt.close()
print("F saved")
print("\nAll 6 Cell Injury diagrams saved!")
python /home/daytona/workspace/path-study-plan/ci_diagrams.py
~/path-study-plan/ci_diagrams.py
Successfully replaced 1 instance(s) of the string in '/home/daytona/workspace/path-study-plan/ci_diagrams.py'
python /home/daytona/workspace/path-study-plan/ci_diagrams.py 2>&1 | tail -5
| Diagram | What it shows |
|---|---|
| A | 8 causes of cell injury (spider layout) |
| B | Normal → Reversible → Irreversible → Necrosis (4 cells) |
| C | Mechanisms of irreversible injury (step-by-step cascade) |
| D | Apoptosis - Intrinsic + Extrinsic pathways meeting at Caspase-3 |
| E | 5 cell adaptations side by side |
| F | Apoptosis vs Necrosis cell drawings |
make pdf of Cell Injury & Adaptation detail ans with diagrams
~/path-study-plan/ci_full_pdf.py
from reportlab.lib.pagesizes import A4
from reportlab.lib import colors
from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle
from reportlab.lib.units import cm
from reportlab.platypus import (SimpleDocTemplate, Paragraph, Spacer, Table,
TableStyle, HRFlowable, PageBreak, Image)
from reportlab.lib.enums import TA_CENTER, TA_LEFT, TA_JUSTIFY
import os
out_path = '/home/daytona/workspace/path-study-plan/CellInjury_Adaptation_Notes.pdf'
img_dir = '/home/daytona/workspace/path-study-plan/'
doc = SimpleDocTemplate(out_path, pagesize=A4,
rightMargin=1.8*cm, leftMargin=1.8*cm,
topMargin=1.8*cm, bottomMargin=1.8*cm)
W, H = A4
styles = getSampleStyleSheet()
# ── custom styles ──────────────────────────────────────────
def S(name, **kw):
p = ParagraphStyle(name, parent=styles['Normal'], **kw)
return p
TITLE = S('TITLE', fontSize=20, textColor=colors.HexColor('#1a237e'),
alignment=TA_CENTER, spaceAfter=4, fontName='Helvetica-Bold')
SUBTTL = S('SUBTTL', fontSize=10, textColor=colors.HexColor('#37474f'),
alignment=TA_CENTER, spaceAfter=3)
PART = S('PART', fontSize=13, textColor=colors.white,
backColor=colors.HexColor('#1a237e'), spaceBefore=12, spaceAfter=6,
leftIndent=6, fontName='Helvetica-Bold')
H2 = S('H2', fontSize=11, textColor=colors.HexColor('#1a237e'),
spaceBefore=8, spaceAfter=4, fontName='Helvetica-Bold')
BODY = S('BODY', fontSize=9.5, textColor=colors.HexColor('#212121'),
spaceAfter=4, leading=14, alignment=TA_JUSTIFY)
BULLET = S('BULLET', fontSize=9.5, textColor=colors.HexColor('#212121'),
spaceAfter=3, leftIndent=14, leading=13)
TIP = S('TIP', fontSize=9, textColor=colors.HexColor('#1b5e20'),
backColor=colors.HexColor('#f1f8e9'), spaceAfter=5, leftIndent=8,
rightIndent=8, borderPad=4, leading=13)
EXAM = S('EXAM', fontSize=9, textColor=colors.HexColor('#b71c1c'),
backColor=colors.HexColor('#fff8e1'), spaceAfter=5, leftIndent=8,
rightIndent=8, leading=13)
FOOTER = S('FOOTER', fontSize=8, textColor=colors.grey, alignment=TA_CENTER)
def hr(): return HRFlowable(width='100%', thickness=1, color=colors.HexColor('#9fa8da'))
def hr2(): return HRFlowable(width='100%', thickness=2, color=colors.HexColor('#1a237e'))
def sp(h=0.2): return Spacer(1, h*cm)
def table(data, col_widths, header_color='#283593'):
t = Table(data, colWidths=col_widths)
n = len(data)
style = [
('BACKGROUND', (0,0), (-1,0), colors.HexColor(header_color)),
('TEXTCOLOR', (0,0), (-1,0), colors.white),
('FONTNAME', (0,0), (-1,0), 'Helvetica-Bold'),
('FONTSIZE', (0,0), (-1,-1), 8.5),
('ROWBACKGROUNDS', (0,1), (-1,-1),
[colors.HexColor('#e8eaf6'), colors.white]),
('GRID', (0,0), (-1,-1), 0.4, colors.HexColor('#9fa8da')),
('VALIGN', (0,0), (-1,-1), 'MIDDLE'),
('TOPPADDING', (0,0), (-1,-1), 4),
('BOTTOMPADDING',(0,0),(-1,-1),4),
('LEFTPADDING',(0,0), (-1,-1), 5),
('WORDWRAP', (0,0), (-1,-1), True),
]
t.setStyle(TableStyle(style))
return t
def img(fname, width=15*cm):
path = img_dir + fname
if os.path.exists(path):
return Image(path, width=width, kind='proportional')
return Paragraph(f'[Image not found: {fname}]', BODY)
# ── build story ────────────────────────────────────────────
e = [] # elements
# ── Cover ──
e.append(sp(0.5))
e.append(Paragraph('PATHOLOGY NOTES', TITLE))
e.append(Paragraph('Cell Injury & Adaptation', S('T2', fontSize=16,
textColor=colors.HexColor('#c62828'), alignment=TA_CENTER,
spaceAfter=4, fontName='Helvetica-Bold')))
e.append(Paragraph('NIMSRC Medical College | KNRUHS 2nd Year MBBS | Based on Robbins Pathology',
SUBTTL))
e.append(sp(0.3))
e.append(hr2())
e.append(sp(0.3))
# Contents
toc_data = [
['Part', 'Topic', 'Page'],
['1', 'Causes of Cell Injury', '1'],
['2', 'Sequence of Cell Injury (Normal → Death)', '2'],
['3', 'Mechanisms of Irreversible Cell Injury', '3'],
['4', 'Apoptosis – Two Pathways', '4'],
['5', 'Apoptosis vs Necrosis (Comparison)', '5'],
['6', 'Cell Adaptations (Hypertrophy, Hyperplasia, Atrophy, Metaplasia, Dysplasia)', '6'],
['7', 'Quick Revision Table – Exam Key Facts', '7'],
]
e.append(Paragraph('CONTENTS', S('C', fontSize=11, fontName='Helvetica-Bold',
textColor=colors.HexColor('#1a237e'), spaceAfter=6)))
e.append(table(toc_data, [1.5*cm, 12*cm, 1.5*cm]))
e.append(PageBreak())
# ══════════════════════════════════════════════════════════
# PART 1 – CAUSES OF CELL INJURY
# ══════════════════════════════════════════════════════════
e.append(Paragraph(' PART 1 – CAUSES OF CELL INJURY', PART))
e.append(sp())
e.append(Paragraph(
'A cell maintains <b>homeostasis</b> – a balance of structure and function. '
'Any stimulus that disturbs this balance beyond the cell\'s adaptive capacity '
'leads to <b>cell injury</b>. The severity and duration of the stimulus, and the '
'type and metabolic state of the cell, determine whether injury is reversible or irreversible.',
BODY))
e.append(sp())
# Diagram A
e.append(Paragraph('DIAGRAM A – Causes of Cell Injury (Spider layout)', H2))
e.append(img('ci_A_causes.png', width=14*cm))
e.append(Paragraph(
'✏ <b>Exam draw tip:</b> Central box "CELL INJURY" → 8 surrounding boxes with arrows pointing inward. Takes 2 minutes.',
TIP))
e.append(sp())
causes_data = [
['#', 'Cause', 'Key Example / Notes'],
['1', 'Hypoxia / Ischemia', 'MOST COMMON. Blocked artery → ↓O₂. Also anemia, lung disease.'],
['2', 'Physical Agents', 'Trauma, extremes of temperature, radiation, electric shock'],
['3', 'Chemical Toxins', 'CCl₄ (liver), alcohol, CO, drugs, air pollutants'],
['4', 'Infectious Agents', 'Bacteria, viruses, fungi, parasites – diverse mechanisms'],
['5', 'Immunologic Reactions', 'Autoimmune disease, allergy, vasculitis → inflammation'],
['6', 'Genetic Defects', 'Sickle cell anemia, Down syndrome, inborn errors of metabolism'],
['7', 'Nutritional Imbalance', 'Protein-calorie deficiency, vitamin deficiency; also obesity'],
['8', 'Aging', 'Progressive decline in cellular homeostatic mechanisms'],
]
e.append(table(causes_data, [0.8*cm, 4.2*cm, 9.8*cm]))
e.append(Paragraph(
'🧠 <b>Memory trick – H P C I I G N A:</b> '
'"Healthy People Can\'t Ignore Illness – Get Nourished Always"',
EXAM))
e.append(PageBreak())
# ══════════════════════════════════════════════════════════
# PART 2 – SEQUENCE OF CELL INJURY
# ══════════════════════════════════════════════════════════
e.append(Paragraph(' PART 2 – SEQUENCE OF CELL INJURY', PART))
e.append(sp())
e.append(Paragraph('DIAGRAM B – Normal → Reversible → Irreversible → Necrosis', H2))
e.append(img('ci_B_sequence.png', width=15.5*cm))
e.append(Paragraph(
'✏ <b>Draw tip:</b> 4 circles in a row. 1=neat circle. 2=bigger+bumps+vacuoles. '
'3=very large+dark dots in mitochondria+tiny pyknotic nucleus. 4=jagged broken circle+dots leaking outside.',
TIP))
e.append(sp())
e.append(Paragraph('Reversible Cell Injury – Features (Morphology)', H2))
rev_data = [
['Feature', 'What happens', 'Mechanism'],
['Cell swelling', 'Cell enlarges, pale/watery', '↓ATP → ↓Na⁺/K⁺ pump → Na⁺+H₂O enter'],
['Membrane blebs', 'Bumps/protrusions on surface', 'Cytoskeletal disruption'],
['Vacuoles', 'Clear spaces in cytoplasm', 'Distended, pinched-off ER segments (hydropic change)'],
['Chromatin clumping', 'Nuclear chromatin aggregates', 'Loss of RNA, ↓ transcription'],
['Mitochondrial swelling', 'Mitochondria enlarged', 'Loss of volume regulation'],
['Ribosome detachment', 'Ribosomes fall off rough ER', '↓ protein synthesis'],
['Myelin figures', 'Whorl-like phospholipid masses', 'Damaged cellular membranes'],
]
e.append(table(rev_data, [3.5*cm, 4.5*cm, 6.8*cm]))
e.append(sp())
e.append(Paragraph('Irreversible Cell Injury – 3 Key Markers (Point of No Return)', H2))
irrev_data = [
['Marker', 'Detail'],
['1. Mitochondrial failure', 'Inability to restore oxidative phosphorylation / ATP even after injury removed'],
['2. Membrane damage', 'Permanent loss of plasma membrane and intracellular membrane integrity'],
['3. DNA/chromatin loss', 'Structural integrity of DNA and chromatin destroyed → triggers cell death'],
]
e.append(table(irrev_data, [5.5*cm, 9.3*cm], header_color='#b71c1c'))
e.append(Paragraph(
'🧠 <b>Exam tip:</b> "3 markers of irreversibility" = Mitochondrial failure + Membrane damage + DNA loss. '
'These are the defining features of the <b>point of no return</b>.',
EXAM))
e.append(PageBreak())
# ══════════════════════════════════════════════════════════
# PART 3 – MECHANISMS OF IRREVERSIBLE CELL INJURY
# ══════════════════════════════════════════════════════════
e.append(Paragraph(' PART 3 – MECHANISMS OF IRREVERSIBLE CELL INJURY', PART))
e.append(sp())
e.append(Paragraph('DIAGRAM C – Step-by-step Cascade Leading to Cell Death', H2))
e.append(img('ci_C_mechanisms.png', width=12*cm))
e.append(Paragraph(
'✏ <b>Draw tip:</b> 6 boxes top-to-bottom with downward arrows. '
'Trigger → ↓ATP → Cell swelling → ↑Ca²⁺ → Free radicals → Membrane damage.',
TIP))
e.append(sp())
mech_data = [
['Step', 'Mechanism', 'Result'],
['1', '↓ ATP (Mitochondrial failure)', 'Loss of energy for all cellular processes'],
['2', '↓ Na⁺/K⁺ ATPase pump', 'Na⁺ + water enter → CELL SWELLING + ER dilation'],
['3', 'Anaerobic glycolysis ↑', 'Lactic acid accumulates → ↓ pH → enzyme failure'],
['4', '↑ Intracellular Ca²⁺', 'Activates ATPases, Phospholipases, Proteases, Endonucleases'],
['5', 'Free Radical (ROS) injury', 'Lipid peroxidation → membrane destruction + DNA damage'],
['6', 'Membrane damage', 'Contents leak out → NECROSIS + Inflammation'],
]
e.append(table(mech_data, [1.2*cm, 6.0*cm, 7.6*cm]))
e.append(sp())
e.append(Paragraph('Ca²⁺ Activated Enzymes (Exam Favourite)', H2))
ca_data = [
['Enzyme', 'Target Destroyed', 'Effect'],
['ATPases', 'ATP', 'Further ↓ energy'],
['Phospholipases','Plasma membrane', 'Membrane destruction → contents leak'],
['Proteases', 'Cytoskeleton', 'Cell structure collapses'],
['Endonucleases', 'DNA', 'Nuclear/DNA fragmentation'],
]
e.append(table(ca_data, [3.5*cm, 4.5*cm, 6.8*cm], header_color='#880e4f'))
e.append(Paragraph(
'🧠 <b>MCQ tip:</b> "What activates phospholipases in cell injury?" = '
'<b>Increased intracellular Ca²⁺</b>. BCL-2 inhibits apoptosis – decreased BCL-2 → cell death.',
EXAM))
e.append(PageBreak())
# ══════════════════════════════════════════════════════════
# PART 4 – APOPTOSIS
# ══════════════════════════════════════════════════════════
e.append(Paragraph(' PART 4 – APOPTOSIS (Programmed Cell Death)', PART))
e.append(sp())
e.append(Paragraph(
'Apoptosis is an <b>active, ATP-requiring, programmed</b> form of cell death in which cells '
'activate enzymes that degrade their own nuclear DNA and cytoplasmic proteins. '
'The cell fragments into <b>apoptotic bodies</b> (membrane-bound) which are phagocytosed '
'by macrophages <b>without causing inflammation</b> – the membrane remains intact throughout.',
BODY))
e.append(sp())
e.append(Paragraph('DIAGRAM D – Intrinsic and Extrinsic Pathways', H2))
e.append(img('ci_D_apoptosis.png', width=13*cm))
e.append(Paragraph(
'✏ <b>Draw tip:</b> Two columns → left = Intrinsic (4 steps), right = Extrinsic (3 steps). '
'Both arrows converge at "Caspase-3" → one final arrow down to "APOPTOSIS".',
TIP))
e.append(sp())
path_data = [
['Feature', 'INTRINSIC (Mitochondrial)', 'EXTRINSIC (Death Receptor)'],
['Trigger', 'DNA damage, hypoxia, toxins,\nmisfolded proteins',
'Fas-Ligand / TNF binds\ndeath receptor on surface'],
['Key protein','p53 ↑ → BAX ↑ / BCL-2 ↓', 'FADD adaptor recruited'],
['Mediator', 'Cytochrome c released from\nmitochondria', 'Caspase-8 activated'],
['Caspase', 'Caspase-9', 'Caspase-8'],
['Convergence','Both activate → <b>CASPASE-3</b> (Executioner) → APOPTOSIS', ''],
]
t_path = Table(path_data, colWidths=[3.5*cm, 6.0*cm, 6.0*cm])
t_path.setStyle(TableStyle([
('BACKGROUND', (0,0),(-1,0), colors.HexColor('#1b5e20')),
('TEXTCOLOR', (0,0),(-1,0), colors.white),
('FONTNAME', (0,0),(-1,0), 'Helvetica-Bold'),
('FONTSIZE', (0,0),(-1,-1), 8.5),
('BACKGROUND', (0,5),(0,5), colors.HexColor('#c62828')),
('TEXTCOLOR', (0,5),(0,5), colors.white),
('SPAN', (1,5),(2,5)),
('BACKGROUND', (1,5),(2,5), colors.HexColor('#c62828')),
('TEXTCOLOR', (1,5),(2,5), colors.white),
('FONTNAME', (0,5),(-1,5),'Helvetica-Bold'),
('ROWBACKGROUNDS',(0,1),(-1,4),
[colors.HexColor('#e8f5e9'), colors.white]),
('GRID', (0,0),(-1,-1), 0.4, colors.HexColor('#a5d6a7')),
('VALIGN', (0,0),(-1,-1),'MIDDLE'),
('TOPPADDING', (0,0),(-1,-1),5),
('BOTTOMPADDING',(0,0),(-1,-1),5),
('LEFTPADDING',(0,0),(-1,-1),5),
('WORDWRAP', (0,0),(-1,-1),True),
]))
e.append(t_path)
e.append(sp())
e.append(Paragraph('Causes of Apoptosis', H2))
ap_cause_data = [
['Type', 'Condition', 'Mechanism'],
['Physiological','Embryogenesis', 'Removal of interdigital webbing'],
['Physiological','Thymus', 'Deletion of self-reactive T lymphocytes'],
['Physiological','Menstrual cycle','Shedding of endometrium'],
['Physiological','Gut epithelium','Regular cell turnover'],
['Pathological', 'DNA damage beyond repair', 'p53 ↑ → intrinsic pathway'],
['Pathological', 'Viral infection (HIV)', 'Caspase activation'],
['Pathological', 'Cytotoxic T cell killing', 'FasL/perforin pathway'],
]
e.append(table(ap_cause_data, [3.2*cm, 4.5*cm, 7.1*cm]))
e.append(PageBreak())
# ══════════════════════════════════════════════════════════
# PART 5 – APOPTOSIS vs NECROSIS
# ══════════════════════════════════════════════════════════
e.append(Paragraph(' PART 5 – APOPTOSIS vs NECROSIS', PART))
e.append(sp())
e.append(Paragraph('DIAGRAM F – Cell Drawings: Apoptosis vs Necrosis', H2))
e.append(img('ci_F_apoptosis_vs_necrosis.png', width=15*cm))
e.append(Paragraph(
'✏ <b>Draw tip:</b> Left = small green cell, bumps on edge, apoptotic bodies below, macrophage eating them. '
'Right = big jagged red cell, dots leaking outside, inflammatory cells scattered around.',
TIP))
e.append(sp())
avs_data = [
['Feature', 'APOPTOSIS', 'NECROSIS'],
['Type', 'Programmed / physiological or controlled', 'Uncontrolled / always pathological'],
['Cell size', 'SHRINKS (condensation)', 'SWELLS (oncosis)'],
['Plasma membrane', 'INTACT (blebs form)', 'DISRUPTED / ruptures'],
['Contents', 'Enclosed in apoptotic bodies', 'LEAKS into surrounding tissue'],
['Inflammation', 'ABSENT', 'PRESENT'],
['Apoptotic bodies', 'YES – phagocytosed by macrophages', 'NO'],
['ATP requirement', 'YES – active process', 'NO – passive process'],
['Nuclear changes', 'Karyorrhexis (fragmentation)', 'Pyknosis → Karyolysis'],
['DNA fragmentation', 'Internucleosomal (ladder pattern)', 'Random, diffuse'],
['BCL-2 / Caspases', 'Caspases activated; BCL-2 ↓ promotes', 'Not involved'],
['Examples', 'Embryogenesis, thymus, endometrium,\ngut epithelium',
'MI, infarction, TB abscess, gangrene'],
]
t_avs = Table(avs_data, colWidths=[4.0*cm, 5.5*cm, 5.3*cm])
t_avs.setStyle(TableStyle([
('BACKGROUND', (0,0),(0,-1), colors.HexColor('#e8f5e9')),
('BACKGROUND', (0,0),(-1,0), colors.HexColor('#1b5e20')),
('TEXTCOLOR', (0,0),(-1,0), colors.white),
('FONTNAME', (0,0),(-1,0),'Helvetica-Bold'),
('FONTNAME', (0,0),(0,-1),'Helvetica-Bold'),
('FONTSIZE', (0,0),(-1,-1), 8.5),
('ROWBACKGROUNDS',(0,1),(-1,-1),
[colors.HexColor('#f1f8e9'), colors.white]),
('GRID', (0,0),(-1,-1), 0.4, colors.HexColor('#a5d6a7')),
('VALIGN', (0,0),(-1,-1),'MIDDLE'),
('TOPPADDING', (0,0),(-1,-1),5),
('BOTTOMPADDING',(0,0),(-1,-1),5),
('LEFTPADDING',(0,0),(-1,-1),5),
('WORDWRAP', (0,0),(-1,-1),True),
]))
e.append(t_avs)
e.append(Paragraph(
'🧠 <b>MOST ASKED QUESTION in Cell Injury:</b> "Compare apoptosis and necrosis" – '
'Draw this table. Always emphasise: Apoptosis = NO inflammation + Membrane INTACT. '
'Necrosis = Inflammation PRESENT + Membrane BREAKS.',
EXAM))
e.append(PageBreak())
# ══════════════════════════════════════════════════════════
# PART 6 – CELL ADAPTATIONS
# ══════════════════════════════════════════════════════════
e.append(Paragraph(' PART 6 – CELL ADAPTATIONS TO STRESS', PART))
e.append(sp())
e.append(Paragraph(
'When a cell faces <b>sublethal, chronic, or persistent stress</b>, it adapts rather than dying. '
'These adaptations are generally reversible if the stimulus is removed. '
'If stress exceeds adaptive capacity, the cell undergoes injury and death.',
BODY))
e.append(sp())
e.append(Paragraph('DIAGRAM E – Five Types of Cell Adaptation', H2))
e.append(img('ci_E_adaptations.png', width=15.5*cm))
e.append(Paragraph(
'✏ <b>Draw tip:</b> 5 boxes side by side. '
'Hypertrophy=small→big circle. Hyperplasia=few→many circles. '
'Atrophy=big faded→small faded. Metaplasia=tall rectangles→flat rectangles. '
'Dysplasia=irregular sizes + big dark nuclei.',
TIP))
e.append(sp())
adapt_data = [
['Adaptation', 'Definition', 'Stimulus', 'Examples'],
['HYPERTROPHY', '↑ cell SIZE\n(same number)',
'Increased workload;\nhormonal stimulation',
'Cardiac hypertrophy (HTN, aortic stenosis);\nUterus in pregnancy (+ hyperplasia);\nSkeletal muscle (exercise)'],
['HYPERPLASIA', '↑ cell NUMBER\n(increased proliferation)',
'Hormones / growth factors;\nCompensatory (organ loss)',
'Endometrial hyperplasia (↑ estrogen);\nBPH (androgens + estrogen);\nLiver regeneration after resection'],
['ATROPHY', '↓ cell SIZE and function;\n↓ organelles via autophagy',
'Disuse, ↓ innervation,\n↓ blood supply, ↓ nutrition,\n↓ hormone, aging',
'Muscle wasting (bed rest/denervation);\nBrain atrophy (aging);\nBone atrophy (immobility)'],
['METAPLASIA', 'One cell type replaces\nanother (REVERSIBLE)',
'Chronic irritation\nor stimulus',
'Smoker bronchi: Ciliated columnar → Squamous;\nBarrett esophagus: Squamous → Columnar (GERD);\nBladder (stones): Transitional → Squamous'],
['DYSPLASIA', 'Disordered growth;\nvariable cell size + shape;\n↑ mitoses\n(PRE-MALIGNANT)',
'Chronic injury +\npersistent stimulus',
'Cervical dysplasia (CIN 1-3);\nBronchial dysplasia (smokers);\n→ Can progress to CANCER if not reversed'],
]
t_adapt = Table(adapt_data, colWidths=[2.8*cm, 3.8*cm, 3.8*cm, 5.4*cm])
t_adapt.setStyle(TableStyle([
('BACKGROUND', (0,0),(-1,0), colors.HexColor('#4a148c')),
('TEXTCOLOR', (0,0),(-1,0), colors.white),
('FONTNAME', (0,0),(-1,0),'Helvetica-Bold'),
('FONTNAME', (0,1),(0,-1),'Helvetica-Bold'),
('FONTSIZE', (0,0),(-1,-1), 8),
('ROWBACKGROUNDS',(0,1),(-1,-1),
[colors.HexColor('#f3e5f5'), colors.white]),
('GRID', (0,0),(-1,-1), 0.4, colors.HexColor('#ce93d8')),
('VALIGN', (0,0),(-1,-1),'MIDDLE'),
('TOPPADDING', (0,0),(-1,-1),5),
('BOTTOMPADDING',(0,0),(-1,-1),5),
('LEFTPADDING',(0,0),(-1,-1),5),
('WORDWRAP', (0,0),(-1,-1),True),
]))
e.append(t_adapt)
e.append(sp())
e.append(Paragraph('Important Points about Adaptations', H2))
pts = [
'• Hypertrophy + Hyperplasia can occur <b>together</b> (e.g. uterus in pregnancy).',
'• <b>Pathologic hyperplasia is NOT cancer</b> – it remains responsive to regulatory signals. Cancer is not.',
'• Pathologic hyperplasia is a risk factor for cancer (e.g. endometrial hyperplasia → endometrial cancer).',
'• <b>Metaplasia is reversible</b> if stimulus removed. Dysplasia can progress to malignancy if not reversed.',
'• Barrett esophagus (squamous → columnar metaplasia) is a risk factor for adenocarcinoma of esophagus.',
'• Hypertrophy exceeding adaptive capacity → degenerative changes → <b>ventricular dilation + cardiac failure</b>.',
'• Atrophy involves activation of <b>autophagy</b> (self-eating of organelles to reduce cell size).',
]
for pt in pts:
e.append(Paragraph(pt, BULLET))
e.append(PageBreak())
# ══════════════════════════════════════════════════════════
# PART 7 – QUICK REVISION
# ══════════════════════════════════════════════════════════
e.append(Paragraph(' PART 7 – QUICK REVISION: Key Exam Facts', PART))
e.append(sp())
qr_data = [
['Topic', 'Key Fact / Answer'],
['Most common cause of cell injury', 'Hypoxia / Ischemia'],
['First sign of reversible injury', 'Cell swelling (↑ Na⁺, ↓ K⁺ due to pump failure)'],
['3 markers of irreversibility',
'1. Mito failure (no ATP) 2. Membrane damage 3. DNA/chromatin loss'],
['Ca²⁺ activates (4 enzymes)',
'ATPases, Phospholipases, Proteases, Endonucleases'],
['Free radical injury mechanism', 'Lipid peroxidation of cell membranes'],
['BCL-2 function', 'Anti-apoptotic (cell survival); ↓ BCL-2 → apoptosis'],
['Caspase-3', 'Executioner caspase – activated by BOTH intrinsic and extrinsic'],
['Intrinsic apoptosis key step', 'Cytochrome c release from mitochondria → Caspase-9'],
['Extrinsic apoptosis key step', 'Fas-FasL / TNF → FADD → Caspase-8'],
['Apoptosis – NO inflammation because', 'Membrane stays INTACT; contents never spill out'],
['Necrosis – INFLAMMATION because', 'Membrane RUPTURES; cell contents trigger immune response'],
['Hypertrophy example', 'Cardiac hypertrophy in hypertension'],
['Hyperplasia example', 'Endometrial hyperplasia (excess estrogen)'],
['Metaplasia example', 'Smoker bronchi: ciliated columnar → squamous'],
['Dysplasia = ', 'Disordered growth, pre-malignant, can reverse if stimulus removed'],
['Barrett esophagus', 'Squamous → Columnar metaplasia (GERD) → risk of adenocarcinoma'],
['KNRUHS favourite question', '"Compare apoptosis and necrosis" – draw the table in Part 5'],
]
e.append(table(qr_data, [5.5*cm, 10.3*cm], header_color='#c62828'))
e.append(sp())
# Exam questions box
eq_data = [
['Common KNRUHS Exam Questions on Cell Injury & Adaptation'],
['Long Answer (10 marks): Write about mechanisms of irreversible cell injury with diagram.'],
['Long Answer (10 marks): Compare and contrast apoptosis and necrosis with diagrams.'],
['Long Answer (10 marks): Describe the types of cell adaptations with examples and diagrams.'],
['Short Answer (5 marks): Write about intrinsic and extrinsic pathways of apoptosis.'],
['Short Answer (5 marks): Describe the nuclear changes seen in necrosis.'],
['Short Answer (5 marks): What is metaplasia? Give examples and clinical significance.'],
['MCQ: Which enzyme activated by Ca²⁺ damages the plasma membrane? → Phospholipase'],
['MCQ: BCL-2 is which type of protein? → Anti-apoptotic'],
['MCQ: Cardiac hypertrophy is caused by? → Increased workload (HTN / aortic stenosis)'],
]
t_eq = Table(eq_data, colWidths=[15.8*cm])
t_eq.setStyle(TableStyle([
('BACKGROUND', (0,0),(-1,0), colors.HexColor('#b71c1c')),
('TEXTCOLOR', (0,0),(-1,0), colors.white),
('FONTNAME', (0,0),(-1,0),'Helvetica-Bold'),
('FONTSIZE', (0,0),(-1,-1), 8.5),
('BACKGROUND', (0,1),(-1,-1), colors.HexColor('#fff8e1')),
('TEXTCOLOR', (0,1),(-1,-1), colors.HexColor('#b71c1c')),
('GRID', (0,0),(-1,-1), 0.4, colors.HexColor('#ef9a9a')),
('VALIGN', (0,0),(-1,-1),'MIDDLE'),
('TOPPADDING', (0,0),(-1,-1),5),
('BOTTOMPADDING',(0,0),(-1,-1),5),
('LEFTPADDING',(0,0),(-1,-1),6),
('WORDWRAP', (0,0),(-1,-1),True),
]))
e.append(t_eq)
# Footer
e.append(sp(0.5))
e.append(hr())
e.append(Paragraph(
'Generated by Orris AI | Based on Robbins & Kumar Basic Pathology | '
'NIMSRC Medical College, KNRUHS | For personal academic use only',
FOOTER))
# ── Build ──────────────────────────────────────────────────
doc.build(e)
print(f'PDF saved: {out_path}')
python /home/daytona/workspace/path-study-plan/ci_full_pdf.py 2>&1
~/path-study-plan/ci_full_pdf.py
Successfully replaced 1 instance(s) of the string in '/home/daytona/workspace/path-study-plan/ci_full_pdf.py'
python /home/daytona/workspace/path-study-plan/ci_full_pdf.py 2>&1
CellInjury Adaptation Notes
PDF Document · PDF
| Part | Content |
|---|---|
| 1 | Causes of Cell Injury - table + Diagram A (spider layout) |
| 2 | Sequence of injury - Diagram B (4 cells) + reversible/irreversible features table |
| 3 | Mechanisms of irreversible injury - Diagram C + Ca²⁺ enzymes table |
| 4 | Apoptosis pathways - Diagram D + causes table |
| 5 | Apoptosis vs Necrosis - Diagram F + full 12-row comparison table |
| 6 | Cell Adaptations - Diagram E + full adaptations table + key points |
| 7 | Quick revision table + top KNRUHS exam questions (Long/Short/MCQ) |