Skip to content

Commit

Permalink
Fix missing EM_DATA_FOLDER variable
Browse files Browse the repository at this point in the history
  • Loading branch information
aranega committed Aug 13, 2024
1 parent 6c45616 commit 38bf859
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,3 @@
"TEST": {"NAME": BASE_DIR / "tests" / "testdb.sqlite3"},
}
}


EM_DATA_FOLDER = BASE_DIR.parent.parent.parent / "SEM_adult_catmaid_tiles"
3 changes: 1 addition & 2 deletions applications/visualizer/backend/visualizer/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
from django.conf.urls.static import static

from api.api import api
from .views import index, access_bucket_artifact, get_tile, get_seg
from .views import index, access_bucket_artifact, get_tile

urlpatterns = [
path("admin/", admin.site.urls),
Expand All @@ -30,7 +30,6 @@
re_path(
r"^emdata/(?P<slice>\d+)/(?P<x>\d+)_(?P<y>\d+)_(?P<zoom>\d+).jpg", get_tile
),
re_path(r"^segdata/(?P<slice>\d+)", get_seg),
re_path(
r"resources/(?P<slice>\d+)/(?P<x>\d+)_(?P<y>\d+)_(?P<zoom>\d+).jpg",
get_tile,
Expand Down
26 changes: 0 additions & 26 deletions applications/visualizer/backend/visualizer/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
from django.urls import reverse
from django.utils._os import safe_join

from .settings import EM_DATA_FOLDER
from PIL import Image


Expand Down Expand Up @@ -49,31 +48,6 @@ def get_tile(request, slice, x, y, zoom):
)

return access_bucket_artifact(request, path)
# full_path = Path(safe_join(EM_DATA_FOLDER, path))
# content_type, _ = mimetypes.guess_type(str(full_path))
# content_type = content_type or "application/octet-stream"
# if not full_path.exists():
# content = BLACK_TILE_BUFFER.getbuffer()
# # raise Http404()
# else:
# content = full_path.open("rb")

# return FileResponse(content, content_type=content_type)


def get_seg(request, slice):
path = Path(
f"Dataset8_segmentation_withsoma_Mona_updated_20230127.vsseg_export_s{int(slice):03d}.json"
)

full_path = Path(
safe_join(EM_DATA_FOLDER.parent / "SEM_adult_segmentation_mip0/", path)
)

content_type, _ = mimetypes.guess_type(str(full_path))
content_type = content_type or "application/octet-stream"
content = full_path.open("rb")
return FileResponse(content, content_type=content_type)


def access_bucket_artifact(request, path):
Expand Down

0 comments on commit 38bf859

Please sign in to comment.