From 25b3171de50686a4790f25e93265193e272adf43 Mon Sep 17 00:00:00 2001 From: Tom-TBT Date: Fri, 11 Oct 2024 09:39:11 +0200 Subject: [PATCH 1/3] query timestamps from all planes when C or Z dim not filled --- plugin/omero_iviewer/views.py | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/plugin/omero_iviewer/views.py b/plugin/omero_iviewer/views.py index 1cfd4f2e6..5c13c0253 100644 --- a/plugin/omero_iviewer/views.py +++ b/plugin/omero_iviewer/views.py @@ -555,12 +555,20 @@ def delta_t_data(request, image_id, conn=None, **kwargs): if size_t > 1: params = omero.sys.ParametersI() params.addLong('pid', image.getPixelsId()) - z = 0 - c = 0 query = "from PlaneInfo as Info where"\ - " Info.theZ=%s and Info.theC=%s and pixels.id=:pid" % (z, c) + " Info.theZ=0 and Info.theC=0 and pixels.id=:pid" info_list = conn.getQueryService().findAllByQuery( query, params, conn.SERVICE_OPTS) + + if len(info_list) < size_t: + # C & Z dimensions are not always filled + # Remove restriction on c0 z0 to catch all timestamps + params = omero.sys.ParametersI() + params.addLong('pid', image.getPixelsId()) + query = "from PlaneInfo as Info where pixels.id=:pid" + info_list = conn.getQueryService().findAllByQuery( + query, params, conn.SERVICE_OPTS) + timemap = {} for info in info_list: t_index = info.theT.getValue() @@ -570,9 +578,13 @@ def delta_t_data(request, image_id, conn=None, **kwargs): if delta_t_unit_symbol is None: # Get unit symbol for first info only delta_t_unit_symbol = info.deltaT.getSymbol() - for t in range(image.getSizeT()): + for t in range(size_t): if t in timemap: time_list.append(timemap[t]) + else: + # Hopefully never gets here, but + # time_list length MUST match image.sizeT + time_list.append(0) rv['delta_t'] = time_list rv['delta_t_unit_symbol'] = delta_t_unit_symbol From c6f3e06b2879807a7c3a9c10bd4e83f76a3c5235 Mon Sep 17 00:00:00 2001 From: Tom-TBT Date: Fri, 11 Oct 2024 11:10:37 +0200 Subject: [PATCH 2/3] edge case query to return single PlaneInfo per frame --- plugin/omero_iviewer/views.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/plugin/omero_iviewer/views.py b/plugin/omero_iviewer/views.py index 5c13c0253..51c0e8304 100644 --- a/plugin/omero_iviewer/views.py +++ b/plugin/omero_iviewer/views.py @@ -565,7 +565,15 @@ def delta_t_data(request, image_id, conn=None, **kwargs): # Remove restriction on c0 z0 to catch all timestamps params = omero.sys.ParametersI() params.addLong('pid', image.getPixelsId()) - query = "from PlaneInfo as Info where pixels.id=:pid" + query = """ + from PlaneInfo Info where Info.pixels.id=:pid + and Info.id in ( + select min(subInfo.id) + from PlaneInfo subInfo + where subInfo.pixels.id=:pid + group by subInfo.theT + ) + """ info_list = conn.getQueryService().findAllByQuery( query, params, conn.SERVICE_OPTS) From bfcb4c9d5483efcc03522866ed7275a15b9cb53c Mon Sep 17 00:00:00 2001 From: Tom Boissonnet Date: Tue, 19 Nov 2024 14:54:54 +0100 Subject: [PATCH 3/3] simplified timestamp query --- plugin/omero_iviewer/views.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/plugin/omero_iviewer/views.py b/plugin/omero_iviewer/views.py index 51c0e8304..c89697bd0 100644 --- a/plugin/omero_iviewer/views.py +++ b/plugin/omero_iviewer/views.py @@ -566,8 +566,7 @@ def delta_t_data(request, image_id, conn=None, **kwargs): params = omero.sys.ParametersI() params.addLong('pid', image.getPixelsId()) query = """ - from PlaneInfo Info where Info.pixels.id=:pid - and Info.id in ( + from PlaneInfo Info where Info.id in ( select min(subInfo.id) from PlaneInfo subInfo where subInfo.pixels.id=:pid