loader
lacuna.assets.transforms.loader
¶
Transform loading.
Loads spatial transforms between template spaces. The nonlinear warps between
MNI152NLin6Asym and MNI152NLin2009cAsym are generated by TemplateFlow and
redistributed via OSF; they are downloaded (with SHA-256 verification) and
cached locally on first use via pooch.
is_transform_cached(name)
¶
Check if a transform is already cached locally (without downloading).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Transform name from registry. |
required |
Returns:
| Type | Description |
|---|---|
bool
|
True if the transform file is already present in the local cache. |
Source code in src/lacuna/assets/transforms/loader.py
load_transform(name)
¶
Load a spatial transform by name, downloading and caching on first use.
Supports space equivalence: anatomically identical spaces like MNI152NLin2009[abc]Asym are automatically normalized to their canonical form (cAsym) before lookup.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Transform name from registry (e.g., "MNI152NLin6Asym_to_MNI152NLin2009cAsym"). |
required |
Returns:
| Type | Description |
|---|---|
Path
|
Path to the locally cached transform (.h5) file. |
Raises:
| Type | Description |
|---|---|
KeyError
|
If the transform is not found in the registry. |
FileNotFoundError
|
If the transform has no download URL or the download fails. |
Examples:
>>> from lacuna.assets.transforms import load_transform
>>> transform_path = load_transform("MNI152NLin6Asym_to_MNI152NLin2009cAsym")
>>> print(transform_path.exists())
True