Skip to content

Commit

Permalink
Changed check workflow from docker-compose to docker compose.
Browse files Browse the repository at this point in the history
  • Loading branch information
maubreville committed Nov 15, 2024
1 parent 75672ad commit 865e957
Show file tree
Hide file tree
Showing 4 changed files with 87 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/dockerimage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ jobs:
steps:
- uses: actions/checkout@v1
- name: Build the Docker image
run: docker-compose -f docker-compose.yml up -d --build
run: docker compose -f docker-compose.yml up -d --build
2 changes: 1 addition & 1 deletion exact/exact/images/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
re_path(r'^image/(\d+)/(\d+)/(\d+)/tile_files/(\d+)/(\d+_\d+.(?:png|jpeg))$', views.view_image_tile, name='view_image_tile'),
re_path(r'^api/image/verify/$', views.api_verify_image, name='verify_image'),

re_path(r'^api/image/plugins/$', views.image_plugins, name='plugins'),
re_path(r'^api/image/plugins/$', views.image_plugins, name='image_plugins'),


re_path(r'^api/image/navigator_overlay_status/$', views.navigator_overlay_status, name='navigator_overlay_status'),
Expand Down
75 changes: 75 additions & 0 deletions exact/test_zstacks.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"from util.slide_server import getSlideHandler"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [
{
"ename": "TypeError",
"evalue": "OMETiffSlide.__init__() got an unexpected keyword argument 'series'",
"output_type": "error",
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mTypeError\u001b[0m Traceback (most recent call last)",
"File \u001b[0;32m~/code/Exact/exact/util/slide_server.py:326\u001b[0m, in \u001b[0;36mgetSlideHandler\u001b[0;34m(path)\u001b[0m\n\u001b[1;32m 325\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[0;32m--> 326\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mfilehandler\u001b[49m\u001b[43m(\u001b[49m\u001b[43mpath\u001b[49m\u001b[43m)\u001b[49m \n\u001b[1;32m 327\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m \u001b[38;5;167;01mException\u001b[39;00m \u001b[38;5;28;01mas\u001b[39;00m e:\n",
"File \u001b[0;32m~/code/Exact/exact/util/slide_server.py:213\u001b[0m, in \u001b[0;36mGenericTiffHandler.__new__\u001b[0;34m(self, file)\u001b[0m\n\u001b[1;32m 211\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28mlen\u001b[39m(f\u001b[38;5;241m.\u001b[39mseries) \u001b[38;5;241m>\u001b[39m \u001b[38;5;241m1\u001b[39m:\n\u001b[1;32m 212\u001b[0m \u001b[38;5;66;03m# We assume Zstacks are stored as multiple series\u001b[39;00m\n\u001b[0;32m--> 213\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mtype\u001b[39;49m\u001b[43m(\u001b[49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[38;5;124;43mOMETiffZStack\u001b[39;49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43m(\u001b[49m\u001b[43mOMETiffZStack\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mopenslide\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mOpenSlide\u001b[49m\u001b[43m)\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43m{\u001b[49m\u001b[43m}\u001b[49m\u001b[43m)\u001b[49m\u001b[43m(\u001b[49m\u001b[43mfile\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 214\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n",
"File \u001b[0;32m<string>:4\u001b[0m, in \u001b[0;36m__init__\u001b[0;34m(self, filename)\u001b[0m\n",
"File \u001b[0;32m~/code/Exact/exact/util/tiffzstack.py:216\u001b[0m, in \u001b[0;36mOMETiffZStack.__post_init__\u001b[0;34m(self)\u001b[0m\n\u001b[1;32m 215\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_init_metadata()\n\u001b[0;32m--> 216\u001b[0m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_init_z_stack\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\n",
"File \u001b[0;32m~/code/Exact/exact/util/tiffzstack.py:335\u001b[0m, in \u001b[0;36mOMETiffZStack._init_z_stack\u001b[0;34m(self)\u001b[0m\n\u001b[1;32m 334\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[0;32m--> 335\u001b[0m zstack[idx] \u001b[38;5;241m=\u001b[39m \u001b[43mOMETiffSlide\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mfilename\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mseries\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43midx\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 338\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mzstack \u001b[38;5;241m=\u001b[39m zstack\n",
"\u001b[0;31mTypeError\u001b[0m: OMETiffSlide.__init__() got an unexpected keyword argument 'series'",
"\nDuring handling of the above exception, another exception occurred:\n",
"\u001b[0;31mTypeError\u001b[0m Traceback (most recent call last)",
"Cell \u001b[0;32mIn[2], line 1\u001b[0m\n\u001b[0;32m----> 1\u001b[0m fh \u001b[38;5;241m=\u001b[39m \u001b[43mgetSlideHandler\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[38;5;124;43m/Users/marcaubreville/Downloads/LYM_002_c_VMU_3DHP1_HE_zStack.ome.tif\u001b[39;49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[43m)\u001b[49m\n",
"File \u001b[0;32m~/code/Exact/exact/util/slide_server.py:328\u001b[0m, in \u001b[0;36mgetSlideHandler\u001b[0;34m(path)\u001b[0m\n\u001b[1;32m 326\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m filehandler(path) \n\u001b[1;32m 327\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m \u001b[38;5;167;01mException\u001b[39;00m \u001b[38;5;28;01mas\u001b[39;00m e:\n\u001b[0;32m--> 328\u001b[0m \u001b[38;5;28mprint\u001b[39m(\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mUnable to open file handler. :-()\u001b[39m\u001b[38;5;124m'\u001b[39m,\u001b[43mfilehandler\u001b[49m\u001b[43m(\u001b[49m\u001b[43mpath\u001b[49m\u001b[43m)\u001b[49m, e)\n\u001b[1;32m 329\u001b[0m \u001b[38;5;28;01mpass\u001b[39;00m\n\u001b[1;32m 331\u001b[0m \u001b[38;5;66;03m# as last resort, try openSlide:\u001b[39;00m\n",
"File \u001b[0;32m~/code/Exact/exact/util/slide_server.py:213\u001b[0m, in \u001b[0;36mGenericTiffHandler.__new__\u001b[0;34m(self, file)\u001b[0m\n\u001b[1;32m 210\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m f\u001b[38;5;241m.\u001b[39mome_metadata:\n\u001b[1;32m 211\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28mlen\u001b[39m(f\u001b[38;5;241m.\u001b[39mseries) \u001b[38;5;241m>\u001b[39m \u001b[38;5;241m1\u001b[39m:\n\u001b[1;32m 212\u001b[0m \u001b[38;5;66;03m# We assume Zstacks are stored as multiple series\u001b[39;00m\n\u001b[0;32m--> 213\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mtype\u001b[39;49m\u001b[43m(\u001b[49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[38;5;124;43mOMETiffZStack\u001b[39;49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43m(\u001b[49m\u001b[43mOMETiffZStack\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mopenslide\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mOpenSlide\u001b[49m\u001b[43m)\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43m{\u001b[49m\u001b[43m}\u001b[49m\u001b[43m)\u001b[49m\u001b[43m(\u001b[49m\u001b[43mfile\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 214\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m 215\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mtype\u001b[39m(\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mOMETiffSlide\u001b[39m\u001b[38;5;124m'\u001b[39m, (OMETiffSlideWrapper, openslide\u001b[38;5;241m.\u001b[39mOpenSlide), {})(file)\n",
"File \u001b[0;32m<string>:4\u001b[0m, in \u001b[0;36m__init__\u001b[0;34m(self, filename)\u001b[0m\n",
"File \u001b[0;32m~/code/Exact/exact/util/tiffzstack.py:216\u001b[0m, in \u001b[0;36mOMETiffZStack.__post_init__\u001b[0;34m(self)\u001b[0m\n\u001b[1;32m 213\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mtif \u001b[38;5;241m=\u001b[39m TiffFile(\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mfilename)\n\u001b[1;32m 215\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_init_metadata()\n\u001b[0;32m--> 216\u001b[0m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_init_z_stack\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\n",
"File \u001b[0;32m~/code/Exact/exact/util/tiffzstack.py:335\u001b[0m, in \u001b[0;36mOMETiffZStack._init_z_stack\u001b[0;34m(self)\u001b[0m\n\u001b[1;32m 332\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mthumbnail \u001b[38;5;241m=\u001b[39m ThumbNail(\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mfilename, series\u001b[38;5;241m=\u001b[39midx)\n\u001b[1;32m 334\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[0;32m--> 335\u001b[0m zstack[idx] \u001b[38;5;241m=\u001b[39m \u001b[43mOMETiffSlide\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mfilename\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mseries\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43midx\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 338\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mzstack \u001b[38;5;241m=\u001b[39m zstack\n",
"\u001b[0;31mTypeError\u001b[0m: OMETiffSlide.__init__() got an unexpected keyword argument 'series'"
]
}
],
"source": [
"fh = getSlideHandler('/Users/marcaubreville/Downloads/LYM_002_c_VMU_3DHP1_HE_zStack.ome.tif')"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "env311",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.9"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
12 changes: 10 additions & 2 deletions exact/util/slide_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,10 @@ def read_region(self, location, level, size, frame=0):
# Any corner of the requested region may be outside the bounds of
# the image. Create a transparent tile of the correct size and
# paste the valid part of the region into the correct location.

if (frame>=self.numberOfLayers):
frame=self.numberOfLayers-1

image_topleft = [max(0, min(l, limit - 1))
for l, limit in zip(location, self._image.size)]
image_bottomright = [max(0, min(l + s - 1, limit - 1))
Expand Down Expand Up @@ -321,7 +325,7 @@ def getSlideHandler(path):
try:
return filehandler(path)
except Exception as e:
print('Unable to open file handler. :-()')
print('Unable to open file handler. :-()', e)
pass

# as last resort, try openSlide:
Expand All @@ -338,6 +342,11 @@ def __init__(self, cache_size):
self.cache_size = cache_size
self._lock = Lock()
self._cache = OrderedDict()

def reset(self):
with self._lock:
self._cache = OrderedDict()


def get(self, path):
with self._lock:
Expand All @@ -361,7 +370,6 @@ def get(self, path):
if len(self._cache) == self.cache_size:
self._cache.popitem(last=False)
self._cache[path] = slide
print('Added to cache')
return slide

class SlideFile(object):
Expand Down

0 comments on commit 865e957

Please sign in to comment.