Components

class grandchallenge.components.models.ComponentInterface(id, overlay_segments, look_up_table, title, slug, description, default_value, schema, kind, relative_path, store_in_database)[source]
Parameters
  • id (AutoField) – Primary key: ID

  • overlay_segments (JSONField) – Overlay segments. The schema that defines how categories of values in the overlay images are differentiated.

  • title (CharField) – Title. Human readable name of this input/output field.

  • slug (AutoSlugField) – Slug

  • description (TextField) – Description. Description of this input/output field.

  • default_value (JSONField) – Default value. Default value for this field, only valid for inputs.

  • schema (JSONField) – Schema. Additional JSON schema that the values for this interface must satisfy. See https://json-schema.org/. Only Draft 7, 6, 4 or 3 are supported.

  • kind (CharField) – Kind. What is the type of this interface? Used to validate interface values and connections between components.

  • relative_path (CharField) – Relative path. The path to the entity that implements this interface relative to the input or output directory.

  • store_in_database (BooleanField) – Store in database. Should the value be saved in a database field, only valid for outputs.

Relationship fields:

Parameters

look_up_table (ForeignKey to LookUpTable) – Look up table. The look-up table that is applied when an overlay image is first shown (related name: componentinterface)

Reverse relationships:

Parameters
  • evaluation_inputs (Reverse ManyToManyField from Phase) – All evaluation inputs of this component interface (related name of inputs)

  • evaluation_outputs (Reverse ManyToManyField from Phase) – All evaluation outputs of this component interface (related name of outputs)

  • algorithm_inputs (Reverse ManyToManyField from Algorithm) – All algorithm inputs of this component interface (related name of inputs)

  • algorithm_outputs (Reverse ManyToManyField from Algorithm) – All algorithm outputs of this component interface (related name of outputs)

  • componentinterfacevalue (Reverse ForeignKey from ComponentInterfaceValue) – All component interface values of this component interface (related name of interface)

  • question (Reverse ForeignKey from Question) – All questions of this component interface (related name of interface)

exception DoesNotExist
Kind

alias of InterfaceKindChoices

exception MultipleObjectsReturned
__init__(*args, **kwargs)[source]
clean()[source]

Hook for doing any extra model-wide validation after clean() has been called on every field by self.clean_fields. Any ValidationError raised by this method will not be associated with a particular field; it will have a special-case association with the field defined by NON_FIELD_ERRORS.

validate_against_schema(*, value)[source]

Validates values against both default and custom schemas

class grandchallenge.components.models.ComponentInterfaceValue(*args, **kwargs)[source]

Encapsulates the value of an interface at a certain point in the graph.

Parameters

Relationship fields:

Parameters

Reverse relationships:

Parameters
  • evaluation_evaluations_as_input (Reverse ManyToManyField from Evaluation) – All evaluation evaluations as input of this component interface value (related name of inputs)

  • evaluation_evaluations_as_output (Reverse ManyToManyField from Evaluation) – All evaluation evaluations as output of this component interface value (related name of outputs)

  • algorithms_jobs_as_input (Reverse ManyToManyField from Job) – All algorithms jobs as input of this component interface value (related name of inputs)

  • algorithms_jobs_as_output (Reverse ManyToManyField from Job) – All algorithms jobs as output of this component interface value (related name of outputs)

  • archive_items (Reverse ManyToManyField from ArchiveItem) – All archive items of this component interface value (related name of values)

  • display_sets (Reverse ManyToManyField from DisplaySet) – All display sets of this component interface value (related name of values)

exception DoesNotExist
exception MultipleObjectsReturned
__init__(*args, **kwargs)[source]
clean()[source]

Hook for doing any extra model-wide validation after clean() has been called on every field by self.clean_fields. Any ValidationError raised by this method will not be associated with a particular field; it will have a special-case association with the field defined by NON_FIELD_ERRORS.

property decompress

Should the CIV be decompressed?

This is only for legacy support of zip file submission for prediction evaluation. We should not support this anywhere else as it clobbers the input directory.

image_file
property relative_path

Where should the file be located?

Images need special handling as their names are fixed.

save(*args, **kwargs)[source]

Save the current instance. Override this in a subclass if you want to control the saving process.

