diff --git a/src/napari_cryoet_data_portal/_sample_data.py b/src/napari_cryoet_data_portal/_sample_data.py index adb8934..b368e32 100644 --- a/src/napari_cryoet_data_portal/_sample_data.py +++ b/src/napari_cryoet_data_portal/_sample_data.py @@ -1,13 +1,10 @@ from typing import List import numpy as np -from npe2.types import FullLayerData from cryoet_data_portal import Client, Tomogram, TomogramVoxelSpacing +from npe2.types import FullLayerData -from napari_cryoet_data_portal import ( - read_annotation, - read_tomogram, -) +from napari_cryoet_data_portal import read_annotation, read_tomogram def tomogram_10000_ts_026() -> List[FullLayerData]: @@ -22,9 +19,13 @@ def tomogram_10000_ts_027() -> List[FullLayerData]: def _read_tomogram_from_10000(name: str) -> List[FullLayerData]: client = Client() - + tomogram_spacing_url = f"https://files.cryoetdataportal.cziscience.com/10000/{name}/Tomograms/VoxelSpacing13.480/" - tomogram_spacing = next(TomogramVoxelSpacing.find(client, [TomogramVoxelSpacing.https_prefix == tomogram_spacing_url])) + tomogram_spacing = next( + TomogramVoxelSpacing.find( + client, [TomogramVoxelSpacing.https_prefix == tomogram_spacing_url] + ) + ) tomogram: Tomogram = next(tomogram_spacing.tomograms) @@ -34,8 +35,18 @@ def _read_tomogram_from_10000(name: str) -> List[FullLayerData]: tomogram_image[1]["scale"] = (4, 4, 4) annotations = tuple(tomogram_spacing.annotations) - ribosome_points = read_annotation(annotations[0], tomogram=tomogram) - fatty_acid_points = read_annotation(annotations[1], tomogram=tomogram) + ribosome_annotations = [ + item + for item in annotations + if item.object_name.lower() == "cytosolic ribosome" + ].pop() + fas_annotations = [ + item + for item in annotations + if item.object_name.lower() == "fatty acid synthase" + ].pop() + ribosome_points = read_annotation(ribosome_annotations, tomogram=tomogram) + fatty_acid_points = read_annotation(fas_annotations, tomogram=tomogram) return [ tomogram_image,