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)
Exemple #2
0
def image_with_image_level_annotations():
    grader = UserFactory()
    add_to_graders_group([grader])
    image = ImageFactory()
    factory_kwargs = {"image": image, "grader": grader}
    annotations = {
        "quality": ImageQualityAnnotationFactory(**factory_kwargs),
        "pathology": ImagePathologyAnnotationFactory(**factory_kwargs),
        "retina_pathology": RetinaImagePathologyAnnotationFactory(
            **factory_kwargs
        ),
        "oct_retina_pathology": OctRetinaImagePathologyAnnotationFactory(
            **factory_kwargs
        ),
        "text": ImageTextAnnotationFactory(**factory_kwargs),
    }
    return image, grader, annotations
 def test_testsetretinapathologies_oct_legacy_removed(self):
     annotation = PolygonAnnotationSetFactory(
         name=f"retina::oct::{pathology_options_oct[0]}::bla")
     RetinaImagePathologyAnnotationFactory(**{
         "image": annotation.image,
         "grader": annotation.grader
     })
     assert RetinaImagePathologyAnnotation.objects.all().count() == 1
     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)