Skip to content

Commit 19b6665

Browse files
authored
Use panimg models package (#4543)
See DIAGNijmegen/rse-cloud-infrastructure#212
1 parent 6ee2e7f commit 19b6665

11 files changed

Lines changed: 24 additions & 116 deletions

File tree

app/grandchallenge/cases/models.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,16 +27,12 @@
2727
from django_deprecate_fields import deprecate_field
2828
from grand_challenge_dicom_de_identifier.deidentifier import DicomDeidentifier
2929
from guardian.shortcuts import assign_perm, get_groups_with_perms, remove_perm
30+
from panimg_models import MAXIMUM_SEGMENTS_LENGTH, ColorSpace, ImageType
3031
from pydantic import ConfigDict, Field, field_validator
3132
from pydantic.alias_generators import to_camel
3233
from pydantic.dataclasses import dataclass
3334
from storages.utils import clean_name
3435

35-
from grandchallenge.cases.panimg_models import (
36-
MAXIMUM_SEGMENTS_LENGTH,
37-
ColorSpace,
38-
ImageType,
39-
)
4036
from grandchallenge.core.error_handlers import (
4137
DICOMImageSetUploadErrorHandler,
4238
RawImageUploadSessionErrorHandler,

app/grandchallenge/cases/panimg.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,13 @@
33
from pathlib import Path
44

55
from django.utils._os import safe_join
6-
from pydantic import TypeAdapter
7-
8-
from grandchallenge.cases.panimg_models import (
6+
from panimg_models import (
97
PanImgFile,
108
PanImgResult,
119
PostProcessorOptions,
1210
PostProcessorResult,
1311
)
12+
from pydantic import TypeAdapter
1413

1514

1615
def convert(*, input_directory, output_directory, builders):

app/grandchallenge/cases/panimg_models.py

Lines changed: 0 additions & 95 deletions
This file was deleted.

app/grandchallenge/cases/tasks.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
from grand_challenge_dicom_de_identifier.exceptions import (
2424
RejectedDICOMFileError,
2525
)
26+
from panimg_models import ImageBuilderOptions, PanImgResult
2627

2728
from grandchallenge.cases.models import (
2829
DICOMImageSetUpload,
@@ -34,10 +35,6 @@
3435
RawImageUploadSession,
3536
)
3637
from grandchallenge.cases.panimg import convert, post_process
37-
from grandchallenge.cases.panimg_models import (
38-
ImageBuilderOptions,
39-
PanImgResult,
40-
)
4138
from grandchallenge.components.backends.exceptions import RetryStep
4239
from grandchallenge.components.backends.utils import UUID4_REGEX, safe_extract
4340
from grandchallenge.components.models import ComponentInterface

app/grandchallenge/components/backends/base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,10 @@
3131
from django.db import transaction
3232
from django.utils._os import safe_join
3333
from django.utils.functional import cached_property
34+
from panimg_models import ImageBuilderOptions
3435
from pydantic import BaseModel, ConfigDict
3536
from pydantic_core import to_json
3637

37-
from grandchallenge.cases.panimg_models import ImageBuilderOptions
3838
from grandchallenge.cases.tasks import import_images
3939
from grandchallenge.components.backends.exceptions import (
4040
ComponentException,

app/grandchallenge/components/models.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
from django.utils.translation import gettext_lazy as _
3535
from django_deprecate_fields import deprecate_field
3636
from django_extensions.db.fields import AutoSlugField
37+
from panimg_models import MAXIMUM_SEGMENTS_LENGTH
3738
from pydantic_core import MISSING
3839

3940
from grandchallenge.cases.models import (
@@ -42,7 +43,6 @@
4243
ImageFile,
4344
RawImageUploadSession,
4445
)
45-
from grandchallenge.cases.panimg_models import MAXIMUM_SEGMENTS_LENGTH
4646
from grandchallenge.charts.specs import components_line
4747
from grandchallenge.components.backends.exceptions import (
4848
CIVNotEditableException,

app/grandchallenge/workstation_configs/models.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
from django.db.models import PositiveSmallIntegerField
1010
from django_extensions.db.models import TitleSlugDescriptionModel
1111
from guardian.shortcuts import assign_perm
12+
from panimg_models import MAXIMUM_SEGMENTS_LENGTH
1213

13-
from grandchallenge.cases.panimg_models import MAXIMUM_SEGMENTS_LENGTH
1414
from grandchallenge.core.fields import HexColorField
1515
from grandchallenge.core.guardian import (
1616
GroupObjectPermissionBase,

app/tests/cases_tests/test_tasks.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
from grand_challenge_dicom_de_identifier.exceptions import (
1010
RejectedDICOMFileError,
1111
)
12+
from panimg_models import ImageType, PanImgFile, PostProcessorResult
1213

1314
from grandchallenge.cases.models import (
1415
DICOMImageSetUpload,
@@ -19,11 +20,6 @@
1920
PostProcessImageTask,
2021
PostProcessImageTaskStatusChoices,
2122
)
22-
from grandchallenge.cases.panimg_models import (
23-
ImageType,
24-
PanImgFile,
25-
PostProcessorResult,
26-
)
2723
from grandchallenge.cases.tasks import (
2824
_check_post_processor_result,
2925
execute_post_process_image_task,

app/tests/components_tests/test_models.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@
88
from billiard.exceptions import SoftTimeLimitExceeded, TimeLimitExceeded
99
from django.core.exceptions import MultipleObjectsReturned, ValidationError
1010
from django.core.files.base import ContentFile
11+
from panimg_models import MAXIMUM_SEGMENTS_LENGTH
1112

1213
from grandchallenge.algorithms.models import AlgorithmImage, Job
1314
from grandchallenge.cases.models import Image
14-
from grandchallenge.cases.panimg_models import MAXIMUM_SEGMENTS_LENGTH
1515
from grandchallenge.cases.widgets import DICOMUploadWithName
1616
from grandchallenge.components.models import (
1717
INTERFACE_KIND_JSON_EXAMPLES,

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ dependencies = [
6464
# Requirements for forge
6565
"black",
6666
"isort",
67+
"panimg-models",
6768
]
6869
name = "grand-challenge.org"
6970
version = "0.1.0"

0 commit comments

Comments
 (0)