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

Load delta_t after image_data #373

Merged
merged 3 commits into from
May 31, 2021
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
32 changes: 15 additions & 17 deletions css/app.css
Original file line number Diff line number Diff line change
@@ -280,37 +280,39 @@ a.ui-button:active,
}

.time-slider {
left: 90px;
right: 55px;
left: 0;
z-index: 3;
display: flex;
right: 0;
}
.show-zSlider .time-slider {
left: 125px;
left: 35px;
}

.plane-slider span, .time-slider span {
position: absolute;
font-size: 18px;
}

.plane-slider.glyphicon, .time-slider .glyphicon {
.plane-slider.glyphicon {
position: absolute;
}

.plane-slider span {
position: absolute;
left: 0;
width: 35px;
text-align: center;
}
.time-slider span {
top: 6px;
margin: 6px;
}

.plane-slider .glyphicon {
left: 10px;
}
.time-slider .glyphicon {
top: 11px;
margin: 0 6px;
}

.plane-slider .dim-label {
@@ -328,13 +330,11 @@ a.ui-button:active,
left: -55px;
color: #999;
text-align: right;
width: 30px;
}

.time-slider .dim-size {
right: -55px;
color: #999;
width: 30px;
}
.plane-slider .dim-size {
top: -45px;
@@ -380,7 +380,7 @@ a.ui-button:active,
margin-left: 12px;
}
.time-slider .ui-slider {
width: 100%;
flex-grow: 1;
height: 9px;
margin-top: 14px;
}
@@ -390,7 +390,7 @@ a.ui-button:active,
width: 19px;
}
.time-slider .ui-slider-handle {
top: -0.45em;
top: -14px;
height: 19px;
}

@@ -399,19 +399,16 @@ a.ui-button:active,
top: auto;
}
.time-slider .glyphicon-chevron-left {
left: -20px;
/* left: -20px; */
}

.plane-slider .glyphicon-chevron-up {
top: -20px;
}
.time-slider .glyphicon-chevron-right {
right: -20px;
/* right: -20px; */
}

.time-slider .glyphicon-play, .time-slider .glyphicon-stop {
left: -70px;
}
.plane-slider .glyphicon-play, .plane-slider .glyphicon-stop {
bottom: -85px;
top: auto;
@@ -427,10 +424,11 @@ a.ui-button:active,
top: -50px;
}


.plane-slider .dim-arrows {
position: absolute;
}
.dim-arrows {
cursor: pointer;
position: absolute;
}
.dim-arrow-up {
background-image: url('images/arrow-up.png');
2 changes: 2 additions & 0 deletions plugin/omero_iviewer/urls.py
Original file line number Diff line number Diff line change
@@ -26,6 +26,8 @@
name='omero_iviewer_persist_rois'),
url(r'^image_data/(?P<image_id>[0-9]+)/$', views.image_data,
name='omero_iviewer_image_data'),
url(r'^image_data/(?P<image_id>[0-9]+)/delta_t/$', views.delta_t_data,
name='omero_iviewer_image_data_deltat'),
# load image_data for image linked to an ROI or Shape
url(r'^(?P<obj_type>(roi|shape))/(?P<obj_id>[0-9]+)/image_data/$',
views.roi_image_data, name='omero_iviewer_roi_image_data'),
61 changes: 37 additions & 24 deletions plugin/omero_iviewer/views.py
Original file line number Diff line number Diff line change
@@ -503,31 +503,7 @@ def image_data(request, image_id, conn=None, **kwargs):
rv['pixel_size']['unit_z'] = value[0]
rv['pixel_size']['symbol_z'] = value[1]

size_t = image.getSizeT()
time_list = []
delta_t_unit_symbol = None
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_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:
value = format_value_with_units(info.deltaT)
timemap[t_index] = value[0]
if delta_t_unit_symbol is None:
delta_t_unit_symbol = value[1]
for t in range(image.getSizeT()):
if t in timemap:
time_list.append(timemap[t])

rv['delta_t'] = time_list
rv['delta_t_unit_symbol'] = delta_t_unit_symbol
df = "%Y-%m-%d %H:%M:%S"
rv['import_date'] = image.creationEventDate().strftime(df)
@@ -545,6 +521,43 @@ def image_data(request, image_id, conn=None, **kwargs):
return JsonResponse({'error': repr(image_data_retrieval_exception)})


@login_required()
def delta_t_data(request, image_id, conn=None, **kwargs):

image = conn.getObject("Image", image_id)

rv = {}

size_t = image.getSizeT()
time_list = []
delta_t_unit_symbol = None
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_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:
value = format_value_with_units(info.deltaT)
timemap[t_index] = value[0]
if delta_t_unit_symbol is None:
delta_t_unit_symbol = value[1]
for t in range(image.getSizeT()):
if t in timemap:
time_list.append(timemap[t])

rv['delta_t'] = time_list
rv['delta_t_unit_symbol'] = delta_t_unit_symbol
rv['image_id'] = image_id
return JsonResponse(rv)


def format_value_with_units(value):
"""
Formats the response for methods above.
19 changes: 18 additions & 1 deletion src/model/image_info.js
Original file line number Diff line number Diff line change
@@ -395,7 +395,6 @@ export default class ImageInfo {
this.import_date = response.import_date;
if (typeof response.acquisition_date === 'string')
this.acquisition_date = response.acquisition_date;
this.setFormattedDeltaT(response);
this.roi_count = response.roi_count;
if (typeof response.meta.datasetName === 'string')
this.dataset_name = response.meta.datasetName;
@@ -417,6 +416,8 @@ export default class ImageInfo {
this.context.publish(
IMAGE_SETTINGS_REFRESH, { config_id : this.config_id});
}
// Finally, load delta_t data
this.requestDeltaT();
}

/**
@@ -623,6 +624,22 @@ export default class ImageInfo {
return m;
}

/**
* Loads and the Image delta_t timestamp data
*/
requestDeltaT() {
if (this.dimensions.max_t <= 1) return;
let url = this.context.server + this.context.getPrefixedURI(IVIEWER);
url += "/image_data/" + this.image_id + '/delta_t/';
$.ajax({
url,
success: (response) => {
console.log('response this.image_id', this.image_id, response.image_id);
this.setFormattedDeltaT(response)
}
});
}

/**
* Sets image_delta_t member from response
* after formatting it to hours:minutes:seconds:milliseconds
3 changes: 1 addition & 2 deletions src/viewers/ol3-viewer.html
Original file line number Diff line number Diff line change
@@ -53,8 +53,7 @@
dim="t"
player_info.bind="player_info"
class="time-slider"
css="${image_config.image_info.image_delta_t.length > 0 ?
'right: 175px': ''}">
>
</dimension-slider>
</div>
<viewer-context-menu image_config.bind="image_config"></viewer-context-menu>