Skip to content

registry

lacuna.assets.masks.registry

Brain mask registry.

Binary brain masks per coordinate space and resolution. The masks are the TemplateFlow desc-brain masks, redistributed via OSF (https://osf.io/yz9mb/) and downloaded (with SHA-256 verification) and cached on first use. They define the in-brain voxels for operations that need one — e.g. extracting the GSP1000 functional connectome on the MNI152NLin6Asym 2 mm grid.

BrainMaskMetadata dataclass

Bases: SpatialAssetMetadata

Metadata for a binary brain mask.

Attributes:

Name Type Description
space str

Coordinate space (e.g. "MNI152NLin6Asym").

resolution float

Voxel resolution in mm (1.0 or 2.0).

url str

Download URL (fetched and cached on first use).

sha256 str

Expected SHA-256 of the file (verified on download).

source str

Origin of the mask data.

Source code in src/lacuna/assets/masks/registry.py
@dataclass(frozen=True)
class BrainMaskMetadata(SpatialAssetMetadata):
    """Metadata for a binary brain mask.

    Attributes
    ----------
    space : str
        Coordinate space (e.g. "MNI152NLin6Asym").
    resolution : float
        Voxel resolution in mm (1.0 or 2.0).
    url : str
        Download URL (fetched and cached on first use).
    sha256 : str
        Expected SHA-256 of the file (verified on download).
    source : str
        Origin of the mask data.
    """

    url: str = ""
    sha256: str = ""
    source: str = "templateflow"

mask_name(space, resolution)

Registry key for a brain mask, e.g. MNI152NLin6Asym_2mm.

Source code in src/lacuna/assets/masks/registry.py
def mask_name(space: str, resolution: float) -> str:
    """Registry key for a brain mask, e.g. ``MNI152NLin6Asym_2mm``."""
    return f"{space}_{resolution:g}mm"