ibl_alignment_gui.loaders.transform_loader
Classes
The four ANTs transform files warping a point from SmartSPIM space to the Allen CCF. |
|
Abstract base class for warping channel locations into the Allen CCF. |
|
TransformLoader for the SmartSPIM -> Allen CCF ANTs registration pipeline. |
- class ibl_alignment_gui.loaders.transform_loader.AntsTransformChainFiles(smartspim_template_affine_transform, smartspim_template_warp_transform, template_to_ccf_affine_transform, template_to_ccf_warp_transform)[source]
Bases:
objectThe four ANTs transform files warping a point from SmartSPIM space to the Allen CCF.
The point starts in the SmartSPIM light-sheet anatomical space and ends in the Allen CCF, via the SmartSPIM template. The chain is applied as: light-sheet -> template (affine + warp), then template -> CCF (affine + warp). The affines are inverted when transforming points (points move opposite to images), hence
which_to_invert.- smartspim_template_affine_transformPath
ls_to_template_SyN_0GenericAffine.mat- smartspim_template_warp_transformPath
ls_to_template_SyN_1InverseWarp.nii.gz- template_to_ccf_affine_transformPath
spim_template_to_ccf/syn_0GenericAffine.mat- template_to_ccf_warp_transformPath
spim_template_to_ccf/syn_1InverseWarp.nii.gz
- as_list()[source]
Return the transforms as a list of paths in the order ANTs applies them.
- Return type:
list[str]
- classmethod from_folder(transforms_path)[source]
Discover the four transform files beneath transforms_path.
The light-sheet -> template transforms are located recursively (they live under
SmartSPIM_*/image_atlas_alignment/*/or the legacySmartSPIM_*/registration/), while the template -> CCF transforms live in a fixedspim_template_to_ccf/folder.- Parameters:
transforms_path (Path) – Folder holding the SmartSPIM registration assets.
- Returns:
The resolved transform chain, or None if any of the four files is missing.
- Return type:
AntsTransformChainFiles or None
-
smartspim_template_affine_transform:
Path
-
smartspim_template_warp_transform:
Path
-
template_to_ccf_affine_transform:
Path
-
template_to_ccf_warp_transform:
Path
- class ibl_alignment_gui.loaders.transform_loader.TransformLoader(transforms_path)[source]
Bases:
ABCAbstract base class for warping channel locations into the Allen CCF.
Loads a registration transform and warps points from an atlas’ own physical space into the Allen CCF. Subclasses must implement get_transforms (locate/validate the transform artifacts) and transform_to_ccf (apply the transform to a set of points).
- Parameters:
transforms_path (Path) – Folder containing the transform artifacts.
- property exists: bool
Whether a usable transform was loaded.
- abstractmethod get_transforms()[source]
Locate and validate the transform artifacts, storing them in self.transforms.
Implementations should leave self.transforms as None when the transforms are unavailable, so that exists reports False and downstream code can skip cleanly.
- Return type:
None
- abstractmethod transform_to_ccf(points, atlas)[source]
Warp points from the atlas’ physical space into the Allen CCF.
- Parameters:
points (np.ndarray) – An (N, 3) array of points in the atlas’ physical space (RAS, metres).
atlas (BrainAtlas) – The atlas the points are defined in.
- Returns:
An (N, 3) array of points in the Allen CCF.
- Return type:
np.ndarray
- class ibl_alignment_gui.loaders.transform_loader.TransformLoaderAllen(transforms_path)[source]
Bases:
TransformLoaderTransformLoader for the SmartSPIM -> Allen CCF ANTs registration pipeline.
Loads the four-file ANTs transform chain (see
AntsTransformChainFiles) and warps channel locations from aBrainAtlasAnatomicalphysical space into the Allen CCF.- Parameters:
transforms_path (Path) – Folder holding the SmartSPIM registration assets.
- get_transforms()[source]
Load the ANTs transform chain, requiring antspyx to be installed.
- Return type:
None
- transform_to_ccf(points, atlas)[source]
Warp anatomical points into the Allen CCF using the ANTs transform chain.
- Parameters:
points (np.ndarray) – An (N, 3) array of points in the anatomical atlas space (RAS, metres).
atlas (BrainAtlasAnatomical) – The anatomical atlas the points are defined in. Must carry the SimpleITK intensity and pipeline images used to map into the registration space.
- Returns:
An (N, 3) array of points in the Allen CCF, in the native units of the registration output.
- Return type:
np.ndarray