Skip to content

Commit

Permalink
Added button to remove registrations again.
Browse files Browse the repository at this point in the history
  • Loading branch information
maubreville committed Jun 29, 2024
1 parent 6ac50b6 commit 4b1a0a5
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
14 changes: 14 additions & 0 deletions exact/exact/images/templates/images/imageset_v2.html
Original file line number Diff line number Diff line change
Expand Up @@ -475,6 +475,13 @@ <h3>{{imageset.name}} : Registration
<td>{{reg.scale_str}}</td>
<td>{{reg.rotation_angle|stringformat:".2f"}}</td>
<td>{{reg.registration_error|stringformat:".2f"}}</td>
<td><button type="submit" class="btn btn-secondary" name="delete-registration" value={{reg.id}}>
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-trash" viewBox="0 0 16 16">
<path d="M5.5 5.5A.5.5 0 0 1 6 6v6a.5.5 0 0 1-1 0V6a.5.5 0 0 1 .5-.5m2.5 0a.5.5 0 0 1 .5.5v6a.5.5 0 0 1-1 0V6a.5.5 0 0 1 .5-.5m3 .5a.5.5 0 0 0-1 0v6a.5.5 0 0 0 1 0z"></path>
<path d="M14.5 3a1 1 0 0 1-1 1H13v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V4h-.5a1 1 0 0 1-1-1V2a1 1 0 0 1 1-1H6a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1h3.5a1 1 0 0 1 1 1zM4.118 4 4 4.059V13a1 1 0 0 0 1 1h6a1 1 0 0 0 1-1V4.059L11.882 4zM2.5 3h11V2h-11z"></path>
</svg>
</button>
</td>
</tr>
{% endfor %}
{% for reg in image_registration_dst %}
Expand All @@ -485,6 +492,13 @@ <h3>{{imageset.name}} : Registration
<td>{{reg.scale_str}}</td>
<td>{{reg.rotation_angle|stringformat:".2f"}}</td>
<td>{{reg.registration_error|stringformat:".2f"}}</td>
<td><button type="submit" class="btn btn-secondary" name="delete-registration" value={{reg.id}}>
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-trash" viewBox="0 0 16 16">
<path d="M5.5 5.5A.5.5 0 0 1 6 6v6a.5.5 0 0 1-1 0V6a.5.5 0 0 1 .5-.5m2.5 0a.5.5 0 0 1 .5.5v6a.5.5 0 0 1-1 0V6a.5.5 0 0 1 .5-.5m3 .5a.5.5 0 0 0-1 0v6a.5.5 0 0 0 1 0z"></path>
<path d="M14.5 3a1 1 0 0 1-1 1H13v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V4h-.5a1 1 0 0 1-1-1V2a1 1 0 0 1 1-1H6a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1h3.5a1 1 0 0 1 1 1zM4.118 4 4 4.059V13a1 1 0 0 0 1 1h6a1 1 0 0 0 1-1V4.059L11.882 4zM2.5 3h11V2h-11z"></path>
</svg>
</button>
</td>
</tr>
{% endfor %}
</table>
Expand Down
13 changes: 12 additions & 1 deletion exact/exact/images/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -720,6 +720,16 @@ def view_imageset(request, image_set_id):
pgn=PluginJob.objects.filter(image__in=imageset.images.all()).filter(plugin=plugin)
availablePlugins[i].alljobs = pgn

showRegTab=False
if ('delete-registration' in request.POST):
print('delReg',request.POST['delete-registration'])
regid = int(request.POST['delete-registration'])
image_registration = ImageRegistration.objects.filter(id=regid).first()

# image_registration = get_object_or_404(ImageRegistration, int(request.POST['delete-registration']))
image_registration.delete()
# delete registration
showRegTab=True

if ('registration-src' in request.POST) and ('registration-dst' in request.POST):
source_image = get_object_or_404(Image, id=int(request.POST.get('registration-src')))
Expand All @@ -746,6 +756,7 @@ def view_imageset(request, image_set_id):
image_registration.perform_registration(maxFeatures=maxFeatures, thumbnail_size=thumbnail_size, filter_outliner=filter_outliner,
use_gray=use_gray, target_depth=target_depth, point_extractor=point_extractor, flann=flann,
scale=scale) # use default parameters for now
showRegTab=True

image_registration_src = ImageRegistration.objects.filter(source_image_id__in=imageset.images.all())
image_registration_trg = ImageRegistration.objects.filter(target_image_id__in=imageset.images.all())
Expand All @@ -757,7 +768,7 @@ def view_imageset(request, image_set_id):


else:
showRegTab=False

target_imageset=imageset

all_products = Product.objects.filter(team=imageset.team).order_by('name')
Expand Down

0 comments on commit 4b1a0a5

Please sign in to comment.