The ‘force_insert’ and ‘force_update’ parameters can be used to insist that the “save” must be an SQL insert or update (or equivalent for non-SQL backends), respectively. Normally, they should not be set.

class grandchallenge.components.models.ComponentJobManager(model=None, query=None, using=None, hints=None)[source]
average_duration()[source]

Calculate the average duration that completed jobs ran for

with_duration()[source]

Annotate the queryset with the duration of completed jobs

class grandchallenge.components.models.ImportStatusChoices(value)[source]

An enumeration.

class grandchallenge.components.models.InterfaceKind[source]

Interface kind.

class InterfaceKindChoices(value)

Interface kind choices.

static interface_type_file()[source]

Interface kinds that are files:

  • CSV file

  • ZIP file

  • PDF file

  • SQREG file

  • Thumbnail JPG

  • Thumbnail PNG

  • OBJ file

  • MP4 file

static interface_type_image()[source]

Interface kinds that are images:

  • Image

  • Heat Map

  • Segmentation

static interface_type_json()[source]

Interface kinds that are json serializable:

  • String

  • Integer

  • Float

  • Bool

  • Anything that is JSON serializable (any object)

  • 2D bounding box

  • Multiple 2D bounding boxes

  • Distance measurement

  • Multiple distance measurements

  • Point

  • Multiple points

  • Polygon

  • Multiple polygons

  • Lines

  • Multiple lines

  • Angle

  • Multiple angles

  • Choice (string)

  • Multiple choice (array of strings)

  • Chart

  • Ellipse

  • Multiple ellipses

Example json for 2D bounding box annotation

required: “type”, “corners”, “version” optional: “name”, “probability”

{
    "name": "Region of interest",
    "type": "2D bounding box",
    "corners": [
        [ 130.80001831054688, 148.86666870117188, 0.5009999871253967],
        [ 69.73332977294922, 148.86666870117188, 0.5009999871253967],
        [ 69.73332977294922, 73.13333129882812, 0.5009999871253967],
        [ 130.80001831054688, 73.13333129882812, 0.5009999871253967]
    ],
    "probability": 0.95,
    "version": { "major": 1, "minor": 0 }
}
Example json for Multiple 2D bounding boxes annotation

required: “type”, “boxes”, “version” optional: “name”, “probability”

{
    "name": "Regions of interest",
    "type": "Multiple 2D bounding boxes",
    "boxes": [
        {
            "name": "ROI 1",
            "corners": [
                [ 92.66666412353516, 136.06668090820312, 0.5009999871253967],
                [ 54.79999923706055, 136.06668090820312, 0.5009999871253967],
                [ 54.79999923706055, 95.53333282470703, 0.5009999871253967],
                [ 92.66666412353516, 95.53333282470703, 0.5009999871253967]
            ],
            "probability": 0.95
        },
        {
            "name": "ROI 2",
            "corners": [
                [ 92.66666412353516, 136.06668090820312, 0.5009999871253967],
                [ 54.79999923706055, 136.06668090820312, 0.5009999871253967],
                [ 54.79999923706055, 95.53333282470703, 0.5009999871253967],
                [ 92.66666412353516, 95.53333282470703, 0.5009999871253967]
            ],
            "probability": 0.92
        }
    ],
    "version": { "major": 1, "minor": 0 }
}
Example json for Distance measurement annotation

required: “type”, “start”, “end”, “version” optional: “name”, “probability”

{
    "name": "Distance between areas",
    "type": "Distance measurement",
    "start": [ 59.79176712036133, 78.76753997802734, 0.5009999871253967 ],
    "end": [ 69.38014221191406, 143.75546264648438, 0.5009999871253967 ],
    "probability": 0.92,
    "version": { "major": 1, "minor": 0 }
}
Example json for Multiple distance measurement annotation

required: “type”, “lines”, “version” optional: “name”, “probability”

