Skip to content

Commit

Permalink
Release v0.8.3
Browse files Browse the repository at this point in the history
  • Loading branch information
lucalianas committed Feb 17, 2022
2 parents 1837456 + 8330766 commit 6ea14e2
Show file tree
Hide file tree
Showing 5 changed files with 57 additions and 29 deletions.
2 changes: 1 addition & 1 deletion requirements_server.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ django-cors-headers==3.2.1
tiledb==0.10.3
zarr==2.8.3
palettable==3.3.0
https://github.com/crs4/ome_seadragon_cache/archive/v0.2.2.zip
https://github.com/crs4/ome_seadragon_cache/archive/v0.2.3.zip
4 changes: 3 additions & 1 deletion slides_manager/ome_engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@ def get_thumbnail(self, size, original_file_source=False, file_mimeype=None):
def get_tile(self, level, column, row, original_file_source=False, file_mimetype=None,
tile_size=None, limit_bounds=None):
tile_size = tile_size if tile_size is not None else settings.DEEPZOOM_TILE_SIZE
limit_bounds = limit_bounds if limit_bounds is not None else settings.DEEPZOOM_LIMIT_BOUNDS
self._check_source_type(original_file_source)
if settings.IMAGES_CACHE_ENABLED:
cache = CacheDriverFactory(settings.IMAGES_CACHE_DRIVER). \
Expand All @@ -211,7 +212,8 @@ def get_tile(self, level, column, row, original_file_source=False, file_mimetype
'row': row,
'tile_size': tile_size,
'image_format': settings.DEEPZOOM_FORMAT,
'rendering_engine': 'omero'
'rendering_engine': 'omero',
'limit_bounds': limit_bounds
}
if cache_params['image_format'].lower() == 'jpeg':
cache_params['image_quality'] = settings.DEEPZOOM_JPEG_QUALITY
Expand Down
4 changes: 3 additions & 1 deletion slides_manager/openslide_engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ def get_tile(self, level, column, row, original_file_source=False, file_mimetype
cache = CacheDriverFactory(settings.IMAGES_CACHE_DRIVER).\
get_cache(settings.CACHE_HOST, settings.CACHE_PORT, settings.CACHE_DB, settings.CACHE_EXPIRE_TIME)
tile_size = tile_size if tile_size is not None else settings.DEEPZOOM_TILE_SIZE
limit_bounds = limit_bounds if limit_bounds is not None else settings.DEEPZOOM_LIMIT_BOUNDS
self.logger.debug('TILE SIZE IS: %s', tile_size)
cache_params = {
'image_id': self.image_id,
Expand All @@ -150,7 +151,8 @@ def get_tile(self, level, column, row, original_file_source=False, file_mimetype
'row': row,
'tile_size': tile_size,
'image_format': settings.DEEPZOOM_FORMAT,
'rendering_engine': 'openslide'
'rendering_engine': 'openslide',
'limit_bounds': limit_bounds
}
if cache_params['image_format'].lower() == 'jpeg':
cache_params['image_quality'] = settings.DEEPZOOM_JPEG_QUALITY
Expand Down
2 changes: 2 additions & 0 deletions urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,8 @@
url(r'mirax/register_slide/$', views.register_mirax_slide, name='ome_seadragon_register_mirax'),
url(r'^mirax/delete_files/(?P<file_name>[\w\-.]+)/$', views.delete_original_files,
name='ome_seadragon_mrxs_delete_files'),
url(r'mirax/details/(?P<slide_id>[\w\-.]+).json$', views.get_mirax_slide_details,
name='ome_seadragon_mirax_details'),
# 3DHISTECH FILES HANDLING --- DEEPZOOM
url(r'^mirax/deepzoom/get/(?P<image_id>[\w\-.]+).dzi$', views.get_image_dzi,
name='ome_seadragon_image_dzi_metadata_mrxs',
Expand Down
74 changes: 48 additions & 26 deletions views.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def check_repository(request):

@login_required()
def start_connection(request, conn=None, **kwargs):
public_user_allowed = strtobool(request.GET.get('allow_public_user', default='true'))
public_user_allowed = bool(strtobool(request.GET.get('allow_public_user', default='true')))
if not public_user_allowed:
if settings.OME_PUBLIC_USER is None:
return HttpResponseServerError('"omero.web.ome_seadragon.ome_public_user" property was not configured on the server')
Expand All @@ -71,14 +71,14 @@ def check_image_path(request, image_id, conn=None, **kwargs):

def get_example_viewer(request, image_id):
base_url = '%s://%s' % (request.META['wsgi.url_scheme'], request.META['HTTP_HOST'])
mirax = strtobool(request.GET.get('mirax_image', default='false'))
mirax = bool(strtobool(request.GET.get('mirax_image', default='false')))
return render(request, 'ome_seadragon/test/test_viewer.html',
{'image_id': image_id, 'host_name': base_url, 'mirax': mirax})


def get_example_viewer_json(request, image_id):
base_url = '%s://%s' % (request.META['wsgi.url_scheme'], request.META['HTTP_HOST'])
mirax = strtobool(request.GET.get('mirax_image', default='false'))
mirax = bool(strtobool(request.GET.get('mirax_image', default='false')))
return render(request, 'ome_seadragon/test/test_viewer_json.html',
{'image_id': image_id, 'host_name': base_url, 'mirax': mirax})

Expand All @@ -99,7 +99,7 @@ def get_example_double_viewer(request, image_a_id, image_b_id):

def get_example_annotations(request, image_id):
base_url = '%s://%s' % (request.META['wsgi.url_scheme'], request.META['HTTP_HOST'])
mirax = strtobool(request.GET.get('mirax_image', default='false'))
mirax = bool(strtobool(request.GET.get('mirax_image', default='false')))
return render(request, 'ome_seadragon/test/test_annotations.html',
{'image_id': image_id, 'host_name': base_url, 'mirax': mirax})

Expand All @@ -112,28 +112,28 @@ def get_example_ome_rois(request, image_id):

def get_example_interactive_markers(request, image_id):
base_url = '%s://%s' % (request.META['wsgi.url_scheme'], request.META['HTTP_HOST'])
mirax = strtobool(request.GET.get('mirax_image', default='false'))
mirax = bool(strtobool(request.GET.get('mirax_image', default='false')))
return render(request, 'ome_seadragon/test/test_markers.html',
{'image_id': image_id, 'host_name': base_url, 'mirax': mirax})


def get_example_interactive_polygons(request, image_id):
base_url = '%s://%s' % (request.META['wsgi.url_scheme'], request.META['HTTP_HOST'])
mirax = strtobool(request.GET.get('mirax_image', default='false'))
mirax = bool(strtobool(request.GET.get('mirax_image', default='false')))
return render(request, 'ome_seadragon/test/test_polygons.html',
{'image_id': image_id, 'host_name': base_url, 'mirax': mirax})


def get_example_interactive_rulers(request, image_id):
base_url = '%s://%s' % (request.META['wsgi.url_scheme'], request.META['HTTP_HOST'])
mirax = strtobool(request.GET.get('mirax_image', default='false'))
mirax = bool(strtobool(request.GET.get('mirax_image', default='false')))
return render(request, 'ome_seadragon/test/test_rulers.html',
{'image_id': image_id, 'host_name': base_url, 'mirax': mirax})


def get_example_interactive_freehand(request, image_id):
base_url = '%s://%s' % (request.META['wsgi.url_scheme'], request.META['HTTP_HOST'])
mirax = strtobool(request.GET.get('mirax_image', default='false'))
mirax = bool(strtobool(request.GET.get('mirax_image', default='false')))
return render(request, 'ome_seadragon/test/test_freehand_drawing.html',
{'image_id': image_id, 'host_name': base_url, 'mirax': mirax})

Expand All @@ -146,7 +146,7 @@ def get_example_array_viewer(request, dataset_label):

def get_example_overlay_viewer(request, image_id, dataset_label):
base_url = '%s://%s' % (request.META['wsgi.url_scheme'], request.META['HTTP_HOST'])
mirax = strtobool(request.GET.get('mirax_image', default='false'))
mirax = bool(strtobool(request.GET.get('mirax_image', default='false')))
return render(request, 'ome_seadragon/test/test_overlay_viewer.html',
{'image_id': image_id, 'dataset_label': dataset_label, 'host_name': base_url ,
'mirax': mirax})
Expand All @@ -155,7 +155,7 @@ def get_example_overlay_viewer(request, image_id, dataset_label):
@login_required()
def get_projects(request, conn=None, **kwargs):
try:
fetch_datasets = strtobool(request.GET.get('datasets'))
fetch_datasets = bool(strtobool(request.GET.get('datasets')))
except (ValueError, AttributeError):
fetch_datasets = False
projects = projects_datasets.get_projects(conn, fetch_datasets)
Expand All @@ -165,15 +165,15 @@ def get_projects(request, conn=None, **kwargs):
@login_required()
def get_project(request, project_id, conn=None, **kwargs):
try:
fetch_datasets = strtobool(request.GET.get('datasets'))
fetch_datasets = bool(strtobool(request.GET.get('datasets')))
except (ValueError, AttributeError):
fetch_datasets = False
try:
fetch_images = strtobool(request.GET.get('images'))
fetch_images = bool(strtobool(request.GET.get('images')))
except (ValueError, AttributeError):
fetch_images = False
try:
expand_series = strtobool(request.GET.get('full_series'))
expand_series = bool(strtobool(request.GET.get('full_series')))
except (ValueError, AttributeError):
expand_series = False
project = projects_datasets.get_project(conn, project_id, fetch_datasets, fetch_images,
Expand All @@ -184,11 +184,11 @@ def get_project(request, project_id, conn=None, **kwargs):
@login_required()
def get_dataset(request, dataset_id, conn=None, **kwargs):
try:
fetch_images = strtobool(request.GET.get('images'))
fetch_images = bool(strtobool(request.GET.get('images')))
except (ValueError, AttributeError):
fetch_images = False
try:
expand_series = strtobool(request.GET.get('full_series'))
expand_series = bool(strtobool(request.GET.get('full_series')))
except (ValueError, AttributeError):
expand_series = False
dataset = projects_datasets.get_dataset(conn, dataset_id, fetch_images,
Expand All @@ -199,7 +199,7 @@ def get_dataset(request, dataset_id, conn=None, **kwargs):
@login_required()
def get_image(request, image_id, conn=None, **kwargs):
try:
fetch_rois = strtobool(request.GET.get('rois'))
fetch_rois = bool(strtobool(request.GET.get('rois')))
except (ValueError, AttributeError):
fetch_rois = False
image = projects_datasets.get_image(conn, image_id, fetch_rois)
Expand All @@ -209,7 +209,7 @@ def get_image(request, image_id, conn=None, **kwargs):
@login_required()
def get_images_quick_list(request, conn=None, **kwargs):
try:
expand_series = strtobool(request.GET.get('full_series'))
expand_series = bool(strtobool(request.GET.get('full_series')))
except (ValueError, AttributeError):
expand_series = False
images_list = projects_datasets.get_images_quick_list(conn, expand_series)
Expand All @@ -219,7 +219,7 @@ def get_images_quick_list(request, conn=None, **kwargs):
@login_required()
def get_annotations(request, conn=None, **kwargs):
try:
fetch_images = strtobool(request.GET.get('fetch_imgs'))
fetch_images = bool(strtobool(request.GET.get('fetch_imgs')))
except (ValueError, AttributeError):
fetch_images = False
annotations = tags_data.get_annotations_list(conn, fetch_images)
Expand All @@ -229,11 +229,11 @@ def get_annotations(request, conn=None, **kwargs):
@login_required()
def get_tagset(request, tagset_id, conn=None, **kwargs):
try:
fetch_tags = strtobool(request.GET.get('tags'))
fetch_tags = bool(strtobool(request.GET.get('tags')))
except (ValueError, AttributeError):
fetch_tags = False
try:
fetch_images = strtobool(request.GET.get('images'))
fetch_images = bool(strtobool(request.GET.get('images')))
except (ValueError, AttributeError):
fetch_images = False
tagset = tags_data.get_tagset(conn, tagset_id, fetch_tags, fetch_images)
Expand All @@ -243,7 +243,7 @@ def get_tagset(request, tagset_id, conn=None, **kwargs):
@login_required()
def get_tag(request, tag_id, conn=None, **kwargs):
try:
fetch_images = strtobool(request.GET.get('images'))
fetch_images = bool(strtobool(request.GET.get('images')))
except (ValueError, AttributeError):
fetch_images = False
tag = tags_data.get_tag(conn, tag_id, fetch_images)
Expand All @@ -254,7 +254,7 @@ def get_tag(request, tag_id, conn=None, **kwargs):
def find_annotations(request, conn=None, **kwargs):
search_pattern = request.GET.get('query')
try:
fetch_images = strtobool(request.GET.get('fetch_imgs'))
fetch_images = bool(strtobool(request.GET.get('fetch_imgs')))
except (ValueError, AttributeError):
fetch_images = False
logger.debug('"fetch_imgs" value %r', fetch_images)
Expand All @@ -269,7 +269,7 @@ def get_image_dzi(request, image_id, fetch_original_file=False, file_mimetype=No
except TypeError:
tile_size = None
try:
limit_bounds = strtobool(request.GET.get('limit_bounds'))
limit_bounds = bool(strtobool(request.GET.get('limit_bounds')))
except AttributeError:
limit_bounds = None
rf = RenderingEngineFactory()
Expand Down Expand Up @@ -371,7 +371,7 @@ def get_tile(request, image_id, level, column, row, tile_format,
except TypeError:
tile_size = None
try:
limit_bounds = strtobool(request.GET.get('limit_bounds'))
limit_bounds = bool(strtobool(request.GET.get('limit_bounds')))
except AttributeError:
limit_bounds = None
if tile_format != settings.DEEPZOOM_FORMAT:
Expand Down Expand Up @@ -481,6 +481,28 @@ def register_mirax_slide(request, conn=None, **kwargs):
return HttpResponseServerError('{0}'.format(sce))


@login_required()
def get_mirax_slide_details(request, slide_id, conn=None, **kwargs):
mirax_data_folder = get_original_file(conn, slide_id, 'mirax/datafolder')
mirax_index_file = get_original_file(conn, slide_id, 'mirax/index')
slide_details = {
'slide_label': slide_id,
'index_file': {
'omero_id': mirax_index_file.getId(),
'label': mirax_index_file.getName(),
'mimetype': mirax_index_file.getMimetype(),
'hash': mirax_index_file.getHash()
},
'data_folder': {
'omero_id': mirax_data_folder.getId(),
'label': mirax_data_folder.getName(),
'mimetype': mirax_data_folder.getMimetype(),
'hash': mirax_data_folder.getHash()
}
}
return HttpResponse(json.dumps(slide_details), content_type='application/json')


@login_required()
def list_array_datasets(request, conn=None, **kwargs):
datasets = datasets_files.get_datasets(conn)
Expand All @@ -495,11 +517,11 @@ def register_array_dataset(request, conn=None, **kwargs):
try:
dataset_path, is_dir = datasets_files.get_dataset_file_path(dataset_label)
if not is_dir:
if strtobool(request.GET.get('extract_archive', default='true')) == False:
if bool(strtobool(request.GET.get('extract_archive', default='true'))) == False:
dataset_label, dataset_path = datasets_files.rename_archive(dataset_path)
else:
try:
keep_archive = strtobool(request.GET.get('keep_archive', default='false'))
keep_archive = bool(strtobool(request.GET.get('keep_archive', default='false')))
dataset_label, dataset_path = datasets_files.extract_archive(dataset_path,
keep_archive=keep_archive)
is_dir = True
Expand Down

0 comments on commit 6ea14e2

Please sign in to comment.