Scikit Image − Meijering Neuriteness Filter



The Meijering Neuriteness Filter is an image-processing algorithm designed to enhance long and thin tubular structures. This filter was proposed by Meijering et al., and it is specifically developed to detect and enhance long and thin tubular structures within images. These structures are often encountered in medical and biological imaging, such as fluorescence microscopy images of neurites in neuroscience research.

The Meijering Neuriteness Filter belongs to a category of ridge filters that utilize the eigenvalues of the Hessian matrix of image intensities to identify and enhance ridge structures.

To apply the Meijering Neuriteness Filter to images, the scikit-image library provides the meijering() function within the filters module.

Using the skimage.filters.meijering() function

The filters.meijering() function is used to filter an image with the Meijering neuriteness filter. Similar to the Frangi vesselness filter, this filter is designed for detecting continuous ridges in an image.

Syntax

Following is the syntax of this function −

skimage.filters.meijering(image, sigmas=range(1, 10, 2), alpha=None, black_ridges=True, mode='reflect', cval=0)

Parameters

The function accepts the following parameters −

  • Image ((N, M[, P]) ndarray): This parameter is the input image on which the Meijering neuriteness filter will be applied.
  • Sigmas (iterable of floats, optional): Specify the scales of the filter.
  • alpha (float, optional): It controls the shaping of the filter. It selects maximally flat elongated features. The default value is None, which selects the optimal value of -1/(ndim+1), where ndim is the number of dimensions in the image.
  • Black_ridges (boolean, optional): The default value is True, determining whether the filter detects black ridges (True) or white ridges (False).
  • Mode (string, optional): This parameter specifies how to handle values outside the image borders, with options like 'constant', 'reflect', 'wrap', 'nearest', or 'mirror'.
  • Cval (float, optional): This is used in conjunction with mode 'constant' to specify the value outside the image boundaries.

Return value

The function then returns a filtered image represented as a NumPy ndarray. The result is the maximum value of pixels across all the scales, which highlights the detected ridges or structures in the image.

Example

This example applies the skimage.filters.meijering() function on an image with its default parameter values −

import matplotlib.pyplot as plt
from skimage.filters import meijering
from skimage import io, color

# Load the input image 
in_image = io.imread('Images/tree.jpg')
x_0 = 250
y_0 = 100
width = 250
height = 150

# Crop the image to the specified region and convert it to grayscale
image = color.rgb2gray(in_image[y_0:(y_0 + height), x_0:(x_0 + width)])

# Apply the Meijering Neuriteness Filter with default values
filtered_image = meijering(image)

# Plot the original and filtered images
fig, axes = plt.subplots(1, 2, figsize=(10, 5))
ax = axes.ravel()

# Display the Original Image
ax[0].imshow(image, cmap='gray')
ax[0].set_title('Original Image')
ax[0].axis('off')

# Display the Meijering Filter Result
ax[1].imshow(filtered_image, cmap='gray')
ax[1].axis('off')
ax[1].set_title('Meijering Neuriteness Filter Result')

plt.tight_layout()
plt.show()

Output

Neuriteness Filter

Example

The following example demonstrates the use of the meijering neuriteness filter using the skimage.filters.meijering() function on an image with different sigmas to enhance and visualize structures in an image −

from skimage import io
from skimage import color
from skimage.filters import meijering
import matplotlib.pyplot as plt

# Load the input image 
in_image = io.imread('Images/tree.jpg')
x_0 = 250
y_0 = 100
width = 250
height = 150

# Crop the image to the specified region and convert it to grayscale
image = color.rgb2gray(in_image[y_0:(y_0 + height), x_0:(x_0 + width)])

# Apply the Meijering Neuriteness Filter with black_ridges=True
result_black_ridges = meijering(image, black_ridges=True, sigmas=[1])
result_black_ridges_sigmas = meijering(image, black_ridges=True, sigmas=range(1, 5))

# Apply the Meijering Neuriteness Filter with black_ridges=False
result_white_ridges = meijering(image, black_ridges=False, sigmas=[1])
result_white_ridges_sigmas = meijering(image, black_ridges=False, sigmas=range(1, 5))

# Plot the original, filtered (both black_ridges=True and black_ridges=False) images
fig, axes = plt.subplots(2, 3, figsize=(10, 5))
ax = axes.ravel()

# Display the Original Image
ax[0].imshow(image, cmap='gray')
ax[0].set_title('Original Image')
ax[0].axis('off')

# Display the Result with black_ridges=True
ax[1].imshow(result_black_ridges, cmap='gray')
ax[1].axis('off')
ax[1].set_title('Meijering Filter (black_ridges=True)\n \N{GREEK SMALL LETTER SIGMA}=[1]')

# Display the Result with black_ridges=False
ax[2].imshow(result_white_ridges, cmap='gray')
ax[2].axis('off')
ax[2].set_title('Meijering Filter (black_ridges=False)\n \N{GREEK SMALL LETTER SIGMA} =[1]')

# Display the Original Image again (for the second row)
ax[3].imshow(image, cmap='gray')
ax[3].axis('off')
ax[3].set_title('Original Image')

# Display the Result with black_ridges=True 
ax[4].imshow(result_black_ridges_sigmas, cmap='gray')
ax[4].axis('off')
ax[4].set_title('Meijering Filter (black_ridges=True)\n \N{GREEK SMALL LETTER SIGMA} =[1,2,3,4]')

# Display the Result with black_ridges=False 
ax[5].imshow(result_white_ridges_sigmas, cmap='gray')
ax[5].axis('off')
ax[5].set_title('Meijering Filter (black_ridges=False)\n \N{GREEK SMALL LETTER SIGMA} =[1,2,3,4]')

plt.tight_layout()
plt.show()

Output

Neuriteness Filter
Advertisements