Skip to content

Commit

Permalink
Merge pull request #387 from jburel/fix
Browse files Browse the repository at this point in the history
break utils.py
  • Loading branch information
jburel authored May 15, 2020
2 parents 8ec37d4 + 56f26f3 commit 4bb7376
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 28 deletions.
3 changes: 1 addition & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@

4.3.0 (May 2020)
----------------

- Add support for time-stamps in milliseconds([#378](https://github.com/ome/omero-figure/pull/378))
- Add support for timestamps in milliseconds ([#378](https://github.com/ome/omero-figure/pull/378))
- Show other users' files to Public user ([#362](https://github.com/ome/omero-figure/pull/362))
- Fix saving of Figures with no panels ([#363](https://github.com/ome/omero-figure/pull/363))
- Fix enable of Save when nudge panels ([#376](https://github.com/ome/omero-figure/pull/376))
Expand Down
42 changes: 42 additions & 0 deletions omero_figure/omeroutils.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#
# Copyright (c) 2020 University of Dundee.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#

from omero.sys import ParametersI
from omero.gateway import PlaneInfoWrapper


def get_timestamps(conn, image):

params = ParametersI()
params.addLong('pid', image.getPixelsId())
query = "from PlaneInfo as Info where"\
" Info.theZ=0 and Info.theC=0 and pixels.id=:pid"
info_list = conn.getQueryService().findAllByQuery(
query, params, conn.SERVICE_OPTS)
timemap = {}
for info in info_list:
t_index = info.theT.getValue()
if info.deltaT is not None:
# Use wrapper to help unit conversion
plane_info = PlaneInfoWrapper(conn, info)
delta_t = plane_info.getDeltaT('SECOND')
timemap[t_index] = delta_t.getValue()
time_list = []
for t in range(image.getSizeT()):
if t in timemap:
time_list.append(timemap[t])
return time_list
25 changes: 0 additions & 25 deletions omero_figure/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@

import json
import os
from omero.sys import ParametersI
from omero.gateway import PlaneInfoWrapper

__version__ = "4.2.1.dev0"

Expand All @@ -32,26 +30,3 @@ def read_file(fname, content_type=None):
else:
data = f.read()
return data


def get_timestamps(conn, image):

params = ParametersI()
params.addLong('pid', image.getPixelsId())
query = "from PlaneInfo as Info where"\
" Info.theZ=0 and Info.theC=0 and pixels.id=:pid"
info_list = conn.getQueryService().findAllByQuery(
query, params, conn.SERVICE_OPTS)
timemap = {}
for info in info_list:
t_index = info.theT.getValue()
if info.deltaT is not None:
# Use wrapper to help unit conversion
plane_info = PlaneInfoWrapper(conn, info)
delta_t = plane_info.getDeltaT('SECOND')
timemap[t_index] = delta_t.getValue()
time_list = []
for t in range(image.getSizeT()):
if t in timemap:
time_list.append(timemap[t])
return time_list
2 changes: 1 addition & 1 deletion omero_figure/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
from io import BytesIO

from omeroweb.webclient.decorators import login_required
from .utils import get_timestamps
from .omeroutils import get_timestamps

from . import utils
import logging
Expand Down

0 comments on commit 4bb7376

Please sign in to comment.