cedalion.dot.image_recon
Solver for the image reconstruction problem.
Module Attributes
Optimal set of regularization parameters according to an optimization study for a ball squeezing dataset. |
|
Optimal set of Gaussian SBF parameters according to an optimization study for a ball squeezing dataset. |
|
A sparse set of gaussians SBFs. |
Classes
|
Gaussian Spatial Basis Functions. |
|
Implements image reconstruction methods for diffuse optical tomography. |
Base for SBF implementations. |
- cedalion.dot.image_recon.REG_PAPER_MUA_SBF = {'alpha_meas': 10000.0, 'alpha_spatial': 0.01, 'apply_c_meas': True}[source]
Optimal set of regularization parameters according to an optimization study for a ball squeezing dataset. .
- cedalion.dot.image_recon.SBF_GAUSSIANS_DENSE = {'mask_threshold': -2, 'sigma_brain': <Quantity(1, 'millimeter')>, 'sigma_scalp': <Quantity(5, 'millimeter')>, 'threshold_brain': <Quantity(1, 'millimeter')>, 'threshold_scalp': <Quantity(5, 'millimeter')>}[source]
Optimal set of Gaussian SBF parameters according to an optimization study for a ball squeezing dataset. .
- cedalion.dot.image_recon.SBF_GAUSSIANS_SPARSE = {'mask_threshold': -2, 'sigma_brain': <Quantity(5, 'millimeter')>, 'sigma_scalp': <Quantity(20, 'millimeter')>, 'threshold_brain': <Quantity(5, 'millimeter')>, 'threshold_scalp': <Quantity(20, 'millimeter')>}[source]
A sparse set of gaussians SBFs.
- class cedalion.dot.image_recon.SpatialBasisFunctions[source]
Bases:
ABCBase for SBF implementations.
- abstractmethod kernel_to_image_space_conc(
- conc_img: DataArray,
Transform an image from kernel to image space in recon. mode ‘conc’.
- abstractmethod kernel_to_image_space_mua(
- mua_img: DataArray,
Transform an image from kernel to image space in recon. mode ‘mua’.
- abstractmethod to_file(fname: Path | str)[source]
Serialize prepared spatial basis functions into a file.
- Parameters:
fname – path of the output file.
- abstractmethod classmethod from_file(
- fname: Path | str,
Load prepared spatial basis functions from a file.
- Parameters:
fname – path of the file to read from.
- Returns:
Loaded spatial basis functions instance.
- Return type:
- class cedalion.dot.image_recon.OriginalGaussianSpatialBasisFunctions(
- head_model: TwoSurfaceHeadModel,
- Adot: DataArray,
- threshold_brain: Annotated[Quantity, '[length]'],
- threshold_scalp: Annotated[Quantity, '[length]'],
- sigma_brain: Annotated[Quantity, '[length]'],
- sigma_scalp: Annotated[Quantity, '[length]'],
- mask_threshold: float,
Bases:
object- kernel_to_image_space_mua(
- X: ndarray,
Convert kernel space reconstructions to image space for mua.
- Parameters:
X – Reconstruction values in kernel space. shape (kernel, …)
- Returns:
Reconstruction values in image space.
- Return type:
np.ndarray
- kernel_to_image_space_conc(X) ndarray[source]
Convert kernel space reconstructions to image space for concentration.
- Parameters:
X – Reconstruction values in kernel space.
- Returns:
Reconstruction values in image space with HbO/HbR split.
- Return type:
np.ndarray
- to_file(fname: Path | str)[source]
Serialize prepared Gaussian spatial basis functions to HDF5 file.
- Parameters:
fname – path of the output file.
- classmethod from_file(
- fname: Path | str,
Load prepared Gaussian spatial basis functions from HDF5 group.
- Parameters:
fname – path of the file to read from.
- Returns:
Loaded instance.
- Return type:
- class cedalion.dot.image_recon.GaussianSpatialBasisFunctions(
- head_model: TwoSurfaceHeadModel,
- Adot: DataArray,
- threshold_brain: Annotated[Quantity, '[length]'],
- threshold_scalp: Annotated[Quantity, '[length]'],
- sigma_brain: Annotated[Quantity, '[length]'],
- sigma_scalp: Annotated[Quantity, '[length]'],
- mask_threshold: float,
Bases:
SpatialBasisFunctionsGaussian Spatial Basis Functions.
Note: This implementation differs from the original one by a factor 2pi in the denominator of the gaussians.
- Parameters:
head_model – a TwoSurfaceHeadModel with brain and scalp surfaces
Adot – the sensitivity matrix
threshold_brain – the distance between kernel centers on the brain
threshold_scalp – the distance between kernel centers on scalp
sigma_brain – the width of the gaussians on the brain
sigma_scalp – the width of the gaussians on the scalp
mask_threshold – log10(sensitivity) threshold for vertices to be considered
- kernel_to_image_space_mua(
- X: ndarray,
Convert kernel space reconstructions to image space for mua.
- Parameters:
X – Reconstruction values in kernel space. shape (kernel, …)
- Returns:
Reconstruction values in image space.
- Return type:
np.ndarray
- kernel_to_image_space_conc(X) ndarray[source]
Convert kernel space reconstructions to image space for concentration.
- Parameters:
X – Reconstruction values in kernel space.
- Returns:
Reconstruction values in image space with HbO/HbR split.
- Return type:
np.ndarray
- to_file(fname: Path | str)[source]
Serialize prepared Gaussian spatial basis functions to HDF5 file.
- Parameters:
fname – path of the output file.
- classmethod from_file(
- fname: Path | str,
Load prepared Gaussian spatial basis functions from HDF5 group.
- Parameters:
fname – path of the file to read from.
- Returns:
Loaded instance.
- Return type:
- class cedalion.dot.image_recon.ImageRecon(
- Adot,
- *,
- alpha_meas: float = 0.001,
- alpha_spatial: float | None = None,
- apply_c_meas: bool = False,
- recon_mode: Literal['conc', 'mua', 'mua2conc'] = 'mua',
- brain_only: bool = False,
- spatial_basis_functions: SpatialBasisFunctions | None = None,
Bases:
objectImplements image reconstruction methods for diffuse optical tomography.
- Parameters:
Adot – the sensitivity matrix
recon_mode –
select reconstruction method
- ’conc’: directly reconstruct hemoglobin concentrations from OD
measurements at different wavelengths
- ’mua’: reconstruct absorption changes from OD measurements for each
wavelength separately.
- ’mua2conc’: reconstruct absorption changes for each wavelength separately.
Afterwards transform these to hemoglobin concentration changes.
brain_only – if set to true, scalp vertices in Adot are ignored and the reconstruction is constrained to brain vertices
alpha_meas – regularization parameter to adjust the balance between image noise and spatial resolution.
alpha_spatial – regularization parameter that controls the effective depth of the reconstruction by controlling how strongly the vertex sensitivities are rescaled. A smaller alpha_spatial will more strongly suppress activation that is reconstructed on the scalp.
apply_c_meas – controls whether the provided measurement covariance should be used for measurement regularization.
spatial_basis_functions – if given reconstruct in the kernel space defined by the provided spatial-basis-function implementation. The result is returned in image space.
- reconstruct(
- y: Annotated[DataArray, DataArraySchema(dims='time', coords='time', 'time', 'samples')],
- c_meas: DataArray | None = None,
Reconstruct images from measurement data.
- Parameters:
y – optical density time series or time point data.
c_meas – Diagonal elements of the measurement covariance matrix (optional). dims: wavelength x channel.
- Returns:
Reconstructed images.
- get_image_noise(c_meas: DataArray)[source]
Compute image noise/variance estimates.
- Parameters:
c_meas – Measurement covariance matrix.
- Returns:
Image noise estimates.
- Return type:
xr.DataArray
- get_image_noise_tstat(
- time_series: Annotated[DataArray, DataArraySchema(dims='time', coords='time', 'time', 'samples')],
- c_meas: DataArray | None = None,
Compute t-statistic images from noise estimates.
- Parameters:
time_series – Time series data for statistics computation.
c_meas – Measurement covariance matrix (optional).
- Returns:
T-statistic images.
- Return type:
xr.DataArray