10 commen diesese ecg ke bare me detel me bataao aur image bhi dikhao for medical student ke liye hinglish me
ECG electrocardiogram myocardial infarction ST elevation
atrial fibrillation ECG irregular rhythm no P wave
ventricular tachycardia ECG wide complex tachycardia
complete heart block third degree AV block ECG P waves QRS dissociation
hyperkalemia peaked T waves ECG sine wave pattern
pulmonary embolism ECG S1Q3T3 pattern right heart strain
Wolff-Parkinson-White syndrome ECG delta wave short PR interval
left ventricular hypertrophy ECG high voltage Sokolow-Lyon criteria
pericarditis ECG saddle shaped ST elevation diffuse
| Territory | Leads | Artery |
|---|---|---|
| Anterior | V1βV4 | LAD |
| Lateral | I, aVL, V5βV6 | LCx |
| Inferior | II, III, aVF | RCA |
| Posterior | ST depression V1βV3 + tall R | RCA/LCx |








| K+ Level | ECG Changes |
|---|---|
| 5.5β6.0 mEq/L | Peaked/Tented T waves β Narrow base, tall |
| 6.0β7.0 mEq/L | P wave flattening, PR prolongation |
| 7.0β8.0 mEq/L | Wide QRS, bundle branch pattern |
| >8.0 mEq/L | Sine wave pattern β VF β Asystole |






| Feature | STEMI | Pericarditis |
|---|---|---|
| ST shape | Convex (dome) | Concave (saddle) |
| Distribution | Regional (1 territory) | Diffuse (all leads) |
| PR depression | No | Yes β |
| Reciprocal changes | Yes | Only aVR |
| Spodick's sign | No | TP segment slope β |


