linumpy.intensity.attenuation#

Attenuation estimation and profile recovery models for OCT volumes.

Functions#

get_attenuation_vermeer2013(vol[, dz, mask, C])

Estimates the attenuation coefficient using the Vermeer2013 model.

get_extended_attenuation_vermeer2013(vol[, mask, k, ...])

Compute the local effective tissue attenuation using the extended Vermeer model.

get_attenuation_faber2004(vol[, mask, dz, N])

Estimates the attenuation coefficient using the Faber2004 model.

oct_signal_faber2004_model(z[, mu_t, zR, z0])

Model the oct signal using a single-scattered photons and the confocal PSF.

split_aline(data, mask)

Split an A-line into contiguous masked segments.

get_aline_attenuation(vol[, k, mask])

Compute the attenuation coefficient for each A-lines.

get_gradient_attenuation(vol[, mask, return_mask, ...])

Compute the attenuation coefficient using the log-gradient method.

get_interface_mask(vol[, s, mask_tissue, ...])

Compute a mask excluding tissue interfaces and boundaries.

find_interface_from_gradient(vol[, f, remove_smooth])

Find the tissue-water interface depth map using gradient magnitude.

get_heterogeneous_attenuation(vol[, mask, fill_holes])

Compute heterogeneous attenuation coefficients for each A-line segment.

get_flat_agarose_profile(…)

Estimate and remove the flat agarose intensity profile from a volume.

get_signal_from_attenuation(attn[, i0, nz, mask, res])

Estimate the signal from the 2D A-Line attenuation map.

Module Contents#

linumpy.intensity.attenuation.get_attenuation_vermeer2013(vol, dz=6.5e-06, mask=None, C=None)[source]#

Estimates the attenuation coefficient using the Vermeer2013 model.

Parameters:
  • vol (ndarray) – 3D Reflectivity OCT data

  • dz (float) – Axial resolution (in microns/pixel)

  • mask (ndarray) – Tissue mask (optional). Every pixel above the mask will be attributed null attenuation, and pixel under the mask will be set to the last computed Aline attenuation.

  • C (ndarray, int or float) – The bottom constant (DEV)

Returns:

Estimated attenuation coefficient map (same size as vol)

Return type:

ndarray

Notes

  • This algorithm is inspired by an ultrasound attenuation compensation method.

References

  • Vermeer et al. Depth-resolved model-based reconstruction of attenuation coefficients in optical coherence tomography. Biomed. Opt. Exp., vol5, no1, pp332-337, 2013

linumpy.intensity.attenuation.get_extended_attenuation_vermeer2013(vol, mask=None, k=10, sigma=5, sigma_bottom=3, dz=1, res=6.5, zshift=3, fill_holes=False)[source]#

Compute the local effective tissue attenuation using the extended Vermeer model.

Parameters:
  • vol (ndarray) – OCT volume to process

  • mask (ndarray) – Optional tissue mask. If none is given the water/tissue interface will be detected from the data.

  • k (int) – Median filter kernel size (px) applied before the attenuation coefficient computation (applied in the XY direction).

  • sigma (int) – Gaussian filter kernel size (px) applied axially before the exponential signal fit used to extend the Alines for the extended Vermeer signal evalution.

  • sigma_bottom (int) – Gaussian filter kernel size (px) applied axially on the bottom slice signal before the extension fit.

  • fill_holes (bool) – If True, fill holes in the tissue mask before computing attenuation.

  • dz (int) – Number of axial pixel to consider when computing the bottom slice signal for the signal extension.

  • res (float) – Axial resolution in micron / pixel

  • zshift (int) – Number of pixel under the water-tissue interface to ignore while fitting the exponential function for signal extension.

Returns:

Computed attenuation coefficients.

Return type:

ndarray

linumpy.intensity.attenuation.get_attenuation_faber2004(vol, mask=None, dz=6.5e-06, N=4)[source]#

Estimates the attenuation coefficient using the Faber2004 model.

