Skip to content
Merged
Show file tree
Hide file tree
Changes from 13 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,122 changes: 2,221 additions & 1,901 deletions pixi.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/readii/io/utils/pattern_resolver.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def __init__(self, filename_format: str) -> None:

try:
self.pattern_parser = PatternParser(
self.filename_format, pattern_parser=self.DEFAULT_PATTERN
self.filename_format, pattern_matcher=self.DEFAULT_PATTERN
)
self.formatted_pattern, self.keys = self.parse() # Validate the pattern by parsing it
except InvalidPatternError as e:
Expand Down
10 changes: 5 additions & 5 deletions src/readii/process/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@
survivalStatusToNumericMapping,
timeOutcomeColumnSetup,
)
from .select import (
dropUpToFeature,
getOnlyPyradiomicsFeatures,
selectByColumnValue,
)
from .split import (
replaceColumnValues,
splitDataByColumnValue,
)
from .subset import (
dropUpToFeature,
getOnlyPyradiomicsFeatures,
selectByColumnValue,
)

__all__ = [
"addOutcomeLabels",
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions tests/test_feature_extraction.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ 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']
baseImageDirPath = lung4DCTPath, roiNames = {'GTV':'Tumor_c.*'})
return segDictionary['GTV']

@pytest.fixture
def pyradiomicsParamFilePath():
Expand Down
4 changes: 2 additions & 2 deletions tests/test_image_processing.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ 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']
baseImageDirPath = lung4DCTPath, roiNames = {'GTV':'Tumor_c.*'})
return segDictionary['GTV']


def test_flattenImage(nsclcSEGImage):
Expand Down
19 changes: 14 additions & 5 deletions tests/test_loaders.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,19 +53,28 @@ def test_loadSegmentationSEG(nsclcSEGPath):
"Wrong origin"


def test_loadSegmentationRTSTRUCT(lung4DRTSTRUCTPath, lung4DCTPath):

@pytest.mark.parametrize(
"roiNames, expected",
[
({"GTV":'Tumor_c.*'}, "GTV"),
('Tumor_c.*', "Tumor_c40"),
(["Tumor_c40"], "Tumor_c40"),
]
)
def test_loadSegmentationRTSTRUCT(lung4DRTSTRUCTPath, lung4DCTPath, roiNames, expected):
"""Test loading a RTSTRUCT file"""
actual = loadSegmentation(segImagePath = lung4DRTSTRUCTPath,
modality = 'RTSTRUCT',
baseImageDirPath = lung4DCTPath,
roiNames = 'Tumor_c.*')
roiNames = roiNames)

assert isinstance(actual, dict), \
"Wrong object type, should be dictionary"
assert list(actual.keys()) == ['Tumor_c40'], \
"Segmentation label is wrong, should be Heart"
assert list(actual.keys()) == [expected], \
f"Segmentation label is wrong, should be GTV, getting {list(actual.keys())}"

actualImage = actual['Tumor_c40']
actualImage = actual[expected]

assert isinstance(actualImage, sitk.Image), \
"Wrong object type"
Expand Down
Loading