diff --git a/interface/backend/api/views.py b/interface/backend/api/views.py index 0fe70004..c662adfd 100644 --- a/interface/backend/api/views.py +++ b/interface/backend/api/views.py @@ -16,13 +16,11 @@ from django.conf import settings from django.core.files.storage import FileSystemStorage from django.shortcuts import get_object_or_404 -from rest_framework import viewsets, status +from rest_framework import viewsets from rest_framework.decorators import api_view from rest_framework.response import Response from rest_framework.views import APIView -from ..cases import enums - class ViewSetBase(viewsets.ModelViewSet): def get_serializer_context(self): diff --git a/interface/backend/cases/tests.py b/interface/backend/cases/tests.py index 3d335c96..c8eb40c3 100644 --- a/interface/backend/cases/tests.py +++ b/interface/backend/cases/tests.py @@ -1,5 +1,3 @@ -import json - from backend.cases.factories import ( CandidateFactory, CaseFactory, diff --git a/prediction/src/preprocess/load_ct.py b/prediction/src/preprocess/load_ct.py index 93a66cbd..e36ababb 100644 --- a/prediction/src/preprocess/load_ct.py +++ b/prediction/src/preprocess/load_ct.py @@ -147,6 +147,9 @@ def extract_origin_mhd(self): # the default axes order which is used is: (z, y, x) return self.meta.GetOrigin()[::-1] + def extract_origin_dicom(self): + return [0] * 3 + def non_copy_constructor(self, meta_instance): self.meta = meta_instance.meta self.spacing = meta_instance.spacing @@ -167,6 +170,7 @@ def __init__(self, meta): if dicom_meta: # list of methods for DICOM meta self.spacing = self.extract_spacing_dcm() + self.origin = self.extract_origin_dicom() elif mhd_meta: # list of methods for MetaImage meta self.spacing = self.extract_spacing_mhd() diff --git a/prediction/src/tests/test_classification.py b/prediction/src/tests/test_classification.py index dbe9c116..645f59f8 100644 --- a/prediction/src/tests/test_classification.py +++ b/prediction/src/tests/test_classification.py @@ -5,7 +5,13 @@ def test_classify_predict_load(metaimage_path, model_path): assert not trained_model.predict(metaimage_path, [], model_path) -def test_classify_predict_inference(metaimage_path, luna_nodule, model_path): +def test_classify_dicom(dicom_paths, nodule_locations, model_path): + predicted = trained_model.predict(dicom_paths[0], nodule_locations, model_path) + assert predicted + assert 0 <= predicted[0]['p_concerning'] <= 1 + + +def test_classify_luna(metaimage_path, luna_nodule, model_path): predicted = trained_model.predict(metaimage_path, [luna_nodule], model_path) assert predicted assert 0 <= predicted[0]['p_concerning'] <= 1