cedalion.dot.utils
Utility functions for image reconstruction.
Functions
Create a mock activation below a point. |
|
Find for each voxel the closest vertex on the surface. |
|
|
Create a normal hrf. |
- cedalion.dot.utils.map_segmentation_mask_to_surface(
- segmentation_mask: DataArray,
- transform_vox2ras: DataArray,
- surface: Surface,
Find for each voxel the closest vertex on the surface.
- Parameters:
segmentation_mask (xr.DataArray) – A binary mask of shape (segmentation_type, i, j, k).
transform_vox2ras (xr.DataArray) – The affine transformation from voxel to RAS space.
surface (cedalion.dataclasses.Surface) – The surface to map the voxels to.
- Returns:
- A sparse matrix of shape (ncells, nvertices) that maps voxels to
cells.
- Return type:
coo_array
- cedalion.dot.utils.normal_hrf(t, t_peak, t_std, vmax)[source]
Create a normal hrf.
- Parameters:
t (np.ndarray) – The time points.
t_peak (float) – The peak time.
t_std (float) – The standard deviation.
vmax (float) – The maximum value of the HRF.
- Returns:
The HRF.
- Return type:
np.ndarray
- cedalion.dot.utils.create_mock_activation_below_point(
- head_model: TwoSurfaceHeadModel,
- point: Annotated[DataArray, DataArraySchema(dims='label', coords='label', 'label', 'type')],
- time_length: Annotated[Quantity, '[time]'],
- sampling_rate: Annotated[Quantity, '[frequency]'],
- spatial_size: Annotated[Quantity, '[length]'],
- vmax: float,
Create a mock activation below a point.
- Parameters:
head_model – The head model.
point – The point below which to create the activation.
time_length – The length of the activation.
sampling_rate – The sampling rate.
spatial_size – The spatial size of the activation.
vmax – The maximum value of the activation.
- Returns:
The activation.
- Return type:
xr.DataArray