Skip to content

Commit

Permalink
test: started writing tests for radiomic feature extraction functions
Browse files Browse the repository at this point in the history
  • Loading branch information
strixy16 committed Dec 13, 2023
1 parent 39f969c commit cd31b86
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions tests/test_feature_extraction.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
from yarea.loaders import *
from yarea.feature_extraction import *

@pytest.fixture
def nsclcCTImage():
nsclcCTPath = "tests/NSCLC_Radiogenomics/R01-001/09-06-1990-NA-CT_CHEST_ABD_PELVIS_WITH_CON-98785/3.000000-THORAX_1.0_B45f-95741"
return loadDicomSITK(nsclcCTPath)

@pytest.fixture
def nsclcSEGImage():
nsclcSEGPath = "tests/NSCLC_Radiogenomics/R01-001/09-06-1990-NA-CT_CHEST_ABD_PELVIS_WITH_CON-98785/1000.000000-3D_Slicer_segmentation_result-67652/1-1.dcm"
segDictionary = loadSegmentation(nsclcSEGPath, modality = 'SEG')
return segDictionary['Heart']

@pytest.fixture
def lung4DCTImage():
lung4DCTPath = "tests/4D-Lung/113_HM10395/11-26-1999-NA-p4-13296/1.000000-P4P113S303I10349 Gated 40.0B-29543"
return loadDicomSITK(lung4DCTPath)

@pytest.fixture
def lung4DRTSTRUCTImage():
lung4DRTSTRUCTPath = "tests/4D-Lung/113_HM10395/11-26-1999-NA-p4-13296/1.000000-P4P113S303I10349 Gated 40.0B-47.35/1-1.dcm"
lung4DCTPath = "tests/4D-Lung/113_HM10395/11-26-1999-NA-p4-13296/1.000000-P4P113S303I10349 Gated 40.0B-29543"
segDictionary = loadSegmentation(lung4DRTSTRUCTPath, modality = 'RTSTRUCT',
baseImageDirPath = lung4DCTPath, roiNames = 'Tumor_c.*')
return segDictionary['Tumor_c40']

@pytest.fixture
def pyradiomicsParamFilePath():
return "../src/yarea/data/default_pyradiomics.yaml"

def test_singleRadiomicFeatureExtraction(nsclcCTImage, nsclcSEGImage, pyradiomicsParamFilePath):
"""Test single image feature extraction with a CT and SEG"""

actual = singleRadiomicFeatureExtraction(nsclcCTImage, nsclcSEGImage, pyradiomicsParamFilePath)
#TODO write assert statements


# TODO: test RTSTRUCT, test the radiomicFeatureExtraction
# Write the negative control tests after the test_negative_controls has been written

0 comments on commit cd31b86

Please sign in to comment.