Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Query timestamps from all planes when C or Z dimensions are not filled #486

Merged
merged 3 commits into from
Nov 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 23 additions & 4 deletions plugin/omero_iviewer/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -555,12 +555,27 @@ 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 Info where 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)

timemap = {}
for info in info_list:
t_index = info.theT.getValue()
Expand All @@ -570,9 +585,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
Expand Down