Estimate anisotropy in a 3D microscopy image

In this tutorial, we compute the structure tensor of a 3D image. For a general introduction to 3D image processing, please refer to Explore 3D images (of cells). The data we use here are sampled from an image of kidney tissue obtained by confocal fluorescence microscopy (more details at 1 under kidney-tissue-fluorescence.tif).


import matplotlib.pyplot as plt
import numpy as np

import as px
from skimage import (
    data, feature

Load image

This biomedical image is available through scikit-image’s data registry.

What exactly are the shape and size of our 3D multichannel image?

print(f'number of dimensions: {data.ndim}')
print(f'shape: {data.shape}')
print(f'dtype: {data.dtype}')


number of dimensions: 4
shape: (16, 512, 512, 3)
dtype: uint16

For the purposes of this tutorial, we shall consider only the second color channel, which leaves us with a 3D single-channel image. What is the range of values?

n_plane, n_row, n_col, n_chan = data.shape
v_min, v_max = data[:, :, :, 1].min(), data[:, :, :, 1].max()
print(f'range: ({v_min}, {v_max})')


range: (68, 4095)

Let us visualize the middle slice of our 3D image.

    data[n_plane // 2, :, :, 1],
    labels={'x': 'col', 'y': 'row', 'color': 'intensity'}