Skip to content

Commit

Permalink
CELE-103 Update EM tiles and segmentations bucket resources URL
Browse files Browse the repository at this point in the history
  • Loading branch information
dvcorreia committed Oct 1, 2024
1 parent 018243e commit 3399470
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 8 deletions.
4 changes: 2 additions & 2 deletions applications/visualizer/backend/visualizer/settings/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
2 changes: 1 addition & 1 deletion applications/visualizer/backend/visualizer/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
path("api/", api.urls),
*static(settings.STATIC_URL, document_root=settings.STATIC_ROOT),
re_path(
r"resources/(?P<slice>\d+)/(?P<x>\d+)_(?P<y>\d+)_(?P<zoom>\d+).jpg",
r"resources/(?P<dataset>\d+)/em/(?P<slice>\d+)/(?P<x>\d+)_(?P<y>\d+)_(?P<zoom>\d+).jpg",
get_tile,
name="em_resources",
),
Expand Down
6 changes: 3 additions & 3 deletions applications/visualizer/backend/visualizer/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand Down
10 changes: 8 additions & 2 deletions applications/visualizer/frontend/src/models/models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 3399470

Please sign in to comment.