@@ -525,20 +525,33 @@ def image_viewer(request, iid, conn=None, **kwargs):
525525 """
526526 Check if image is OME-Zarr (externalInfo) before returning iviewer response
527527 """
528+ return image_landing_page (request , iid , zarr_to_iviewer = True , conn = conn , ** kwargs )
529+
530+
531+ @login_required ()
532+ @render_response ()
533+ def image_landing_page (request , iid , zarr_to_iviewer = False , conn = None , ** kwargs ):
534+
528535 image = conn .getObject ("Image" , iid )
529536
530537 from omero_iviewer .views import index as iviewer_index
531538
532539 if image is None :
533540 raise Http404 ("Image with ID %s not found" % iid )
534541
535- # if not image.archived:
536- # return iviewer_index(request, iid, conn=conn, **kwargs)
537-
538- ext_info = image .getDetails ().externalInfo
539- if ext_info is not None :
540- # TODO check for lsid etc
542+ # If image has ExternalInfo, it's OME-Zarr and we can go straight to iviewer
543+ ext_info = image .getDetails ().getExternalInfo ()
544+ if ext_info and ext_info .lsid and zarr_to_iviewer :
541545 return iviewer_index (request , iid , conn = conn , ** kwargs )
546+
547+ ext_info_json = None
548+ if ext_info :
549+ ext_info_json = {
550+ "lsid" : ext_info .lsid ,
551+ "entityType" : ext_info .entityType ,
552+ "entityId" : ext_info .entityId ,
553+ "id" : ext_info .id ,
554+ }
542555
543556 # Image is archived and has no ExternalInfo - show other options...
544557 img_info = get_image_info (conn , image .id )
@@ -555,15 +568,10 @@ def image_viewer(request, iid, conn=None, **kwargs):
555568 idrid_name = parents [- 1 ].name # e.g. idr0002-heriche-condensation/experimentA
556569 idrid_name = idrid_name .split ("/" )[0 ] # e.g. idr0002-heriche-condensation
557570
558- bia_ngff_id = None
559-
560- if data_location == "Embassy_S3" :
561- # "mkngff" data is at https://livingobjects.ebi.ac.uk/bioimaging-integrator-data/pages/idr_ngff_data.html
562- bia_ngff_id = img_path .split (BIA_URL , 1 )[- 1 ].split ("/" , 1 )[0 ]
563-
564571 rsp_json = {
565572 "idr_study" : idrid_name ,
566- "template" : "idr_gallery/archived_image.html" ,
573+ "ext_info" : ext_info_json ,
574+ "template" : "idr_gallery/image.html" ,
567575 "image" : {
568576 "id" : image .id ,
569577 "name" : image .name ,
0 commit comments