planarian

This commit is contained in:
2026-05-04 23:05:59 +02:00
parent c0c3c37963
commit 5c78c042a4
7 changed files with 31 additions and 26 deletions
@@ -112,7 +112,9 @@ class VideoCaptureInterface(abc.ABC):
if not self.use_tracking: if not self.use_tracking:
return return
self._params = ExperimentParams(cfg.to_params_dict()) params = self.DEFAULT_TRACKER_CONFIG if not cfg else cfg.to_params_dict()
self._params = ExperimentParams(params)
self._metrics = self._params.build_metrics() self._metrics = self._params.build_metrics()
self._tracker = PlanarianTracker( self._tracker = PlanarianTracker(
tube_axis = self._params.tube_axis, tube_axis = self._params.tube_axis,
+3 -9
View File
@@ -18,9 +18,9 @@ class ExperimentConfig(models.Model):
author = models.ForeignKey(User, on_delete=models.CASCADE, verbose_name="Auteur", null=True, blank=True) author = models.ForeignKey(User, on_delete=models.CASCADE, verbose_name="Auteur", null=True, blank=True)
# --- Identification --- # --- Identification ---
identifier = models.CharField( max_length=100, verbose_name=_("Identifiant d'expérience"), help_text=_("session_1-HD-2026-04-27"), ) identifier = models.CharField( max_length=100, verbose_name=_("Identifiant d'expérience"), help_text=_("session_1-HD-2026-04-27"), null=True, blank=True )
experiment = models.ForeignKey(Experiment, verbose_name="Expérience", on_delete=models.CASCADE, related_name="experiment_well" , null=True, blank=True) experiment = models.ForeignKey(Experiment, verbose_name="Expérience", on_delete=models.CASCADE, related_name="experiment_well", null=True, blank=False)
well = models.ForeignKey(Well, verbose_name="Puit", on_delete=models.CASCADE, related_name="well_experiment", null=True, blank=True ) well = models.ForeignKey(Well, verbose_name="Puit", on_delete=models.CASCADE, related_name="well_experiment", null=True, blank=False )
description = models.TextField( blank=True, verbose_name=_("Description"), ) description = models.TextField( blank=True, verbose_name=_("Description"), )
created_at = models.DateTimeField(auto_now_add=True, verbose_name=_("Créé le")) created_at = models.DateTimeField(auto_now_add=True, verbose_name=_("Créé le"))
@@ -163,9 +163,6 @@ class ExperimentConfig(models.Model):
session = self.get_session() session = self.get_session()
dte = self.experiment.created.isoformat()[:19] dte = self.experiment.created.isoformat()[:19]
self.identifier = f'{dte}-{session.id}-{self.experiment.id}-{self.experiment.multiwell.position}-{self.well.name}' self.identifier = f'{dte}-{session.id}-{self.experiment.id}-{self.experiment.multiwell.position}-{self.well.name}'
print(self.identifier)
super().save(*args, **kwargs) super().save(*args, **kwargs)
@@ -180,6 +177,3 @@ def create_well_position(sender, instance, created, **kwargs):
instance.fps = conf.video_frame_rate instance.fps = conf.video_frame_rate
instance.save() instance.save()
@@ -3,7 +3,8 @@
{% block columns %}{% endblock %} {% block columns %}{% endblock %}
{% block sidebar_list %} {#% block sidebar_list %#}
<!--
<a href="/" class="w3-bar-item w3-btn w3-hover-opacity"><i class="fa-solid fa-house w3-text-orange w3-xlarge"></i> {% trans "Retour accueil" %}</a> <a href="/" class="w3-bar-item w3-btn w3-hover-opacity"><i class="fa-solid fa-house w3-text-orange w3-xlarge"></i> {% trans "Retour accueil" %}</a>
<form method="post" class="w3-bar-item" action=""> <form method="post" class="w3-bar-item" action="">
{% csrf_token %} {% csrf_token %}
@@ -28,7 +29,8 @@
<i class="fa-solid fa-film w3-text-green w3-xlarge""></i> {% trans "Balayage multi-puits" %} <i class="fa-solid fa-film w3-text-green w3-xlarge""></i> {% trans "Balayage multi-puits" %}
</a> </a>
{% endif %} {% endif %}
{% endblock %} -->
{#% endblock %#}
{% block js_footer %} {% block js_footer %}
{{ block.super }} {{ block.super }}
@@ -46,7 +48,7 @@
setTimeout(function() { setTimeout(function() {
message.remove(); message.remove();
}, 500); }, 500);
}, 5000); // 5 seconds }, 15000); // 15 seconds
}); });
}); });
</script> </script>
@@ -2,7 +2,7 @@
{% load i18n home_tags scanner_tags %} {% load i18n home_tags scanner_tags %}
{% block content %} {% block content %}
<div class="w3-container w3-padding-32" style="max-width:1200px; margin:auto;"> <div class="w3-container w3-padding" style="max-width:1200px; margin:auto;">
<!-- En-tête --> <!-- En-tête -->
<div class="w3-panel w3-teal w3-round-large w3-padding-16 w3-margin-bottom"> <div class="w3-panel w3-teal w3-round-large w3-padding-16 w3-margin-bottom">
@@ -24,11 +24,12 @@
<!-- Messages Django --> <!-- Messages Django -->
{% for message in messages %} {% for message in messages %}
<div class="w3-panel w3-round <div class="w3-panel w3-round alert
{% if message.tags == 'success' %}w3-green {% if message.tags == 'success' %}w3-green
{% elif message.tags == 'error' %}w3-red {% elif message.tags == 'error' %}w3-red
{% elif message.tags == 'warning' %}w3-orange {% elif message.tags == 'warning' %}w3-orange
{% else %}w3-blue{% endif %}"> {% else %}w3-blue{% endif %}">
<button class="w3-btn w3-right w3-bold w3-black w3-round w3-margin" onclick="s('.alert').remove()">X</button>
<p>{{ message }}</p> <p>{{ message }}</p>
</div> </div>
{% endfor %} {% endfor %}
+8
View File
@@ -68,11 +68,19 @@ class ExperimentConfigListView(ListView):
context_object_name = "configs" context_object_name = "configs"
ordering = ["-created_at"] ordering = ["-created_at"]
'''
def get_queryset(self):
# Récupérer le queryset de base
queryset = ExperimentConfig.objects.filter(experiment__session_experiments__isnull=False).select_related()
return queryset'''
def get_context_data(self, **kwargs): def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs) context = super().get_context_data(**kwargs)
return global_context(self.request, **context) return global_context(self.request, **context)
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
# Vue : création / modification d'une configuration # Vue : création / modification d'une configuration
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
@@ -103,15 +103,14 @@
<i class="fa-solid fa-wrench w3-text-red w3-xlarge"></i> {% trans "Calibration" %} <i class="fa-solid fa-wrench w3-text-red w3-xlarge"></i> {% trans "Calibration" %}
</a> </a>
{% endif %} {% endif %}
<a href="{% url 'scanner:scanning' %}" class="w3-bar-item w3-btn w3-hover-opacity">
<i class="fa-solid fa-film w3-text-green w3-xlarge""></i> {% trans "Balayage multi-puits" %}
</a>
{% if conf.tracking %} {% if conf.tracking %}
<a href="{% url 'planarian:experiment-list' %}" class="w3-bar-item w3-btn w3-hover-opacity"> <a href="{% url 'planarian:experiment-list' %}" class="w3-bar-item w3-btn w3-hover-opacity">
<i class="fa-solid fa-vials w3-text-lime w3-xlarge"></i> {% trans "Préparation des expériences" %} <i class="fa-solid fa-vials w3-text-lime w3-xlarge"></i> {% trans "Préparation des expériences" %}
</a> </a>
{% endif %} {% endif %}
<a href="{% url 'scanner:scanning' %}" class="w3-bar-item w3-btn w3-hover-opacity">
<i class="fa-solid fa-film w3-text-green w3-xlarge""></i> {% trans "Balayage multi-puits" %}
</a>
<a href="{% url 'scanner:images' %}" class="w3-bar-item w3-btn w3-hover-opacity"> <a href="{% url 'scanner:images' %}" class="w3-bar-item w3-btn w3-hover-opacity">
<i class="fa-regular fa-images w3-text-cyan w3-xlarge" w3-xlarge""></i> {% trans "Gestionnaire d'images" %} <i class="fa-regular fa-images w3-text-cyan w3-xlarge" w3-xlarge""></i> {% trans "Gestionnaire d'images" %}
</a> </a>
@@ -119,7 +118,6 @@
<i class="fa-solid fa-podcast w3-text-ambe w3-xlarge"r"></i> {% trans "Redifusion vidéos" %} <i class="fa-solid fa-podcast w3-text-ambe w3-xlarge"r"></i> {% trans "Redifusion vidéos" %}
</a> </a>
{% endblock %} {% endblock %}
</div> </div>
{% endblock %} {% endblock %}
{% endblock %} {% endblock %}
@@ -149,7 +149,7 @@
</div> </div>
</div> </div>
{% if conf.tracking %} {% if conf.tracking %}
<div class="w3-row w3-row-padding w3-light-grey w3-margin-1 w3-round w3-round-large"> <div class="w3-row w3-row-padding w3-light-grey w3-margin-1 w3-round w3-round-large w3-margin-top">
<div class="w3-col"><input id="_track_it" type="checkbox" value="0" onclick="if (this.checked){this.value='1';}else{ this.value='0';}"> <div class="w3-col"><input id="_track_it" type="checkbox" value="0" onclick="if (this.checked){this.value='1';}else{ this.value='0';}">
{% trans 'Configuration du tracking' %} {% trans 'Configuration du tracking' %}
</div> </div>