ibl_alignment_gui.loaders.histology_loader
Functions
Download histology data from flatiron server if not already cached locally. |
|
Convert a tif image to nrrd format if the nrrd does not already exist. |
Classes
SliceLoader for histology in the NRRD format. |
|
Abstract base class for loading histology slices. |
- class ibl_alignment_gui.loaders.histology_loader.NrrdSliceLoader(file_path, brain_atlas)[source]
Bases:
SliceLoaderSliceLoader for histology in the NRRD format.
- Parameters:
file_path (Path) – Directory containing .nrrd files.
brain_atlas (AllenAtlas) – Brain atlas for alignment.
- class ibl_alignment_gui.loaders.histology_loader.SliceLoader(file_path, brain_atlas)[source]
Bases:
ABCAbstract base class for loading histology slices.
Subclasses must implement the get_paths and load_volume methods.
- Parameters:
file_path (Path) – Directory containing histology files.
brain_atlas (AllenAtlas) – Reference brain atlas.
- abstractmethod get_paths()[source]
Locate and store relevant histology file paths in self.hist_paths.
- Return type:
None
- get_slice(xyz, vol, annotation=False)[source]
Extract a slice from a 3D volume using given coordinates.
- Parameters:
xyz (np.ndarray) – Nx3 array of XYZ coordinates.
vol (np.ndarray) – 3D volume from which to extract a slice.
- Returns:
A dictionary containing the 2D slice, scale, and offset.
- Return type:
dict[str, np.ndarray]
- ibl_alignment_gui.loaders.histology_loader.download_histology_data(subject, laboratory)[source]
Download histology data from flatiron server if not already cached locally.
- Parameters:
subject (str) – Subject name
laboratory (str) – Laboratory name
- Return type:
tuple[list[Path],Path] |tuple[None,Path]- Returns:
path_to_files (list[Path] or None) – List of paths to downloaded or cached nrrd files, or None if not found.
cache_dir (Path) – Directory where files are cached.