analyse these scans and tell me where the infarct is so that i can tell this in my presentation tomorrow
Clinical correlate: Left occipital infarct → Right homonymous hemianopia (loss of the right visual hemifield in both eyes)
| Feature | Detail |
|---|---|
| Location | Left occipital lobe (posterior cerebral hemisphere) |
| Territory | Left PCA territory |
| FLAIR signal | Hyperintense (bright) signal in the left occipital region - confirms infarct/gliosis |
| T2 signal | Hyperintense in the same region |
| T1 signal | Hypointense (dark) - cavitation/encephalomalacia |
| DWI/ADC | Large areas of abnormal diffusion signal visible in lower/posterior slices (row 4-5 in film 3), suggesting either acute-on-chronic component or laminar necrosis |
| Ventricles | Ex-vacuo dilatation of the left posterior horn, confirming volume loss |
| White matter | Extensive periventricular and deep white matter FLAIR hyperintensities - chronic small vessel disease |
| Cerebellum | Lower cuts (bottom rows, film 3) show abnormal signal bilaterally in the cerebellar hemispheres - possible additional posterior circulation involvement |
Disclaimer: This analysis is AI-assisted from photographs of films and should be correlated with the formal radiology report and clinical findings before use in any patient care context.
mark in the MRI also so that i can tell them tomorrow
mkdir -p /tmp/workspace/brain-scans && cd /tmp/workspace/brain-scans && curl -s -o ct_scan.jpeg "https://d361swluvexzqs.cloudfront.net/chats-attachments/1-1785420866036-aslfp5.jpeg" && curl -s -o mri_scan2.jpeg "https://d361swluvexzqs.cloudfront.net/chats-attachments/2-1785420866041-m3xvmu.jpeg" && curl -s -o mri_scan3.jpeg "https://d361swluvexzqs.cloudfront.net/chats-attachments/3-1785420866031-2eb2lr.jpeg" && ls -lh
python3 -c " from PIL import Image for f in ['ct_scan.jpeg','mri_scan2.jpeg','mri_scan3.jpeg']: img = Image.open(f'/tmp/workspace/brain-scans/{f}') print(f'{f}: {img.size} mode={img.mode}') "
~/brain-scans/annotate.py
"""
Annotate brain scan images to highlight the Left PCA territory infarct
for presentation use.
Image layout (all images 960x1280):
- Each film is a grid of axial brain slices arranged in rows and columns.
- The infarct is in the LEFT occipital lobe (which appears on the RIGHT side
of each image slice in standard radiological convention).
Film 1 (CT): 5-column x 5-row grid of slices (approx 192px wide, 256px tall each)
Film 2 (MRI): 7-column x 7-row grid (approx 137px wide, 183px tall each)
Film 3 (MRI): 7-column x 7-row grid (approx 137px wide, 183px tall each)
The occipital/posterior slices are in rows 2-4 of each film.
Left occipital = right side of each slice panel.
"""
from PIL import Image, ImageDraw, ImageFont
import math
def draw_arrow(draw, start, end, color, width=3, head_size=15):
"""Draw an arrow from start to end."""
draw.line([start, end], fill=color, width=width)
# Arrowhead
angle = math.atan2(end[1]-start[1], end[0]-start[0])
x1 = end[0] - head_size * math.cos(angle - math.pi/6)
y1 = end[1] - head_size * math.sin(angle - math.pi/6)
x2 = end[0] - head_size * math.cos(angle + math.pi/6)
y2 = end[1] - head_size * math.sin(angle + math.pi/6)
draw.polygon([end, (x1, y1), (x2, y2)], fill=color)
def draw_label_box(draw, x, y, text, font, color='yellow', bg='black'):
"""Draw text with background box."""
bbox = draw.textbbox((x, y), text, font=font)
pad = 4
draw.rectangle([bbox[0]-pad, bbox[1]-pad, bbox[2]+pad, bbox[3]+pad], fill=bg)
draw.text((x, y), text, fill=color, font=font)
# ─────────────────────────────────────────────
# SCAN 1: CT (ct_scan.jpeg)
# 5 cols x 5 rows of slices
# Grid: each cell ~192x256 px
# The infarct (left occipital) is best seen in rows 2-4 (mid-brain level)
# On the film, LEFT brain = RIGHT side of each sub-image
# ─────────────────────────────────────────────
def annotate_ct():
img = Image.open('/tmp/workspace/brain-scans/ct_scan.jpeg').convert('RGB')
draw = ImageDraw.Draw(img)
W, H = img.size # 960 x 1280
try:
font_big = ImageFont.truetype("/usr/share/fonts/truetype/dejavu/DejaVuSans-Bold.ttf", 22)
font_small = ImageFont.truetype("/usr/share/fonts/truetype/dejavu/DejaVuSans-Bold.ttf", 16)
except:
font_big = ImageFont.load_default()
font_small = font_big
# CT grid: 5 cols, 5 rows + header row at top (~80px)
# Approximate cell dimensions
col_w = W // 5 # 192
row_h = (H - 80) // 5 # ~240
# The hypodense infarct is most visible in rows 2 and 3 (0-indexed),
# col 4 (rightmost = most posterior cuts) and also col 3.
# Left brain = right half of each slice.
# Mark row2, col3 (4th column, 3rd row) - posterior slices
# and row2, col4
target_cells = [
(2, 3), # row 2, col 3
(2, 4), # row 2, col 4
(3, 3), # row 3, col 3
(3, 4), # row 3, col 4
]
RED = (255, 50, 50)
YELLOW = (255, 230, 0)
for (row, col) in target_cells:
# Cell top-left
cx = col * col_w
cy = 80 + row * row_h
# Right half of the cell = left brain (radiological convention)
# Draw a dashed rectangle on right 55% of the cell
rx1 = cx + int(col_w * 0.45)
ry1 = cy + int(row_h * 0.25)
rx2 = cx + col_w - 4
ry2 = cy + row_h - 4
# Draw rectangle
draw.rectangle([rx1, ry1, rx2, ry2], outline=RED, width=3)
# Arrow pointing into the box from outside
arrow_start = (rx1 - 30, ry1 + (ry2 - ry1)//2)
arrow_end = (rx1 + 8, ry1 + (ry2 - ry1)//2)
draw_arrow(draw, arrow_start, arrow_end, YELLOW, width=3)
# Main label
draw_label_box(draw, 10, H - 60,
"LEFT PCA TERRITORY INFARCT (Left Occipital Lobe)",
font_big, color='yellow', bg='black')
draw_label_box(draw, 10, H - 30,
"CT: Hypodense area = Encephalomalacia (Chronic Infarct) R side of slice = L brain",
font_small, color=(200,200,200), bg='black')
# Legend arrow
draw_arrow(draw, (15, H-100), (60, H-80), YELLOW, width=2)
draw_label_box(draw, 65, H-108, "= Infarct zone", font_small, color='yellow', bg='black')
img.save('/tmp/workspace/brain-scans/annotated_CT.jpeg', quality=92)
print("CT annotated")
# ─────────────────────────────────────────────
# SCAN 2: MRI film 2 (mri_scan2.jpeg)
# ~7 cols x 7 rows of slices
# Contains T2, T1, FLAIR sequences
# Left occipital infarct = right side of slices, posterior rows
# ─────────────────────────────────────────────
def annotate_mri2():
img = Image.open('/tmp/workspace/brain-scans/mri_scan2.jpeg').convert('RGB')
draw = ImageDraw.Draw(img)
W, H = img.size # 960 x 1280
try:
font_big = ImageFont.truetype("/usr/share/fonts/truetype/dejavu/DejaVuSans-Bold.ttf", 20)
font_small = ImageFont.truetype("/usr/share/fonts/truetype/dejavu/DejaVuSans-Bold.ttf", 14)
except:
font_big = ImageFont.load_default()
font_small = font_big
# MRI2 has a title bar ~40px, then ~7 rows x 7 cols
top_bar = 40
n_cols = 7
n_rows = 7
col_w = W // n_cols # ~137
row_h = (H - top_bar) // n_rows # ~177
# Infarct visible in:
# Rows 0-2 (T2 axial, posterior slices): cols 5-6 (rightmost = posterior)
# Rows 3-5 (T1 + FLAIR): cols 5-6
# Also rows 5-6 last two cols show cerebellar/posterior fossa changes
target_cells = [
(0, 5), (0, 6),
(1, 5), (1, 6),
(2, 5), (2, 6),
(3, 5), (3, 6),
(4, 5), (4, 6),
]
RED = (255, 60, 60)
YELLOW = (255, 230, 0)
CYAN = (0, 230, 230)
for (row, col) in target_cells:
cx = col * col_w
cy = top_bar + row * row_h
# Right half of cell = left occipital
rx1 = cx + int(col_w * 0.42)
ry1 = cy + int(row_h * 0.20)
rx2 = cx + col_w - 3
ry2 = cy + row_h - 3
draw.rectangle([rx1, ry1, rx2, ry2], outline=RED, width=2)
# Specific arrows pointing to the most conspicuous slices (rows 1-2, cols 5-6)
for (row, col) in [(1,5),(1,6),(2,5),(2,6)]:
cx = col * col_w
cy = top_bar + row * row_h
center_x = cx + int(col_w * 0.72)
center_y = cy + row_h // 2
start_x = cx - 25
start_y = cy + row_h // 2
draw_arrow(draw, (start_x, start_y), (cx + int(col_w*0.44), center_y), YELLOW, width=2)
# Label at top
draw_label_box(draw, 5, 5,
"MRI - Left PCA Infarct: LEFT Occipital Lobe (Posterior rows, right side of each slice)",
font_small, color='yellow', bg=(0,0,0))
# Sequence labels on left margin
sequence_labels = [
(0, "T2 Axial"),
(1, "T2 Axial"),
(2, "T2 Axial"),
(3, "T1 Axial"),
(4, "FLAIR"),
(5, "DWI/ADC"),
(6, "Various"),
]
for (row, label) in sequence_labels:
cy = top_bar + row * row_h + 5
draw_label_box(draw, 2, cy, label, font_small, color=CYAN, bg=(0,0,0))
# Bottom annotation
draw_label_box(draw, 5, H - 30,
"Red boxes = LEFT PCA territory infarct (encephalomalacia/gliosis)",
font_small, color='yellow', bg='black')
img.save('/tmp/workspace/brain-scans/annotated_MRI2.jpeg', quality=92)
print("MRI2 annotated")
# ─────────────────────────────────────────────
# SCAN 3: MRI film 3 (mri_scan3.jpeg)
# Same layout. Contains FLAIR + DWI prominently
# Infarct bright on FLAIR, restricted diffusion on DWI
# ─────────────────────────────────────────────
def annotate_mri3():
img = Image.open('/tmp/workspace/brain-scans/mri_scan3.jpeg').convert('RGB')
draw = ImageDraw.Draw(img)
W, H = img.size # 960 x 1280
try:
font_big = ImageFont.truetype("/usr/share/fonts/truetype/dejavu/DejaVuSans-Bold.ttf", 20)
font_small = ImageFont.truetype("/usr/share/fonts/truetype/dejavu/DejaVuSans-Bold.ttf", 14)
except:
font_big = ImageFont.load_default()
font_small = font_big
top_bar = 40
n_cols = 7
n_rows = 7
col_w = W // n_cols
row_h = (H - top_bar) // n_rows
RED = (255, 60, 60)
YELLOW = (255, 230, 0)
CYAN = (0, 230, 230)
GREEN = (50, 255, 50)
# MRI3 has FLAIR bright hyperintensity in rows 0-1 (posterior slices)
# DWI bright signal (acute/subacute) in rows 3-4 (mid/posterior)
# Cerebellar signal in rows 5-6
target_cells = [
(0, 4), (0, 5), (0, 6),
(1, 4), (1, 5), (1, 6),
(2, 4), (2, 5),
(3, 3), (3, 4), (3, 5), (3, 6),
(4, 3), (4, 4), (4, 5), (4, 6),
]
for (row, col) in target_cells:
cx = col * col_w
cy = top_bar + row * row_h
rx1 = cx + int(col_w * 0.42)
ry1 = cy + int(row_h * 0.18)
rx2 = cx + col_w - 3
ry2 = cy + row_h - 3
draw.rectangle([rx1, ry1, rx2, ry2], outline=RED, width=2)
# Arrows for rows 3-4 (DWI - most important for presentation)
for (row, col) in [(3,4),(3,5),(4,4),(4,5)]:
cx = col * col_w
cy = top_bar + row * row_h
center_y = cy + row_h // 2
draw_arrow(draw, (cx - 28, center_y), (cx + int(col_w*0.44), center_y), YELLOW, width=2)
# Top label
draw_label_box(draw, 5, 5,
"MRI - Left PCA Infarct: FLAIR hyperintensity + DWI restriction (Left Occipital)",
font_small, color='yellow', bg=(0,0,0))
# Sequence labels
sequence_labels = [
(0, "T1 Axial"),
(1, "T2/FLAIR"),
(2, "T2 Axial"),
(3, "DWI"),
(4, "DWI/ADC"),
(5, "Post. Fossa"),
(6, "Post. Fossa"),
]
for (row, label) in sequence_labels:
cy = top_bar + row * row_h + 5
color = GREEN if 'DWI' in label else CYAN
draw_label_box(draw, 2, cy, label, font_small, color=color, bg=(0,0,0))
# DWI specific annotation
draw_label_box(draw, 5, H - 50,
"GREEN label rows = DWI: Bright signal = Restricted diffusion (ischemic infarct)",
font_small, color=GREEN, bg='black')
draw_label_box(draw, 5, H - 28,
"Red boxes = LEFT PCA territory infarct (right side of each slice = left brain)",
font_small, color='yellow', bg='black')
img.save('/tmp/workspace/brain-scans/annotated_MRI3.jpeg', quality=92)
print("MRI3 annotated")
annotate_ct()
annotate_mri2()
annotate_mri3()
print("All done!")
python3 /tmp/workspace/brain-scans/annotate.py
ls -lh /tmp/workspace/brain-scans/annotated_*.jpeg
annotated CT
Image · JPEG
annotated MRI2
Image · JPEG
annotated MRI3
Image · JPEG