Parameters:
  • vol (ndarray) – 3D Reflectivity OCT data

  • mask (ndarray) – Tissue mask to control which points to use in each A-lines. (if None, the whole A-line is used)

  • dz (float) – Axial resolution (in microns/pixel)

  • N (int) – Size of the XY uniform filter used to average A-lines together

Returns:

Estimated attenuation coefficient map (computes a single mu_t per A-line)

Return type:

ndarray

Notes

  • This algorithm uses the confocal PSF and an single-scattering photon model.

  • Assumes a 4X objective setup for now.

References

  • Faber et al. Quantitative measurement of attenuation coefficients of weakly scattering media using optical coherence tomography. Opt. Express 12, 4353-4365 (2004).

linumpy.intensity.attenuation.oct_signal_faber2004_model(z, mu_t=1.0, zR=200.0, z0=100.0)[source]#

Model the oct signal using a single-scattered photons and the confocal PSF.

Parameters:
  • z ((N,) ndarray) – Depth Position along an A-line at which the signal must be computed (in micron)

  • mu_t (float or (N,) ndarray) – Attenuation coefficient (either a single value for the whole column or N values for each position)

  • zR (float) – Apparent Rayleigh length (in micron)

  • z0 (float) – Focal plane depth (in micron)

Returns:

OCT backscattering signal estimated at each z positions

Return type:

ndarray

Notes

  • This is based on the single-scattering photon model from Faber2004.

References

linumpy.intensity.attenuation.split_aline(data, mask)[source]#

Split an A-line into contiguous masked segments.

Parameters:
Return type:

tuple[list, list]

linumpy.intensity.attenuation.get_aline_attenuation(vol, k=1, mask=None)[source]#

Compute the attenuation coefficient for each A-lines.

Parameters:
  • vol (ndarray) – Volume to analyze of size NxMxL

  • k (int) – Number of points to compute

  • mask (ndarray) – Tissue mask to limit the region where the fit is done.

Returns:

Estimated attenuation of size NxMxk

Return type:

ndarray

linumpy.intensity.attenuation.get_gradient_attenuation(vol, mask=None, return_mask=False, low_thresh=0.0, fill_holes=False, sz=3, sxy=0, res=1.0)[source]#

Compute the attenuation coefficient using the log-gradient method.

Parameters:
Return type:

numpy.ndarray | tuple[numpy.ndarray, numpy.ndarray]

linumpy.intensity.attenuation.get_interface_mask(vol, s=0, mask_tissue=True, mask_water_tissue_interface=True)[source]#

Compute a mask excluding tissue interfaces and boundaries.

Parameters:
Return type:

numpy.ndarray

linumpy.intensity.attenuation.find_interface_from_gradient(vol, f=0.005, remove_smooth=False)[source]#

Find the tissue-water interface depth map using gradient magnitude.

Parameters:
Return type:

numpy.ndarray

linumpy.intensity.attenuation.get_heterogeneous_attenuation(vol, mask=None, fill_holes=False)[source]#

Compute heterogeneous attenuation coefficients for each A-line segment.

Parameters:
Return type:

numpy.ndarray

linumpy.intensity.attenuation.get_flat_agarose_profile(vol: numpy.ndarray, return_mask_and_profile: Literal[False] = ...) numpy.ndarray[source]#
linumpy.intensity.attenuation.get_flat_agarose_profile(vol: numpy.ndarray, return_mask_and_profile: Literal[True]) tuple[numpy.ndarray, numpy.ndarray, numpy.ndarray]

Estimate and remove the flat agarose intensity profile from a volume.

linumpy.intensity.attenuation.get_signal_from_attenuation(attn, i0=None, nz=120, mask=None, res=1.0)[source]#

Estimate the signal from the 2D A-Line attenuation map.

Parameters:
  • attn (ndarray) – 2D attenuation coefficient map for each A-line

  • i0 (ndarray) – 2D map of the top slice signal (optional)

  • nz (int) – Number of Aline points

  • mask (ndarray) – Data mask (to limit where the oct signal is simulated)

  • res (float) – Axial resolution in micron / pixel

Returns:

Estimated OCT signal

Return type:

ndarray