From 3399470e5330a9686ece0c6fb0126e1d72e333b7 Mon Sep 17 00:00:00 2001 From: Diogo Correia Date: Tue, 1 Oct 2024 16:52:13 +0100 Subject: [PATCH] CELE-103 Update EM tiles and segmentations bucket resources URL --- .../visualizer/backend/visualizer/settings/common.py | 4 ++-- applications/visualizer/backend/visualizer/urls.py | 2 +- applications/visualizer/backend/visualizer/views.py | 6 +++--- applications/visualizer/frontend/src/models/models.ts | 10 ++++++++-- 4 files changed, 14 insertions(+), 8 deletions(-) diff --git a/applications/visualizer/backend/visualizer/settings/common.py b/applications/visualizer/backend/visualizer/settings/common.py index d29bc555..e209141f 100644 --- a/applications/visualizer/backend/visualizer/settings/common.py +++ b/applications/visualizer/backend/visualizer/settings/common.py @@ -158,5 +158,5 @@ # DATASET_EMDATA_URL_FORMAT = ( # f"resources/sem-adult/catmaid-tiles/{{index}}/{{x}}_{{y}}_{{z}}.jpg" # ) -DATASET_EMDATA_URL_FORMAT = f"resources/{{index}}/{{x}}_{{y}}_{{z}}.jpg" -DATASET_EMDATA_SEGMENTATION_URL_FORMAT = f"resources/sem-adult/segmentation-mip0/Dataset8_segmentation_withsoma_Mona_updated_20230127.vsseg_export_s{{index}}.json" +DATASET_EMDATA_URL_FORMAT = f"resources/{{dataset}}/em/{{index}}/{{x}}_{{y}}_{{z}}.jpg" +DATASET_EMDATA_SEGMENTATION_URL_FORMAT = f"resources/{{dataset}}/segmentations/s{{index}}.json" diff --git a/applications/visualizer/backend/visualizer/urls.py b/applications/visualizer/backend/visualizer/urls.py index f2632025..ec4cf48b 100644 --- a/applications/visualizer/backend/visualizer/urls.py +++ b/applications/visualizer/backend/visualizer/urls.py @@ -28,7 +28,7 @@ path("api/", api.urls), *static(settings.STATIC_URL, document_root=settings.STATIC_ROOT), re_path( - r"resources/(?P\d+)/(?P\d+)_(?P\d+)_(?P\d+).jpg", + r"resources/(?P\d+)/em/(?P\d+)/(?P\d+)_(?P\d+)_(?P\d+).jpg", get_tile, name="em_resources", ), diff --git a/applications/visualizer/backend/visualizer/views.py b/applications/visualizer/backend/visualizer/views.py index 3e65b6ef..c27b2be4 100644 --- a/applications/visualizer/backend/visualizer/views.py +++ b/applications/visualizer/backend/visualizer/views.py @@ -38,10 +38,10 @@ def index(request, path="", already_asked=False): MAX_ZOOM = 6 # Should be set -def get_tile(request, slice, x, y, zoom): +def get_tile(request, dataset, slice, x, y, zoom): path = ( - Path("sem-adult") - / "catmaid-tiles" + Path(dataset) + / "em" / f"{slice}" / f"{y}_{x}_{MAX_ZOOM - int(zoom)}.jpg" ) diff --git a/applications/visualizer/frontend/src/models/models.ts b/applications/visualizer/frontend/src/models/models.ts index aaa74055..d4d2c9d8 100644 --- a/applications/visualizer/frontend/src/models/models.ts +++ b/applications/visualizer/frontend/src/models/models.ts @@ -60,11 +60,17 @@ export function getNeuronURL(dataset: Dataset, neuronName: string): string { } export function getSegmentationURL(dataset: Dataset, sliceIndex: number): string { - return buildUrlFromFormat(dataset.emData.segmentation_url, sliceIndex?.toString()); + return buildUrlFromFormat( + buildUrlFromFormat(dataset.emData.segmentation_url, dataset.id), + sliceIndex?.toString(), + ); } export function getEMDataURL(dataset: Dataset, sliceIndex: number): string { - return buildUrlFromFormat(dataset.emData.resource_url, sliceIndex?.toString()); + return buildUrlFromFormat( + buildUrlFromFormat(dataset.emData.resource_url, dataset.id), + sliceIndex?.toString(), + ); } export enum Alignment {