Skip to content

Commit

Permalink
BUG: Fix incorrect parsing of Label in batch file
Browse files Browse the repository at this point in the history
When a column "Label" has been specified in the batch input file, the value should be used for the extraction label.
However, this is required to be an integer, whereas it may be parsed as string. Therefore, add a check to convert to integer if it is a string (and therefore not None).

When extracting in parallel, info messages of each thread are filtered out of the console output. However, info messages from the script, e.g. detailing how long the extraction of a single patient took, should not be filtered out. In the batch script, this filter had the wrong logger name passed to the filter (radiomics.batch instead of radiomics.script).
  • Loading branch information
JoostJM committed Aug 28, 2018
1 parent 917fadf commit 217a840
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion radiomics/scripts/segment.py
Expand Up @@ -28,6 +28,8 @@ def extractSegment(case_idx, case, config, config_override):
imageFilepath = case['Image'] # Required
maskFilepath = case['Mask'] # Required
label = case.get('Label', None) # Optional
if isinstance(label, six.string_types):
label = int(label)

# Instantiate Radiomics Feature extractor
extractor = featureextractor.RadiomicsFeaturesExtractor(config, **config_override)
Expand Down Expand Up @@ -183,7 +185,7 @@ def filter(self, record):
# those from radiomics.script, but warnings and errors from the entire library are also printed to the output.
# This does not affect the amount of logging stored in the log file.
outputhandler = rLogger.handlers[0] # Handler printing to the output
outputhandler.addFilter(info_filter('radiomics.batch'))
outputhandler.addFilter(info_filter('radiomics.script'))

# Ensures that log messages are being passed to the filter with the specified level
setVerbosity(parallel_config.get('verbosity', logging.INFO))
Expand Down

0 comments on commit 217a840

Please sign in to comment.