Skip to content

Commit

Permalink
Merge pull request #6 from German-BioImaging/well_support
Browse files Browse the repository at this point in the history
Added support for Well objects and owner name
  • Loading branch information
Tom-TBT committed Nov 11, 2023
2 parents 86f8b06 + f5327a0 commit 9f85cbb
Show file tree
Hide file tree
Showing 6 changed files with 62 additions and 45 deletions.
2 changes: 1 addition & 1 deletion VERSION.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
4.0.1
4.1.0
7 changes: 6 additions & 1 deletion omero_tagsearch/static/tagsearch/css/webtagging_search.css
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,17 @@
background: url('../image/run16.png') no-repeat;
}

.tagnav-well .tagnav-icon {
background: url('../image/well16.png') no-repeat;
}

.tagnav-image .tagnav-icon {
background: url('../image/image16.png') no-repeat;
}

.tagnav-project, .tagnav-dataset, .tagnav-screen,
.tagnav-plate, .tagnav-acquisition, .tagnav-image {
.tagnav-plate, .tagnav-acquisition, .tagnav-well,
.tagnav-image {
color: hsl(210,10%,50%);
font-size: 1.2em;
text-shadow: 0 1px 0 white;
Expand Down
Binary file added omero_tagsearch/static/tagsearch/image/well16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 22 additions & 0 deletions omero_tagsearch/templates/omero_tagsearch/search_details.html
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@
<th class="table_images">{% trans "Object" %}</th>
<th class="table_desc">{% trans "Name" %}</th>
<th class="table_date">{% trans "Import Date" %}</th>
<th>{% trans "Owner" %}</th>
<th>{% trans "Group" %}</th>
<th>{% trans "Link" %}</th>
</tr>
Expand All @@ -111,6 +112,7 @@
<a>{{ c.name|truncatebefor:"65" }}</a>
</td>
<td class="date">{{ c.creationEventDate }}</td>
<td class="owner">{{ c.getOwnerFullName }}</td>
<td class="group">{{ c.getDetails.group.name.val }}</td>
<td><a href="{% url 'webindex' %}?show={{ byId.otype }}-{{ c.id }}" title="{% trans 'Show in hierarchy view' %}">
{% trans "Browse" %}
Expand All @@ -125,6 +127,7 @@
</td>
<td class="desc"><a>{{ c.name|truncatebefor:"65" }}</a></td>
<td class="date">{{ c.creationEventDate }}</td>
<td class="owner">{{ c.getOwnerFullName }}</td>
<td class="group">{{ c.getDetails.group.name.val }}</td>
<td><a href="{% url 'webindex' %}?show=project-{{ c.id }}" title="{% trans 'Show in hierarchy view' %}">
{% trans "Browse" %}
Expand All @@ -138,6 +141,7 @@
</td>
<td class="desc"><a>{{ c.name|truncatebefor:"65" }}</a></td>
<td class="date">{{ c.creationEventDate }}</td>
<td class="owner">{{ c.getOwnerFullName }}</td>
<td class="group">{{ c.getDetails.group.name.val }}</td>
<td><a href="{% url 'webindex' %}?show=screen-{{ c.id }}" title="{% trans 'Show in hierarchy view' %}">
{% trans "Browse" %}
Expand All @@ -151,6 +155,7 @@
</td>
<td class="desc"><a>{{ c.name|truncatebefor:"65" }}</a></td>
<td class="date">{{ c.creationEventDate }}</td>
<td class="owner">{{ c.getOwnerFullName }}</td>
<td class="group">{{ c.getDetails.group.name.val }}</td>
<td><a href="{% url 'webindex' %}?show=dataset-{{ c.id }}" title="{% trans 'Show in hierarchy view' %}">
{% trans "Browse" %}
Expand All @@ -164,6 +169,7 @@
</td>
<td class="desc"><a>{{ c.name|truncatebefor:"65" }}</a></td>
<td class="date">{{ c.creationEventDate }}</td>
<td class="owner">{{ c.getOwnerFullName }}</td>
<td class="group">{{ c.getDetails.group.name.val }}</td>
<td><a href="{% url 'webindex' %}?show=plate-{{ c.id }}" title="{% trans 'Show in hierarchy view' %}">
{% trans "Browse" %}
Expand All @@ -177,19 +183,35 @@
</td>
<td class="desc"><a>{{ c.name|truncatebefor:"65" }}</a></td>
<td class="date">{{ c.creationEventDate }}</td>
<td class="owner">{{ c.getOwnerFullName }}</td>
<td class="group">{{ c.getDetails.group.name.val }}</td>
<td><a href="{% url 'webindex' %}?show=acquisition-{{ c.id }}" title="{% trans 'Show in hierarchy view' %}">
{% trans "Browse" %}
</a></td>
</tr>
{% endfor %}
{% for c in manager.containers.well %}
<tr id="well-{{ c.id }}" class="{{ c.getPermsCss }}">
<td class="image">
<img id="{{ c.id }}" src="{% static "webclient/image/well16.png" %}" alt="well" title="{{ c.name }}"/>
</td>
<td class="desc"><a>{{ c.name|truncatebefor:"65" }}</a></td>
<td class="date">{{ c.creationEventDate }}</td>
<td class="owner">{{ c.getOwnerFullName }}</td>
<td class="group">{{ c.getDetails.group.name.val }}</td>
<td><a href="{% url 'webindex' %}?show=well-{{ c.id }}" title="{% trans 'Show in hierarchy view' %}">
{% trans "Browse" %}
</a></td>
</tr>
{% endfor %}
{% for c in manager.containers.image %}
<tr id="image-{{ c.id }}" class="{{ c.getPermsCss }}">
<td class="image">
<img class="search_thumb" id="{{ c.id }}" src="{% url 'render_thumbnail_resize' 96 c.id %}" alt="image" title="{{ c.name }}"/>
</td>
<td class="desc"><a>{{ c.name|truncatebefor:"65" }}</a></td>
<td class="date">{{ c.creationEventDate }}</td>
<td class="owner">{{ c.getOwnerFullName }}</td>
<td class="group">{{ c.getDetails.group.name.val }}</td>
<td><a href="{% url 'webindex' %}?show=image-{{ c.id }}" title="{% trans 'Show in hierarchy view' %}">
{% trans "Browse" %}
Expand Down
57 changes: 15 additions & 42 deletions omero_tagsearch/templates/omero_tagsearch/tagnav.html
Original file line number Diff line number Diff line change
Expand Up @@ -72,48 +72,20 @@
success: function(data) {
$("div#content_details").html(data.html);

if (data.project_count > 0) {
$("#tagnav-project span").html(data.project_count);
} else {
$("#tagnav-project span").html('0');
}

if (data.dataset_count > 0) {
$(".tagnav-dataset span").html(data.dataset_count);
} else {
$(".tagnav-dataset span").html('0');
}

if (data.screen_count > 0) {
$(".tagnav-screen span").html(data.screen_count);
} else {
$(".tagnav-screen span").html('0');
}

if (data.plate_count > 0) {
$(".tagnav-plate span").html(data.plate_count);
} else {
$(".tagnav-plate span").html('0');
}

if (data.acquisition_count > 0) {
$(".tagnav-acquisition span").html(data.acquisition_count);
} else {
$(".tagnav-acquisition span").html('0');
}

if (data.image_count > 0) {
$(".tagnav-image span").html(data.image_count);
} else {
$(".tagnav-image span").html('0');
}

if (data.preview) {
$("#filtersearch").removeClass('hidden');
OME.table_selection_changed();
} else {
$("#filtersearch").addClass('hidden');
}
$(".tagnav-project span").html(data.project_count);
$(".tagnav-dataset span").html(data.dataset_count);
$(".tagnav-screen span").html(data.screen_count);
$(".tagnav-plate span").html(data.plate_count);
$(".tagnav-acquisition span").html(data.acquisition_count);
$(".tagnav-well span").html(data.well_count);
$(".tagnav-image span").html(data.image_count);

if (data.preview) {
$("#filtersearch").removeClass('hidden');
OME.table_selection_changed();
} else {
$("#filtersearch").addClass('hidden');
}


// Hide any options that are no longer possible and
Expand Down Expand Up @@ -221,6 +193,7 @@ <h2>Results</h2>
<li class="tagnav-screen"><div class="tagnav-icon">&nbsp;</div>Screen:&nbsp;<span>0</span></li>
<li class="tagnav-plate"><div class="tagnav-icon">&nbsp;</div>Plate:&nbsp;<span>0</span></li>
<li class="tagnav-acquisition"><div class="tagnav-icon">&nbsp;</div>Plate Acquisition/Run:&nbsp;<span>0</span></li>
<li class="tagnav-well"><div class="tagnav-icon">&nbsp;</div>Well:&nbsp;<span>0</span></li>
<li class="tagnav-image"><div class="tagnav-icon">&nbsp;</div>Image:&nbsp;<span>0</span></li>
</ul>

Expand Down
19 changes: 18 additions & 1 deletion omero_tagsearch/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def index(request, conn=None, **kwargs):
# path=project=51|dataset=502|image=607 (select the image)
path = request.GET.get("path", "")
i = path.split("|")[-1]
if i.split("=")[0] in ("project", "dataset", "image", "screen", "plate", "tag"):
if i.split("=")[0] in ("project", "dataset", "image", "screen", "plate", "tag", "acquisition", "run", "well"):
init["initially_select"].append(str(i).replace("=", "-"))

# Now we support show=image-607|image-123 (multi-objects selected)
Expand Down Expand Up @@ -207,6 +207,7 @@ def get_tags(obj):
tags.update(get_tags("Plate"))
tags.update(get_tags("PlateAcquisition"))
tags.update(get_tags("Screen"))
tags.update(get_tags("Well"))

# Convert back to an ordered list and sort
tags = list(tags)
Expand Down Expand Up @@ -280,6 +281,7 @@ def getObjectsWithAllAnnotations(obj_type, annids):
screen_count = 0
plate_count = 0
acquisition_count = 0
well_count = 0
image_count = 0

if selected_tags:
Expand All @@ -303,6 +305,10 @@ def getObjectsWithAllAnnotations(obj_type, annids):
context["plate_count"] = len(plate_ids)
plate_count = len(plate_ids)

well_ids = getObjectsWithAllAnnotations("Well", selected_tags)
context["well_count"] = len(well_ids)
well_count = len(well_ids)

acquisition_ids = getObjectsWithAllAnnotations(
"PlateAcquisition", selected_tags
)
Expand Down Expand Up @@ -330,6 +336,13 @@ def getObjectsWithAllAnnotations(obj_type, annids):
plates = conn.getObjects("Plate", ids=plate_ids)
manager["containers"]["plate"] = list(plates)

if well_ids:
wells = []
for well in conn.getObjects("Well", ids=well_ids):
well.name = well.getParent().name + f" - {well.getWellPos()}"
wells.append(well)
manager["containers"]["well"] = wells

if acquisition_ids:
acquisitions = conn.getObjects(
"PlateAcquisition", ids=acquisition_ids
Expand All @@ -342,6 +355,7 @@ def getObjectsWithAllAnnotations(obj_type, annids):
+ len(project_ids)
+ len(screen_ids)
+ len(plate_ids)
+ len(well_ids)
+ len(acquisition_ids)
)
if manager["c_size"] > 0:
Expand Down Expand Up @@ -392,6 +406,8 @@ def getAnnotationsForObjects(obj_type, oids):
remaining.update(getAnnotationsForObjects("Dataset", dataset_ids))
if project_ids:
remaining.update(getAnnotationsForObjects("Project", project_ids))
if well_ids:
remaining.update(getAnnotationsForObjects("Well", well_ids))
if acquisition_ids:
remaining.update(
getAnnotationsForObjects("PlateAcquisition", acquisition_ids)
Expand Down Expand Up @@ -419,6 +435,7 @@ def getAnnotationsForObjects(obj_type, oids):
"screen_count": screen_count,
"plate_count": plate_count,
"acquisition_count": acquisition_count,
"well_count": well_count,
"image_count": image_count,
"html": html_response,
}
Expand Down

0 comments on commit 9f85cbb

Please sign in to comment.