Note
Go to the end to download the full example code or to run this example in your browser via Binder
Restore spotted cornea image with inpainting#
Optical coherence tomography (OCT) is a non-invasive imaging technique used by ophthalmologists to take pictures of the back of a patient’s eye [1]. When performing OCT, dust may stick to the reference mirror of the equipment, causing dark spots to appear on the images. The problem is that these dirt spots cover areas of in-vivo tissue, hence hiding data of interest. Our goal here is to restore (reconstruct) the hidden areas based on the pixels near their boundaries.
This tutorial is adapted from an application shared by Jules Scholler [2].
The images were acquired by Viacheslav Mazlin (see
skimage.data.palisades_of_vogt()
).
import matplotlib.pyplot as plt
import numpy as np
import plotly.io
import plotly.express as px
import skimage as ski
The dataset we are using here is an image sequence (a movie!) of human in-vivo tissue. Specifically, it shows the palisades of Vogt of a given cornea sample.
Load image data#
image_seq = ski.data.palisades_of_vogt()
print(f'number of dimensions: {image_seq.ndim}')
print(f'shape: {image_seq.shape}')
print(f'dtype: {image_seq.dtype}')
number of dimensions: 3
shape: (60, 1440, 1440)
dtype: uint16
The dataset is an image stack with 60 frames (time points) and 2 spatial
dimensions. Let us visualize 10 frames by sampling every six time points:
We can see some changes in illumination.
We take advantage of the animation_frame
parameter in
Plotly’s imshow
function. As a side note, when the
binary_string
parameter is set to True
, the image is
represented as grayscale.
fig = px.imshow(
image_seq[::6, :, :],
animation_frame=0,
binary_string=True,
labels={'animation_frame': '6-step time point'},
title='Sample of in-vivo human cornea'
)
fig.update_layout(
autosize=False,
minreducedwidth=250,
minreducedheight=250
)
plotly.io.show(fig)