{
    "name": "Distances between areas",
    "type": "Multiple distance measurements",
    "lines": [
        {
            "name": "Distance 1",
            "start": [ 49.733333587646484, 103.26667022705078, 0.5009999871253967 ],
            "end": [ 55.06666564941406, 139.26666259765625, 0.5009999871253967 ],
            "probability": 0.92
        },
        {
            "name": "Distance 2",
            "start": [ 49.733333587646484, 103.26667022705078, 0.5009999871253967 ],
            "end": [ 55.06666564941406, 139.26666259765625, 0.5009999871253967 ],
            "probability": 0.92
        }
    ],
    "version": { "major": 1, "minor": 0 }
}
Example json for Point annotation

required: “type”, “point”, “version” optional: “name”, “probability”

{
    "name": "Point of interest",
    "type": "Point",
    "point": [ 152.13333129882812, 111.0, 0.5009999871253967 ],
    "probability": 0.92,
    "version": { "major": 1, "minor": 0 }
}
Example json for Multiple points annotation

required: “type”, “points”, “version” optional: “name”, “probability”

{
    "name": "Points of interest",
    "type": "Multiple points",
    "points": [
        {
            "name": "Point 1",
            "point": [
                96.0145263671875, 79.83292388916016, 0.5009999871253967
            ],
            "probability": 0.92
        },
        {
            "name": "Point 2",
            "point": [
                130.10653686523438, 115.52300262451172, 0.5009999871253967
            ],
            "probability": 0.92
        }
    ],
    "version": { "major": 1, "minor": 0 }
}
Example json for Polygon annotation

required: “type”, “seed_point”, “path_points”, “sub_type”, “groups”, “version” optional: “name”, “probability”

{
    "name": "Area of interest",
    "type": "Polygon",
    "seed_point": [ 76.413756408691, 124.014717102050, 0.5009999871253967 ],
    "path_points": [
        [ 76.41375842260106, 124.01471710205078, 0.5009999871253967 ],
        [ 76.41694876387268, 124.0511828696491, 0.5009999871253967 ],
        [ 76.42642285078242, 124.0865406433515, 0.5009999871253967 ]
    ],
    "sub_type": "brush",
    "groups": [],
    "probability": 0.92,
    "version": { "major": 1, "minor": 0 }
}
Example json for Multiple polygon annotation

required: “type”, “polygons”, “version” optional: “name”, “probability”

{
    "name": "Areas of interest",
    "type": "Multiple polygons",
    "polygons": [
        {
            "name": "Area 1",
            "seed_point": [ 55.82666793823242, 90.46666717529297, 0.5009999871253967 ],
            "path_points": [
                [ 55.82667599387105, 90.46666717529297, 0.5009999871253967 ],
                [ 55.93921357544119, 90.88666314747366, 0.5009999871253967 ],
                [ 56.246671966051736, 91.1941215380842, 0.5009999871253967 ],
                [ 56.66666793823242, 91.30665911965434, 0.5009999871253967 ]
            ],
            "sub_type": "brush",
            "groups": [ "manual"],
            "probability": 0.67
        },
        {
            "name": "Area 2",
            "seed_point": [ 90.22666564941406, 96.06666564941406, 0.5009999871253967 ],
            "path_points": [
                [ 90.22667370505269, 96.06666564941406, 0.5009999871253967 ],
                [ 90.33921128662283, 96.48666162159475, 0.5009999871253967 ],
                [ 90.64666967723338, 96.7941200122053, 0.5009999871253967 ]
            ],
            "sub_type": "brush",
            "groups": [],
            "probability": 0.92
        }
    ],
    "version": { "major": 1, "minor": 0 }
}
Example json for Line annotation

required: “type”, “seed_points”, “path_point_lists”, “version” optional: “name”, “probability”

{
    "name": "Some annotation",
    "type": "Line",
    "seed_points": [[1, 2, 3], [1, 2, 3]],
    "path_point_lists": [
        [[5, 6, 7], [8, 9, 10], [1, 0, 10], [2, 4, 2]],
        [[5, 6, 7], [8, 9, 10], [1, 0, 10], [2, 4, 2]]
    ],
    "probability": 0.92
    "version": { "major": 1, "minor": 0 }
}
Example json for Multiple lines annotation

required: “type”, “lines”, “version” optional: “name”, “probability”

