Diff of /talk/DiseaseGroup.py [000000] .. [171cba]

Switch to unified view

a b/talk/DiseaseGroup.py
1
# -*- coding: utf-8 -*-
2
# <nbformat>3.0</nbformat>
3
4
# <codecell>
5
6
import numpy as np
7
import pandas as pd
8
import matplotlib.pyplot as plt
9
import seaborn
10
from matplotlib import rcParams
11
rcParams["figure.figsize"] = (14, 8)
12
rcParams["xtick.labelsize"] = 12
13
rcParams["ytick.labelsize"] = 12
14
rcParams["font.size"] = 14
15
rcParams["axes.titlesize"] = 16
16
#rcParams["text.usetex"] = False
17
rcParams["font.family"] = "Serif"
18
rcParams["figure.dpi"] = 600
19
20
21
a = pd.read_csv("../data/villagebay_population.csv")
22
b = pd.read_csv("../data/exposure.csv")
23
24
fig, (ax, ax2) = plt.subplots(2, 1, sharex=True)
25
26
#ax = plt.subplot(211)
27
ax.plot(a.Year, a.VillageBay, c=seaborn.color_palette("deep", 8)[0], lw=3)
28
ax.scatter(a.Year, a.VillageBay, c=seaborn.color_palette("deep", 8)[0], s=50)
29
ax.set_title("Village Bay Population")
30
ax.set_ylim([180, 700])
31
32
33
#ax2 = plt.subplot(212, sharex=ax)
34
35
ax2.plot(b.BirthYear, b.AvgOfLambWS, c=seaborn.color_palette("deep", 8)[2], lw=3)
36
ax2.scatter(b.BirthYear, b.AvgOfLambWS, c=seaborn.color_palette("deep", 8)[2], s=50)
37
ax2.set_title("Lamb Winter Survival")
38
ax2.set_xlim([1984.5, 2013.5])
39
ax2.set_ylim([0, 0.8])
40
41
plt.savefig("figures/population2.jpg", dpi=300, jpeg_quality=100)
42
43
# <headingcell level=1>
44
45
# Robust Extraction of Quantitative Information from Histology Images
46
47
# <headingcell level=4>
48
49
# Quentin Caudron
50
51
# <headingcell level=2>
52
53
# The Soay Sheep
54
55
# <markdowncell>
56
57
# <img src="figures/graphics/soay.jpg" />
58
59
# <markdowncell>
60
61
# <img src="figures/graphics/population2.jpg" />
62
63
# <markdowncell>
64
65
# <img src="figures/graphics/lit1.jpg" />
66
67
# <markdowncell>
68
69
# <img src="figures/graphics/lit2.jpg" />
70
71
# <markdowncell>
72
73
# <img src="figures/graphics/lit4.jpg" />
74
75
# <headingcell level=2>
76
77
# Outline
78
79
# <markdowncell>
80
81
# - Methods and data collection
82
# - Image processing
83
# - Extracted measures
84
# - Preliminary analysis
85
# - Future directions
86
87
# <headingcell level=2>
88
89
# Data
90
91
# <markdowncell>
92
93
# **In the field, winter of 2011 - 2012 :**
94
#     
95
# - Daily study area monitoring for deaths
96
# - 143 liver samples collected within a day of death
97
98
# <markdowncell>
99
100
# **In the lab :**
101
# 
102
# - Sectioning after paraffin treatment
103
# - H&E staining of about 1000 slides
104
105
# <markdowncell>
106
107
# **Analysis :**
108
# 
109
# - Pathology standard : semi-quantitative scoring
110
# - Image processing
111
112
# <headingcell level=3>
113
114
# The Field &copy;
115
116
# <markdowncell>
117
118
# Sweat-and-blood-collected in cold, cold Scotland.
119
120
# <markdowncell>
121
122
# Eight physical measurements :
123
# - Age at death
124
# - Weight
125
# - Sex
126
# - Limb length
127
# - Environmental "stress"
128
129
# <headingcell level=3>
130
131
# Clinical Pathology
132
133
# <markdowncell>
134
135
# Operator-driven visual analysis of 98 slides under microscopy.
136
137
# <markdowncell>
138
139
# Eleven discrete and continuous measures :
140
# 
141
# - Inflammation
142
# - Necrosis
143
# - Apoptosis
144
# - Hyperplasia
145
# - Fibrosis
146
# - Hepatitis
147
148
# <headingcell level=3>
149
150
# Image Processing
151
152
# <markdowncell>
153
154
# Automated analysis of 4430 images of slides representing 143 sheep.
155
156
# <markdowncell>
157
158
# Seven structural and textural measures with varying levels of biological interpretation :
159
# 
160
# - Inflammation
161
# - Hyperplasia / tissue density
162
# - Best-guess proxies for "generic degeneration"
163
164
# <headingcell level=2>
165
166
# Image Processing
167
168
# <markdowncell>
169
170
# <img src="figures/graphics/sheep.jpg"></img>
171
172
# <markdowncell>
173
174
# <img src="figures/graphics/processed.jpg"></img>
175
176
# <headingcell level=3>
177
178
# The Challenge
179
180
# <markdowncell>
181
182
# **Information extraction must be**
183
# - automagical - no operator input
184
# - reasonably quick - restricted computing time
185
# - robust - invariant to slicing, staining, field-related variation 
186
# - unbiased - same algorithms for everyone
187
188
# <markdowncell>
189
190
# ![image](figures/graphics/robust3.jpg)
191
192
# <markdowncell>
193
194
# ![image](figures/graphics/robust4.jpg)
195
196
# <markdowncell>
197
198
# ![image](figures/graphics/robust1.jpg)
199
200
# <markdowncell>
201
202
# ![image](figures/graphics/robust2.jpg)
203
204
# <markdowncell>
205
206
# <img src="figures/graphics/gif.gif"></img>
207
208
# <headingcell level=2>
209
210
# Structural and Textural Measures
211
212
# <markdowncell>
213
214
# - characteristic **scale** of sinusoid widths
215
# - **directional** amplitude of preferred sinusoid alignment
216
# - **tissue to sinusoid** ratio
217
# - **count** of inflammatory foci per image
218
# - **mean size** of inflammatory foci per image
219
# - information **entropy** of sinusoid distribution
220
# - **lacunarity** ( clustering ) of sinusoids
221
222
# <markdowncell>
223
224
# ![image](figures/graphics/intra.png)
225
226
# <markdowncell>
227
228
# ![image](figures/graphics/inter2.png)
229
230
# <headingcell level=2>
231
232
# Exploratory Analysis
233
234
# <headingcell level=3>
235
236
# by individual
237
238
# <markdowncell>
239
240
# <img src="figures/regressions/BDHyperplasia/lm-0.png" />
241
242
# <markdowncell>
243
244
# <img src="figures/regressions/PortalInflammation/lm-0.png" />
245
246
# <markdowncell>
247
248
# <img src="figures/regressions/PortalInflammation/lm-1.png" />
249
250
# <headingcell level=2>
251
252
# Exploratory Analysis
253
254
# <headingcell level=3>
255
256
# controlled for age / cohort
257
258
# <markdowncell>
259
260
# <img src="figures/regressions/PortalInflammation/mm_0.png" />
261
262
# <markdowncell>
263
264
# <img src="figures/regressions/BDHyperplasia/mm_0.png" />
265
266
# <markdowncell>
267
268
# <img src="figures/regressions/BDHyperplasia/mm_1.png" />
269
270
# <markdowncell>
271
272
# <img src="figures/regressions/TawfikTotal/mm_0.png" />
273
274
# <markdowncell>
275
276
# <img src="figures/regressions/Fibrosis/mm_0.png" />
277
278
# <markdowncell>
279
280
# <img src="figures/regressions/PortalInflammation/mm_0.png" />
281
282
# <markdowncell>
283
284
# <img src="figures/regressions/Hindleg/mm_0.png" />
285
286
# <markdowncell>
287
288
# <img src="figures/regressions/Weight/mm_0.png" />
289
290
# <headingcell level=2>
291
292
# Further analysis
293
294
# <headingcell level=3>
295
296
# Age or cohort effect ?
297
298
# <markdowncell>
299
300
# <img src="figures/regressions/BDHyperplasia/mm_coefs_color_E.png" />
301
302
# <markdowncell>
303
304
# <img src="figures/regressions/BDHyperplasia/mm_coefs_color_CES.png" />
305
306
# <markdowncell>
307
308
# <img src="figures/regressions/BDHyperplasia/mm_coefs_color_RES.png" />
309
310
# <headingcell level=2>
311
312
# Conclusions
313
314
# <markdowncell>
315
316
# - our image measures capture **relevant** and **useful** information
317
# - a number of correlations can be **explained** biologically
318
# - underlying **structure** in the data needs thought
319
# - still no **map** from image or histological measures to condition of individual
320
321
# <headingcell level=2>
322
323
# Future directions
324
325
# <headingcell level=3>
326
327
# Further exploration of the dataset
328
329
# <markdowncell>
330
331
# - 145 sheep ( 89 females )
332
# - 12 age classes
333
# - potential redundancy in various measures
334
335
# <markdowncell>
336
337
# - 4460 entries across 27 variables
338
# - 3330 with full image and histological information
339
# - 1196 for which **complete** information is available
340
341
# <headingcell level=3>
342
343
# More data
344
345
# <markdowncell>
346
347
# - nutritional information
348
# - immunity data
349
350
# <headingcell level=3>
351
352
# Narrow-field images
353
354
# <markdowncell>
355
356
# - 12536 images
357
# - spatial distribution of nuclei
358
359
# <markdowncell>
360
361
# ![image](figures/graphics/10.jpg)
362
363
# <markdowncell>
364
365
# ![image](figures/graphics/Processed2.jpg)
366
367
# <markdowncell>
368
369
# ![image](figures/graphics/Segmented.jpg)
370
371
# <markdowncell>
372
373
# <img src="figures/graphics/10x.png" width=100%></src>
374
375
# <headingcell level=2>
376
377
# With thanks to
378
379
# <markdowncell>
380
381
# Romain Garnier
382
# 
383
# Andrea Graham
384
# 
385
# Tawfik Aboellail (CSU)
386
# 
387
# Bryan Grenfell
388