Skip to content

Commit

Permalink
Fix bug in statistical test when feature labels are lower case
Browse files Browse the repository at this point in the history
  • Loading branch information
MStarmans91 committed Aug 14, 2023
1 parent 3e49286 commit 96e867c
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 17 deletions.
4 changes: 3 additions & 1 deletion WORC/facade/simpleworc.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
from .helpers.exceptions import PathNotFoundException, NoImagesFoundException, \
NoSegmentationsFoundException, InvalidCsvFileException, \
NoFeaturesFoundException, NoMasksFoundException
from WORC.addexceptions import WORCKeyError, WORCValueError, WORCAssertionError
from WORC.addexceptions import WORCKeyError, WORCValueError, WORCAssertionError, \
WORCIOError
from .helpers.configbuilder import ConfigBuilder
from WORC.detectors.detectors import CsvDetector, BigrClusterDetector, \
SnelliusClusterDetector
Expand All @@ -52,6 +53,7 @@ def _error_bulldozer(func):
PathNotFoundException, NoImagesFoundException,
NoSegmentationsFoundException, InvalidCsvFileException,
TypeError, ValueError, NotImplementedError, WORCKeyError,
WORCIOError,
WORCValueError, WORCAssertionError, NoMasksFoundException,
]
_valid_exceptions += [c[1] for c in inspect.getmembers(fastr.exceptions, inspect.isclass)]
Expand Down
32 changes: 16 additions & 16 deletions WORC/featureprocessing/StatisticalTestFeatures.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env python

# Copyright 2016-2020 Biomedical Imaging Group Rotterdam, Departments of
# Copyright 2016-2023 Biomedical Imaging Group Rotterdam, Departments of
# Medical Informatics and Radiology, Erasmus MC, Rotterdam, The Netherlands
#
# Licensed under the Apache License, Version 2.0 (the "License");
Expand Down Expand Up @@ -260,35 +260,35 @@ def StatisticalTestFeatures(features, patientinfo, config, output_csv=None,
}

for o in objects:
if 'hf_' in o:
if 'hf_' in o.lower():
labels.append(0)
elif 'sf_' in o:
elif 'sf_' in o.lower():
labels.append(1)
elif 'of_' in o:
elif 'of_' in o.lower():
labels.append(2)
elif 'GLCM_' in o or 'GLCMMS_' in o:
elif 'glcm_' in o or 'glcmms_' in o.lower():
labels.append(3)
elif 'GLRLM_' in o:
elif 'glrlm_' in o.lower():
labels.append(4)
elif 'GLSZM_' in o:
elif 'glszm_' in o.lower():
labels.append(5)
elif 'GLDM_' in o:
elif 'gldm_' in o.lower():
labels.append(6)
elif 'NGTDM_' in o:
elif 'ngtdm_' in o.lower():
labels.append(7)
elif 'Gabor_' in o:
elif 'gabor_' in o.lower():
labels.append(8)
elif 'semf_' in o:
elif 'semf_' in o.lower():
labels.append(9)
elif 'df_' in o:
elif 'df_' in o.lower():
labels.append(10)
elif 'logf_' in o:
elif 'logf_' in o.lower():
labels.append(11)
elif 'vf_' in o:
elif 'vf_' in o.lower():
labels.append(12)
elif 'LBP_' in o:
elif 'lbp_' in o.lower():
labels.append(13)
elif 'phasef_' in o:
elif 'phasef_' in o.lower():
labels.append(14)
else:
raise KeyError(o)
Expand Down

0 comments on commit 96e867c

Please sign in to comment.