Пример #1
0
 def test_testsetretinapathologies_old(self):
     PolygonAnnotationSetFactory(name="No match")
     PolygonAnnotationSetFactory(name="retina::too_small")
     result = set_retina_pathologies(PolygonAnnotationSet.objects.all())
     assert result["pathology_set"] == 0
     assert result["old_annotation"] == 2
     assert len(result["non_matching_pathology"]) == 0
Пример #2
0
 def test_testsetretinapathologies_no_match(self):
     annotation = PolygonAnnotationSetFactory(
         name="retina::enface::non_matching_pathology::bla")
     result = set_retina_pathologies(PolygonAnnotationSet.objects.all())
     assert result["pathology_set"] == 0
     assert result["old_annotation"] == 0
     assert len(result["non_matching_pathology"]) == 1
     assert result["non_matching_pathology"] == [{
         "id": annotation.id,
         "name": annotation.name
     }]
Пример #3
0
 def test_testsetretinapathologies_created(self):
     annotation = PolygonAnnotationSetFactory(
         name=f"retina::enface::{pathology_options_enface[0]}::bla")
     assert RetinaImagePathologyAnnotation.objects.all().count() == 0
     result = set_retina_pathologies(PolygonAnnotationSet.objects.all())
     assert result["pathology_set"] == 1
     assert result["old_annotation"] == 0
     assert len(result["non_matching_pathology"]) == 0
     assert RetinaImagePathologyAnnotation.objects.all().count() == 1
     pathology_annotation = RetinaImagePathologyAnnotation.objects.first()
     assert pathology_annotation.image == annotation.image
     assert pathology_annotation.grader == annotation.grader
     for v in pathology_options_enface:
         assert getattr(pathology_annotation,
                        v) == (v == pathology_options_enface[0])
Пример #4
0
 def test_testsetretinapathologies_oct(self):
     annotation = PolygonAnnotationSetFactory(
         name=f"retina::oct::{pathology_options_oct[0]}::bla")
     assert OctRetinaImagePathologyAnnotation.objects.all().count() == 0
     result = set_retina_pathologies(PolygonAnnotationSet.objects.all())
     assert result["pathology_set"] == 1
     assert result["old_annotation"] == 0
     assert len(result["non_matching_pathology"]) == 0
     assert RetinaImagePathologyAnnotation.objects.all().count() == 0
     assert OctRetinaImagePathologyAnnotation.objects.all().count() == 1
     oct_pathology_annotation = (
         OctRetinaImagePathologyAnnotation.objects.first())
     assert oct_pathology_annotation.image == annotation.image
     assert oct_pathology_annotation.grader == annotation.grader
     assert (getattr(oct_pathology_annotation, pathology_options_oct[0]) is
             True)
Пример #5
0
 def test_testsetretinapathologies_updated(self):
     annotation = PolygonAnnotationSetFactory(
         name=f"retina::enface::{pathology_options_enface[0]}::bla")
     pathology_annotation = RetinaImagePathologyAnnotationFactory(
         **{
             "image": annotation.image,
             "grader": annotation.grader,
             pathology_options_enface[0]: False,
         })
     assert RetinaImagePathologyAnnotation.objects.all().count() == 1
     result = set_retina_pathologies(PolygonAnnotationSet.objects.all())
     assert result["pathology_set"] == 1
     assert result["old_annotation"] == 0
     assert len(result["non_matching_pathology"]) == 0
     assert RetinaImagePathologyAnnotation.objects.all().count() == 1
     pathology_annotation.refresh_from_db()
     assert pathology_annotation.image == annotation.image
     assert pathology_annotation.grader == annotation.grader
     assert (getattr(pathology_annotation, pathology_options_enface[0]) is
             True)