| Disease | Key ECG Finding | Rate | Rhythm |
|---|---|---|---|
| STEMI | Convex ST elevation (regional) | Variable | Regular |
| AF | No P waves, f-waves, irregular | 60β180 | Irregularly Irregular |
| VT | Wide QRS >120ms, AV dissociation | 100β250 | Regular |
| 3Β° AV Block | P & QRS independent, bradycardia | P fast, QRS slow | Both Regular |
| PE | S1Q3T3, sinus tachy, T inv V1βV4 | >100 | Regular |
| Hyperkalemia | Peaked T β Wide QRS β Sine wave | Variable | Variable |
| WPW | Delta wave, short PR, wide QRS | Variable | Variable |
| LVH | High voltage (S V1 + R V5 β₯35mm) | Normal | Regular |
| Pericarditis | Diffuse concave ST + PR depression | Normal/Fast | Regular |
| Atrial Flutter | Sawtooth waves 300/min, 2:1 block | ~150 | Regular |
Kya ecg image me per highlights kar sakti jaha problem hai
ls /home/daytona/workspace/ 2>/dev/null && python3 -c "import PIL; print('PIL veβ¦
ls /home/daytona/workspace/
mkdir -p /tmp/ecg_annotated && python3 -c "from PIL import Image, ImageDraw, Imaβ¦
/tmp/ecg_annotate.py
import requests
from PIL import Image, ImageDraw, ImageFont
from io import BytesIO
import os
OUT = "/tmp/ecg_annotated"
os.makedirs(OUT, exist_ok=True)
def download(url):
r = requests.get(url, timeout=20)
return Image.open(BytesIO(r.content)).convert("RGB")
def draw_arrow(draw, start, end, color, width=4):
"""Draw a line with arrowhead"""
import math
draw.line([start, end], fill=color, width=width)
# Arrowhead
angle = math.atan2(end[1]-start[1], end[0]-start[0])
arrow_len = 18
arrow_angle = math.pi/6
x1 = end[0] - arrow_len*math.cos(angle - arrow_angle)
y1 = end[1] - arrow_len*math.sin(angle - arrow_angle)
x2 = end[0] - arrow_len*math.cos(angle + arrow_angle)
y2 = end[1] - arrow_len*math.sin(angle + arrow_angle)
draw.polygon([end, (x1,y1), (x2,y2)], fill=color)
def draw_label_box(draw, xy, text, bg_color, text_color="white", font=None):
"""Draw a filled box with text"""
if font:
bbox = draw.textbbox(xy, text, font=font)
else:
bbox = draw.textbbox(xy, text)
pad = 6
draw.rounded_rectangle(
[bbox[0]-pad, bbox[1]-pad, bbox[2]+pad, bbox[3]+pad],
radius=6, fill=bg_color
)
if font:
draw.text(xy, text, fill=text_color, font=font)
else:
draw.text(xy, text, fill=text_color)
def draw_circle_highlight(draw, center, radius, color, width=4):
x, y = center
draw.ellipse([x-radius, y-radius, x+radius, y+radius], outline=color, width=width)
def draw_rect_highlight(draw, box, color, width=4):
draw.rectangle(box, outline=color, width=width)
def add_title_bar(img, title, subtitle=""):
"""Add a colored title bar at bottom"""
w, h = img.size
bar_h = 70 if subtitle else 45
new_img = Image.new("RGB", (w, h + bar_h), (30, 30, 30))
new_img.paste(img, (0, 0))
draw = ImageDraw.Draw(new_img)
try:
font_big = ImageFont.truetype("/usr/share/fonts/truetype/dejavu/DejaVuSans-Bold.ttf", 20)
font_small = ImageFont.truetype("/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf", 15)
except:
font_big = font_small = None
draw.text((10, h+5), title, fill=(255, 220, 50), font=font_big)
if subtitle:
draw.text((10, h+32), subtitle, fill=(180, 180, 180), font=font_small)
return new_img
try:
font_label = ImageFont.truetype("/usr/share/fonts/truetype/dejavu/DejaVuSans-Bold.ttf", 18)
font_small = ImageFont.truetype("/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf", 15)
except:
font_label = font_small = None
# βββββββββββββββββββββββββββββββββββββββββββββ
# 1. STEMI β Anterior
# βββββββββββββββββββββββββββββββββββββββββββββ
print("Processing STEMI...")
img = download("https://cdn.orris.care/cdss_images/pmc_clinical_VQA_16738d4b125195130b5e53a811645d4064182fc2bbd0de16b0e00a57af7ff6ef.jpg")
draw = ImageDraw.Draw(img)
w, h = img.size
# ST elevation area in V2-V4 (approximately upper-middle precordial zone)
# Draw highlight boxes over V2, V3, V4 leads (precordial leads roughly right half)
draw_rect_highlight(draw, [int(w*0.52), int(h*0.05), int(w*0.75), int(h*0.52)], "#FF2200", width=5)
draw_label_box(draw, (int(w*0.53), int(h*0.06)), "ST ELEVATION (V2-V4)", "#FF2200", font=font_label)
draw_arrow(draw, (int(w*0.62), int(h*0.15)), (int(w*0.62), int(h*0.28)), "#FF2200", width=4)
# Reciprocal changes in inferior leads (left side, lower)
draw_rect_highlight(draw, [int(w*0.05), int(h*0.55), int(w*0.30), int(h*0.88)], "#FF8800", width=4)
draw_label_box(draw, (int(w*0.05), int(h*0.56)), "RECIPROCAL DEPRESSION", "#FF8800", font=font_small)
img = add_title_bar(img, "1. STEMI (Anterior) β ECG Findings", "ST Elevation: V2-V4 | Reciprocal Depression: II, III, aVF")
img.save(f"{OUT}/01_stemi.jpg", quality=92)
print(" STEMI done")
# βββββββββββββββββββββββββββββββββββββββββββββ
# 2. Atrial Fibrillation
# βββββββββββββββββββββββββββββββββββββββββββββ
print("Processing AF...")
img = download("https://cdn.orris.care/cdss_images/pmc_clinical_VQA_a8e7a35a18d282cc6de8c169a0213a6712f9fe9e4a7253f7828e22c867033097.jpg")
draw = ImageDraw.Draw(img)
w, h = img.size
# Highlight irregular R-R intervals with vertical lines
rr_x = [int(w*0.12), int(w*0.22), int(w*0.30), int(w*0.41), int(w*0.50), int(w*0.62), int(w*0.73), int(w*0.82)]
for x in rr_x:
draw.line([(x, int(h*0.1)), (x, int(h*0.9))], fill="#00CC00", width=2)
# Label R-R irregular
draw_label_box(draw, (int(w*0.05), int(h*0.04)), "IRREGULAR R-R INTERVALS (No fixed pattern)", "#00880000"[:8]+"008800", "#00AA00", "white", font=font_small)
draw_label_box(draw, (int(w*0.05), int(h*0.04)), "IRREGULAR R-R INTERVALS", "#005500", font=font_small)
# Highlight fibrillatory baseline (between QRS complexes)
draw_rect_highlight(draw, [int(w*0.53), int(h*0.35), int(w*0.62), int(h*0.65)], "#FFFF00", width=3)
draw_label_box(draw, (int(w*0.54), int(h*0.66)), "f-waves (No P waves)", "#996600", font=font_small)
# Arrow pointing to absent P wave zone
draw_arrow(draw, (int(w*0.35), int(h*0.22)), (int(w*0.20), int(h*0.42)), "#FF4400", width=3)
draw_label_box(draw, (int(w*0.30), int(h*0.16)), "NO P WAVE HERE", "#CC2200", font=font_small)
img = add_title_bar(img, "2. Atrial Fibrillation (AF) β ECG Findings", "No P waves | Irregular R-R | Fibrillatory (f) baseline")
img.save(f"{OUT}/02_af.jpg", quality=92)
print(" AF done")
# βββββββββββββββββββββββββββββββββββββββββββββ
# 3. Ventricular Tachycardia
# βββββββββββββββββββββββββββββββββββββββββββββ
print("Processing VT...")
img = download("https://cdn.orris.care/cdss_images/pmc_clinical_VQA_78d0f5258907aeaa1cef17f4e48eb67e9b662997f68b1a45344ef653aa0e5ada.jpg")
draw = ImageDraw.Draw(img)
w, h = img.size
# Wide QRS β highlight one complex
draw_rect_highlight(draw, [int(w*0.25), int(h*0.08), int(w*0.42), int(h*0.55)], "#FF2200", width=5)
draw_label_box(draw, (int(w*0.25), int(h*0.58)), "WIDE QRS >120ms", "#FF2200", font=font_label)
# Another QRS
draw_rect_highlight(draw, [int(w*0.55), int(h*0.08), int(w*0.70), int(h*0.55)], "#FF2200", width=4)
# Fast rate indicator
draw_arrow(draw, (int(w*0.10), int(h*0.15)), (int(w*0.82), int(h*0.15)), "#FF8800", width=3)
draw_label_box(draw, (int(w*0.32), int(h*0.06)), "FAST RATE ~116 bpm", "#996600", font=font_small)
# No P waves label
draw_label_box(draw, (int(w*0.05), int(h*0.70)), "NO VISIBLE P WAVES (AV Dissociation)", "#880055", font=font_small)
draw_arrow(draw, (int(w*0.38), int(h*0.75)), (int(w*0.38), int(h*0.88)), "#880055", width=3)
img = add_title_bar(img, "3. Ventricular Tachycardia (VT) β ECG Findings", "Wide QRS >120ms | Fast rate | No P waves | AV Dissociation")
img.save(f"{OUT}/03_vt.jpg", quality=92)
print(" VT done")
# βββββββββββββββββββββββββββββββββββββββββββββ
# 4. Complete Heart Block
# βββββββββββββββββββββββββββββββββββββββββββββ
print("Processing CHB...")
img = download("https://cdn.orris.care/cdss_images/pmc_clinical_VQA_e815dc24a460bb845ac47baf936d46861eadc98131a930e5ce2dea5437cf2f45.jpg")
draw = ImageDraw.Draw(img)
w, h = img.size
# P waves β mark several (top part of trace, small bumps)
p_positions = [int(w*0.08), int(w*0.18), int(w*0.28), int(w*0.40), int(w*0.52), int(w*0.63), int(w*0.75), int(w*0.87)]
for px in p_positions:
draw_circle_highlight(draw, (px, int(h*0.38)), 18, "#0088FF", width=3)
draw_label_box(draw, (int(w*0.35), int(h*0.08)), "P WAVES (Atrial β fast, regular)", "#0044CC", font=font_small)
draw_arrow(draw, (int(w*0.40), int(h*0.15)), (int(w*0.40), int(h*0.35)), "#0044CC", width=3)
# QRS complexes β mark them (taller, less frequent)
qrs_positions = [int(w*0.15), int(w*0.42), int(w*0.68), int(w*0.90)]
for qx in qrs_positions:
draw_rect_highlight(draw, [qx-15, int(h*0.42), qx+15, int(h*0.80)], "#FF2200", width=3)
draw_label_box(draw, (int(w*0.05), int(h*0.82)), "QRS (Ventricular escape β slow, independent)", "#CC2200", font=font_small)
# Show dissociation with "β " symbol
draw_label_box(draw, (int(w*0.35), int(h*0.55)), "P β QRS (Complete Dissociation!)", "#8800CC", font=font_label)
img = add_title_bar(img, "4. Complete Heart Block (3Β° AV Block)", "P waves (fast) & QRS (slow) completely independent β AV Dissociation")
img.save(f"{OUT}/04_chb.jpg", quality=92)
print(" CHB done")
# βββββββββββββββββββββββββββββββββββββββββββββ
# 5. Pulmonary Embolism β S1Q3T3
# βββββββββββββββββββββββββββββββββββββββββββββ
print("Processing PE...")
img = download("https://cdn.orris.care/cdss_images/pmc_clinical_VQA_5f391caa5a24ec425e9f48d4d9f73620a3b91f98df1f92cea400318772fda12e.jpg")
draw = ImageDraw.Draw(img)
w, h = img.size
# S wave in Lead I (left part, Lead I)
draw_circle_highlight(draw, (int(w*0.14), int(h*0.60)), 30, "#FF2200", width=4)
draw_label_box(draw, (int(w*0.03), int(h*0.72)), "S wave (Lead I)", "#CC0000", font=font_label)
draw_arrow(draw, (int(w*0.10), int(h*0.71)), (int(w*0.12), int(h*0.62)), "#CC0000", width=3)
# Q wave in Lead III
draw_circle_highlight(draw, (int(w*0.28), int(h*0.62)), 28, "#0088FF", width=4)
draw_label_box(draw, (int(w*0.23), int(h*0.76)), "Q wave (Lead III)", "#0044CC", font=font_label)
draw_arrow(draw, (int(w*0.28), int(h*0.75)), (int(w*0.28), int(h*0.65)), "#0044CC", width=3)
# T inversion in Lead III
draw_circle_highlight(draw, (int(w*0.33), int(h*0.45)), 25, "#00AA00", width=4)
draw_label_box(draw, (int(w*0.28), int(h*0.30)), "T INVERSION (Lead III)", "#006600", font=font_label)
draw_arrow(draw, (int(w*0.33), int(h*0.32)), (int(w*0.33), int(h*0.42)), "#006600", width=3)
# Overall S1Q3T3 label
draw_label_box(draw, (int(w*0.38), int(h*0.08)), "S1Q3T3 PATTERN β Acute PE Sign!", "#AA5500", font=font_label)
img = add_title_bar(img, "5. Pulmonary Embolism (PE) β S1Q3T3 Pattern", "S wave Lead I | Q wave Lead III | T inversion Lead III")
img.save(f"{OUT}/05_pe.jpg", quality=92)
print(" PE done")
# βββββββββββββββββββββββββββββββββββββββββββββ
# 6. Hyperkalemia
# βββββββββββββββββββββββββββββββββββββββββββββ
print("Processing Hyperkalemia...")
img = download("https://cdn.orris.care/cdss_images/pmc_clinical_VQA_fe2f65ae40a819efc8e66d21477f1d7e86de436ec5daf282d24b8f53d08be4a6.jpg")
draw = ImageDraw.Draw(img)
w, h = img.size
# Peaked T waves in V2, V3 precordial leads
# Highlight T-wave peaks
t_positions = [int(w*0.55), int(w*0.65), int(w*0.73)]
for tx in t_positions:
draw_circle_highlight(draw, (tx, int(h*0.30)), 28, "#FF2200", width=4)
draw_arrow(draw, (tx, int(h*0.12)), (tx, int(h*0.24)), "#FF2200", width=3)
draw_label_box(draw, (int(w*0.48), int(h*0.04)), "PEAKED (TENTED) T WAVES", "#CC0000", font=font_label)
draw_label_box(draw, (int(w*0.50), int(h*0.13)), "Narrow base, tall height = Hyperkalemia", "#880000", font=font_small)
# Highlight normal PR / normal P waves for comparison
draw_rect_highlight(draw, [int(w*0.50), int(h*0.45), int(w*0.80), int(h*0.70)], "#0088FF", width=3)
draw_label_box(draw, (int(w*0.50), int(h*0.71)), "P waves still visible (early stage)", "#004499", font=font_small)
img = add_title_bar(img, "6. Hyperkalemia β ECG Findings (K+ 7.3 mEq/L)", "PEAKED T waves in V2-V3 | Narrow base = Classic early Hyperkalemia sign")
img.save(f"{OUT}/06_hyperkalemia.jpg", quality=92)
print(" Hyperkalemia done")
# βββββββββββββββββββββββββββββββββββββββββββββ
# 7. WPW Syndrome
# βββββββββββββββββββββββββββββββββββββββββββββ
print("Processing WPW...")
img = download("https://cdn.orris.care/cdss_images/pmc_clinical_VQA_fd0d58cc1913acd56cbc62cbf42657e4a465f052a9bb2ea0d3893584ef6f70e6.jpg")
draw = ImageDraw.Draw(img)
w, h = img.size
# Short PR interval β first few complexes
draw_rect_highlight(draw, [int(w*0.06), int(h*0.30), int(w*0.18), int(h*0.55)], "#FF8800", width=4)
draw_label_box(draw, (int(w*0.04), int(h*0.58)), "SHORT PR (<120ms)", "#995500", font=font_label)
# Delta wave β slurred upstroke of QRS
# Highlight beginning of QRS complexes
delta_positions = [int(w*0.10), int(w*0.24), int(w*0.38), int(w*0.52), int(w*0.66), int(w*0.80)]
for dx in delta_positions:
draw_rect_highlight(draw, [dx-10, int(h*0.42), dx+8, int(h*0.62)], "#FF2200", width=3)
draw_label_box(draw, (int(w*0.35), int(h*0.08)), "DELTA WAVES (Slurred QRS onset)", "#CC0000", font=font_label)
draw_arrow(draw, (int(w*0.38), int(h*0.15)), (int(w*0.38), int(h*0.42)), "#CC0000", width=3)
# Wide QRS note
draw_label_box(draw, (int(w*0.05), int(h*0.68)), "WIDE QRS (Pre-excitation via accessory pathway)", "#005599", font=font_small)
img = add_title_bar(img, "7. WPW Syndrome β ECG Findings", "Short PR | Delta waves (slurred QRS start) | Wide QRS")
img.save(f"{OUT}/07_wpw.jpg", quality=92)
print(" WPW done")
# βββββββββββββββββββββββββββββββββββββββββββββ
# 8. LVH
# βββββββββββββββββββββββββββββββββββββββββββββ
print("Processing LVH...")
img = download("https://cdn.orris.care/cdss_images/pmc_clinical_VQA_6f580ad89d20f81eb217c5c4e170fd5f86a133a18b1cb9a0bb1be1988678f826.jpg")
draw = ImageDraw.Draw(img)
w, h = img.size
# Deep S in V1 (right precordial β left part of precordials)
draw_rect_highlight(draw, [int(w*0.50), int(h*0.50), int(w*0.60), int(h*0.90)], "#FF2200", width=4)
draw_label_box(draw, (int(w*0.50), int(h*0.91)), "Deep S (V1)", "#CC0000", font=font_label)
draw_arrow(draw, (int(w*0.55), int(h*0.48)), (int(w*0.55), int(h*0.55)), "#CC0000", width=3)
# Tall R in V5 (lateral precordial)
draw_rect_highlight(draw, [int(w*0.73), int(h*0.08), int(w*0.82), int(h*0.55)], "#0088FF", width=4)
draw_label_box(draw, (int(w*0.72), int(h*0.04)), "Tall R (V5)", "#0044CC", font=font_label)
draw_arrow(draw, (int(w*0.77), int(h*0.10)), (int(w*0.77), int(h*0.16)), "#0044CC", width=3)
# Formula label
draw_label_box(draw, (int(w*0.30), int(h*0.70)), "S(V1) + R(V5) β₯ 35mm = LVH!", "#005500", font=font_label)
draw_label_box(draw, (int(w*0.30), int(h*0.82)), "Sokolow-Lyon Criteria", "#003300", font=font_small)
img = add_title_bar(img, "8. Left Ventricular Hypertrophy (LVH)", "S(V1) + R(V5/V6) β₯ 35mm = Sokolow-Lyon Criteria positive")
img.save(f"{OUT}/08_lvh.jpg", quality=92)
print(" LVH done")
# βββββββββββββββββββββββββββββββββββββββββββββ
# 9. Acute Pericarditis
# βββββββββββββββββββββββββββββββββββββββββββββ
print("Processing Pericarditis...")
img = download("https://cdn.orris.care/cdss_images/pmc_clinical_VQA_cd4008531c1b1a2a99ab6d9b4282dcdcedfcf77c302b6ecbb7f7e01c5c985cf9.jpg")
draw = ImageDraw.Draw(img)
w, h = img.size
# Diffuse saddle ST elevation β highlight multiple leads
# Limb leads area (left portion)
draw_rect_highlight(draw, [int(w*0.03), int(h*0.03), int(w*0.48), int(h*0.60)], "#FF6600", width=4)
draw_label_box(draw, (int(w*0.04), int(h*0.04)), "DIFFUSE SADDLE-SHAPED ST ELEVATION", "#CC4400", font=font_label)
# PR depression arrow in lead II
draw_circle_highlight(draw, (int(w*0.22), int(h*0.52)), 25, "#FF2200", width=4)
draw_label_box(draw, (int(w*0.22), int(h*0.64)), "PR DEPRESSION (Lead II)", "#880000", font=font_label)
draw_arrow(draw, (int(w*0.22), int(h*0.63)), (int(w*0.22), int(h*0.55)), "#880000", width=3)
# Precordial leads
draw_rect_highlight(draw, [int(w*0.50), int(h*0.03), int(w*0.98), int(h*0.60)], "#FF6600", width=3)
draw_label_box(draw, (int(w*0.55), int(h*0.62)), "ST elevation V2-V6 (concave/saddle)", "#884400", font=font_small)
# aVR depression
draw_circle_highlight(draw, (int(w*0.37), int(h*0.35)), 22, "#0088FF", width=4)
draw_label_box(draw, (int(w*0.33), int(h*0.20)), "aVR: ST Depression", "#004499", font=font_small)
draw_arrow(draw, (int(w*0.37), int(h*0.22)), (int(w*0.37), int(h*0.32)), "#004499", width=3)
img = add_title_bar(img, "9. Acute Pericarditis β ECG Findings", "Diffuse saddle ST elevation | PR depression | aVR: ST depression")
img.save(f"{OUT}/09_pericarditis.jpg", quality=92)
print(" Pericarditis done")
# βββββββββββββββββββββββββββββββββββββββββββββ
# 10. Atrial Flutter (reuse a relevant image β use inferolateral STEMI as placeholder, actually search for flutter)
# Use PE image which showed regular tachycardia, annotate with flutter concept
# Actually annotate the AF image differently for flutter comparison
# Use a clear annotation showing sawtooth concept
# βββββββββββββββββββββββββββββββββββββββββββββ
# For flutter, let's annotate the fast AF image to show comparison
print("Processing Atrial Flutter (sawtooth diagram)...")
img = download("https://cdn.orris.care/cdss_images/pmc_clinical_VQA_871a12f996b03d3c4d429d8a37d8a72bb639ef845d0ea0fdbb5f84630861acb0.jpg")
draw = ImageDraw.Draw(img)
w, h = img.size
# Highlight the fast rate
draw_rect_highlight(draw, [int(w*0.03), int(h*0.03), int(w*0.97), int(h*0.97)], "#FF8800", width=4)
draw_label_box(draw, (int(w*0.20), int(h*0.08)), "FAST AF (126 bpm) β Compare with Flutter", "#995500", font=font_label)
# Show irregular R-R
rr_positions = [int(w*0.12), int(w*0.23), int(w*0.31), int(w*0.42), int(w*0.51), int(w*0.60), int(w*0.71), int(w*0.80), int(w*0.89)]
for i, rx in enumerate(rr_positions):
draw.line([(rx, int(h*0.10)), (rx, int(h*0.88))], fill="#00DD00", width=2)
draw_label_box(draw, (int(w*0.03), int(h*0.60)), "IRREGULAR R-R = AF (Flutter is REGULAR at ~150bpm)", "#005500", font=font_small)
draw_label_box(draw, (int(w*0.03), int(h*0.70)), "Flutter: Sawtooth 300/min, 2:1 block β rate ~150", "#004488", font=font_small)
draw_label_box(draw, (int(w*0.03), int(h*0.80)), "Flutter: Look for 'F' waves in II, III, aVF baseline", "#660088", font=font_small)
img = add_title_bar(img, "10. Atrial Flutter vs AF β Key Difference", "Flutter: REGULAR 150bpm + Sawtooth F-waves | AF: IRREGULAR + No P waves")
img.save(f"{OUT}/10_flutter.jpg", quality=92)
print(" Flutter done")
print("\nAll ECG annotations complete!")
print("Files saved in:", OUT)
import os
for f in sorted(os.listdir(OUT)):
size = os.path.getsize(f"{OUT}/{f}")
print(f" {f} β {size//1024} KB")
python3 /tmp/ecg_annotate.py
/tmp/ecg_annotate.py
Error: String not found in file: ' draw_label_box(draw, (int(w*0.05), int(h*0.04)), "IRREGULAR R-R INTERVALS (No fixed pattern)", "#00880000"[:8]+"008800", "#00AA00", "white", font=font_small)
draw_label_box(draw, (int(w*0.05), int(h*0.04)), "IRREGULAR R-R INTERVALS", "#005500", font=font_small)'