diff --git a/prediction/src/tests/test_classification.py b/prediction/src/tests/test_classification.py index dbe9c11..3ba3bdb 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, 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 diff --git a/prediction/src/tests/test_identification.py b/prediction/src/tests/test_identification.py index 914fe2b..5098701 100644 --- a/prediction/src/tests/test_identification.py +++ b/prediction/src/tests/test_identification.py @@ -5,7 +5,7 @@ from ..algorithms.identify import trained_model @skip_if_slow -def test_identify_nodules_001(dicom_path, nodule_001): +def test_identify_dicom_001(dicom_path, nodule_001): predicted = trained_model.predict(dicom_path) first = predicted[0] dist = np.sqrt(np.sum([(first[s] - nodule_001[s]) ** 2 for s in ["x", "y", "z"]])) @@ -13,8 +13,16 @@ def test_identify_nodules_001(dicom_path, nodule_001): @skip_if_slow -def test_identify_nodules_003(dicom_path_003, nodule_003): +def test_identify_dicom_003(dicom_path_003, nodule_003): predicted = trained_model.predict(dicom_path_003) first = predicted[0] dist = np.sqrt(np.sum([(first[s] - nodule_003[s]) ** 2 for s in ["x", "y", "z"]])) assert (dist < 10) + + +@skip_if_slow +def test_identify_luna(metaimage_path, luna_nodule): + predicted = trained_model.predict(metaimage_path) + first = predicted[0] + dist = np.sqrt(np.sum([(first[s] - luna_nodule[s]) ** 2 for s in ["x", "y", "z"]])) + assert (dist < 10) diff --git a/prediction/src/tests/test_segmentation.py b/prediction/src/tests/test_segmentation.py index 1ecf7eb..0896bdc 100644 --- a/prediction/src/tests/test_segmentation.py +++ b/prediction/src/tests/test_segmentation.py @@ -22,13 +22,20 @@ def test_segment_predict_load(dicom_path): assert predicted['volumes'] == [] -def test_segment_predict_inference(dicom_path, nodule_locations): +def test_segment_dicom(dicom_path, nodule_locations): predicted = predict(dicom_path, nodule_locations) assert isinstance(predicted['binary_mask_path'], str) assert predicted['volumes'] assert predicted['volumes'][0] > 0 +def test_segment_luna(metaimage_path, luna_nodule): + predicted = predict(metaimage_path, [luna_nodule]) + assert isinstance(predicted['binary_mask_path'], str) + assert predicted['volumes'] + assert predicted['volumes'][0] > 0 + + @skip_if_slow def test_lung_segmentation(dicom_paths): """Test whether the annotations of the LIDC images are inside the segmented lung masks.