Skip to content
This repository has been archived by the owner on Feb 22, 2020. It is now read-only.

#229 Fix Classification #256

Merged
merged 2 commits into from
Dec 4, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions interface/backend/api/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
2 changes: 0 additions & 2 deletions interface/backend/cases/tests.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import json

from backend.cases.factories import (
CandidateFactory,
CaseFactory,
Expand Down
4 changes: 4 additions & 0 deletions prediction/src/preprocess/load_ct.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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()
Expand Down
8 changes: 7 additions & 1 deletion prediction/src/tests/test_classification.py
Original file line number Diff line number Diff line change
Expand Up @@ -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