Wednesday, May 4, 2022

Brain porosity and random walks

I read an interesting article in Physics Today (Nicholson, 2022) that reviewed 40+ years of research aimed at determining brain porosity. It turns out that 15-20% of the brain is brine-filled open space, a concept familiar to geologists. I am not sure what I expected brain porosity to be, but that seems a surprisingly high number. An important question about the pore fluid is whether the vital chemicals in the fluid are transported by diffusion or flow. There is some experimental evidence for each, but I found the diffusion topic particularly interesting because it involves random walks in the presence of obstacles.

Random walks are used in a range of applications from almost every field of science, economics and sociology. What is a random walk? Imagine a 2D world composed of 500x500 pixels each with a zero inside. Further imagine that we don't know all the pixels are zero so we want to send out some random walkers to explore the little world and report back. The figure at the top of this article shows part of the result of sending out 1000 walkers that all start from the same point and take 5000 steps in random directions. In a pixel world there are 8 possible directions for each new step and arbitrarily choosing one for the next step is what we mean by 'random direction' in this case. Since there are no obstacles (non-zero values) the random walkers explore more or less equally in all directions and plotting all 5000 steps for all 1000 walkers shows a roughly circular coverage area. 

In the porous brain case, the many kinds of brain cells form a quasi-solid matrix with the pore fluid occupying a complex network of sheets and tunnels, some as small as 10 nm others far larger. In geology terms, the pore space in the brain is something like the vuggy, multi-scale porosity common in carbonate rocks. To study diffusion of material in brain pore fluid, researchers can simulate random walks in the pore space to estimate the transport effect of the microscopic thermal jittering and jostling that occurs in any fluid. However, the presence of cells in the random walk space is a challenging complication. 

Tranter et al. (2019) described pytrax a python library for random walks in the presence of obstacles and Fig 1 was generated with this library in an open field (no obstacles). But if we want random walkers in an obstacle field we need to build the obstacles. Lucky for us, some of the same authors developed the PoreSpy python library for generating 2D/3D porosity fields (Gostick, et al., 2019). 

To get a feel for random walks in an obstacle field, we start by generating a random 400x400 pixel porosity field using PoreSpy:

    import porespy as ps 
    import matplotlib.pyplot as plt 
    im = ps.generators.blobs(shape=[400,400], porosity=0.8, blobiness=2).astype(int) 
    plt.figure(figsize = (6,6)) plt.imshow(1-im, cmap='Greys') 
    plt.savefig('blobs_im.png',dpi=600)

This code generates the figure shown below. The pore space is white, 'cell space' is black and the axes labels represent pixels. Of course, the porosity in this case is outrageously high (80%) for brain or rock, but is useful to visualize random walk results.

The random walk among the cells is generated using pytrax in only a few lines of code. The number of random walkers is 500 and each takes 5000 steps from the same starting point recording every step, and the plot is saved at 600 dots per inch.

    import pytrax as pt 
    rw = pt.RandomWalk(im) rw.run(nt=5000,nw=500,same_start=True,stride=1) 
    plt.fig = rw.plot_walk() 
    plt.savefig('blobs_walk.png,dpi=600)

The resulting plot is an overlay of the tracks on the object field with hotter colors representing pixels occupied by more walkers. In a sense, this figure shows the area explored by the 500 random walkers each taking 5000 steps from the same starting point. But it could also represent a crucial particle of nutrient working its way through brain pore fluid toward a hungry cell.

Through the magic of pytrax, we can also single out the walker who made it the farthest though the obstacle field, the color now representing time evolution of the track. Amazing, thank you pytrax.

References:

Gostick J, Khan ZA, Tranter TG, Kok MDR, Agnaou M, Sadeghi MA, Jervis R. PoreSpy: A Python Toolkit for Quantitative Analysis of Porous Media Images. Journal of Open Source Software, 2019. doi:10.21105/joss.01296

Nicholson, C., 2022, The secret world in the gaps between brain cells (link)

Tranter, TG, Kok, MDR, Lam, M and Gostick, JT, 2019, pytrax: A simple and efficient random walk implementation for calculating the directional tortuosity of images (link)

Figure 1

Figure 2

Figure 3

Figure 4


No comments:

Post a Comment

Note: Only a member of this blog may post a comment.