{
    "name": "Some annotations",
    "type": "Multiple lines",
    "lines": [
        {
            "name": "Annotation 1",
            "seed_points": [[1, 2, 3], [1, 2, 3]],
            "path_point_lists": [
                [[5, 6, 7], [8, 9, 10], [1, 0, 10], [2, 4, 2]],
                [[5, 6, 7], [8, 9, 10], [1, 0, 10], [2, 4, 2]],
            ],
            "probability": 0.78
        },
        {
            "name": "Annotation 2",
            "seed_points": [[1, 2, 3], [1, 2, 3]],
            "path_point_lists": [
                [[5, 6, 7], [8, 9, 10], [1, 0, 10], [2, 4, 2]],
                [[5, 6, 7], [8, 9, 10], [1, 0, 10], [2, 4, 2]],
            ],
            "probability": 0.92
        }
    ],
    "version": { "major": 1, "minor": 0 }
}
Example json for Angle annotation

required: “type”, “lines”, “version” optional: “name”, “probability”

Example json for Multiple angles annotation

required: “type”, “angles”, “version” optional: “name”, “probability”

Example json for Chart (for more examples, see here<https://vega.github.io/vega-lite/examples/> and here<https://grand-challenge.org/blogs/visualisations-for-challenges/>)

{
   "$schema":"https://vega.github.io/schema/vega-lite/v5.json",
   "width":300,
   "height":300,
   "data":{
      "values":[
         {
            "target":"Negative",
            "prediction":"Negative",
            "value":198
         },
         {
            "target":"Negative",
            "prediction":"Positive",
            "value":9
         },
         {
            "target":"Positive",
            "prediction":"Negative",
            "value":159
         },
         {
            "target":"Positive",
            "prediction":"Positive",
            "value":376
         }
      ],
      "format":{
         "type":"json"
      }
   },
   "layer":[
      {
         "mark":"rect",
         "encoding":{
            "y":{
               "field":"target",
               "type":"ordinal"
            },
            "x":{
               "field":"prediction",
               "type":"ordinal"
            },
            "color":{
               "field":"value",
               "type":"quantitative",
               "title":"Count of Records",
               "legend":{
                  "direction":"vertical",
                  "gradientLength":300
               }
            }
         }
      },
      {
         "mark":"text",
         "encoding":{
            "y":{
               "field":"target",
               "type":"ordinal"
            },
            "x":{
               "field":"prediction",
               "type":"ordinal"
            },
            "text":{
               "field":"value",
               "type":"quantitative"
            },
            "color":{
               "condition":{
                  "test":"datum['value'] < 40",
                  "value":"black"
               },
               "value":"white"
            }
         }
      }
   ],
   "config":{
      "axis":{
         "grid":True,
         "tickBand":"extent"
      }
   }
}
Example json for Ellipse annotation

required: “type”, “major_axis, “minor_axis” “version” optional: “name”, “probability”

{
    "name": "an Ellipse",
    "type": "Ellipse",
    "major_axis": [[ 130, 148.86, 0.50], [10, 10, 0]],
    "minor_axis": [[ 69.73, 148.86, 0.50], [10, 0, 0]],
    "probability": 0.95,
    "version": { "major": 1, "minor": 0 }
}
Example json for Multiple ellipses annotation

required: “type”, “ellipses”, “version” optional: “name”, “probability”

{
    "name": "Some Ellipses",
    "type": "Multiple ellipses",
    "ellipses": [
        {
            "name": "First Ellipse",
            "major axis": [[10, 10, 0.5], [10, 20, 0]],
            "minor_axis": [[10, 20, 0.5], [10.6, 0, 0]],
            "probability": 0.82
        },
        {
            "name": "Second Ellipse",
            "major axis": [[10, 10, 0.5], [10, 20, 0]],
            "minor_axis": [[10, 20, 0.5], [10.6, 0, 0]],
            "probability": 0.52
        },
        {
            "name": "Third Ellipse",
            "major axis": [[10, 10, 0.5], [10, 20, 0]],
            "minor_axis": [[10, 20, 0.5], [10.6, 0, 0]],
            "probability": 0.98
        }
    ],
    "version": {"major": 1, "minor": 0}
}
class grandchallenge.components.models.InterfaceKindChoices(value)[source]

Interface kind choices.

class grandchallenge.components.models.InterfaceSuperKindChoices(value)[source]

An enumeration.