DirichletInitBaseAtlas#

class hypercoil.init.atlas.DirichletInitBaseAtlas(mask_source: Any, compartment_labels: Dict[str, int], conc: float | None = 100.0, template_image: str | None = None, init: Dict[str, Callable] | None = None, name: str | None = None, *, key: jax.random.PRNGKey, **params)[source]#

Abstract base class for atlases initialised from a Dirichlet distribution. See BaseAtlas for general details.

Parameters:
mask_source

Source of data used to create an overall mask for the atlas.

compartment_labelsdict(int)

Number of labels to initialise for each compartment.

concfloat

If this is provided and init is not, then the Dirichlet distributions used to sample assignments of spatial locations to parcels are defined with the same concentration parameter, conc, for each parcel.

template_image

Template used to define the spatial dimensions and coordinates of the atlas. If this is not provided explicitly, then the mask source image is used by default.

initdict(Dirichlet)

Dict mapping from compartment names to the Dirichlet distributions used for parcel assignment initialisation in each compartment.

Methods Documentation

__call__(compartments: bool | Sequence[str] = True, normalise: bool = False, sigma: float | None = None, noise: Callable | None = None, max_bin: int = 10000, spherical_scale: float = 1, truncate: float | None = None) Dict[str, Tensor][source]#

Compute transformed maps for selected atlas subcompartments.

Parameters:
compartmentsiterable, False, or True (default True)

Compartments for which transformed maps should be computed. If this is set to False, then a single transformed map is returned for the combined compartment containing all spatial locations. If this is set to True, then a transformed map is returned for every defined compartment.

normalisebool (default False)

Indicates that maps should be spatially normalised such that the sum over all assignments to a parcel is equal to 1. When the map is used as a linear transformation, this option results in computation of a weighted average over each parcel.

sigmafloat or None (default None)

If this is not None, then spatial smoothing using a Gaussian kernel is applied over each parcel’s assignments. Distances are established by the atlas’s coordinate system and the topology of each compartment. The value of sigma establishes the width of the Gaussian kernel.

noisecallable or None

If this is a callable, then it should be a mapping from a tensor to another tensor of the same dimensions. After spatial smoothing but before normalisation, this callable is applied to each map tensor to inject noise.

max_binint (default 10000)

Because spatial smoothing has substantial memory overhead, this flag sets a ceiling on the number of spatial locations to be smoothed at a time.

spherical_scalefloat (default 1)

During spatial smoothing, the Gaussian kernel is scaled by this value for spherical coordinate systems only. This enables the use of different kernel widths for spherical and Euclidean coordinates.

truncatefloat

Maximum distance at which data points are convolved together during smoothing.

Returns:
dict(tensor)

Dictionary of transformed maps for each specified atlas compartment.