Skip to content

Commit

Permalink
Fix sample data loading to be independent of current working directory (
Browse files Browse the repository at this point in the history
  • Loading branch information
IgorTatarnikov authored Aug 6, 2024
1 parent 149a183 commit f365acf
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 3 deletions.
9 changes: 6 additions & 3 deletions brainglobe_registration/napari.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,13 @@ contributions:
- id: brainglobe-registration.make_registration_widget
python_name: brainglobe_registration.registration_widget:RegistrationWidget
title: BrainGlobe Registration
- id: brainglobe-registration.load_sample
python_name: brainglobe_registration.sample_data:load_sample_data
title: Sample Data
sample_data:
- key: example
display_name: Sample Brain Slice
uri: src/brainglobe_registration/resources/sample_hipp.tif
- command: brainglobe-registration.load_sample
display_name: Sample Data
key: example
widgets:
- command: brainglobe-registration.make_registration_widget
display_name: BrainGlobe Registration
21 changes: 21 additions & 0 deletions brainglobe_registration/sample_data.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
from importlib.resources import files
from typing import List

from napari.types import LayerData
from tifffile import imread


def load_sample_data() -> List[LayerData]:
"""
Load the sample data.
Returns
-------
List[LayerData]
The sample data.
"""
path = str(
files("brainglobe_registration").joinpath("resources/sample_hipp.tif")
)

return [(imread(path), {"name": "Sample Data"})]

0 comments on commit f365acf

Please sign in to comment.