https://github.com/Radiomics/pyradiomics
Revision 9d26a6b8b35e19ca976cf906b8ec7d927cd2eb04 authored by Andrey Fedorov on 13 February 2020, 16:05:47 UTC, committed by GitHub on 13 February 2020, 16:05:47 UTC
1 parent ae1e14c
Raw File
Tip revision: 9d26a6b8b35e19ca976cf906b8ec7d927cd2eb04 authored by Andrey Fedorov on 13 February 2020, 16:05:47 UTC
DOCS: fix parameter name
Tip revision: 9d26a6b
testParams.py
# This is a simple script to check if your parameter file is valid. Run it with the location of your parameter
# file as a command line argument (i.e. 'python testParams.py PATH/TO/PARAMFILE'). If successful, a message displaying
# custom parameters specified will be printed. If validation fails, an error message specifying cause of validation
# error will be printed.

import sys

import pykwalify.core

from radiomics import getParameterValidationFiles

def main(paramsFile):
  schemaFile, schemaFuncs = getParameterValidationFiles()

  c = pykwalify.core.Core(source_file=paramsFile, schema_files=[schemaFile], extensions=[schemaFuncs])
  try:
    params = c.validate()
    print('Parameter validation successfull!\n\n'
          '###Enabled Features###\n%s\n'
          '###Enabled Image Types###\n%s\n'
          '###Settings###\n%s' % (params['featureClass'], params['imageType'], params['setting']))
  except Exception as e:
    print('Parameter validation failed!\n%s' % e.message)


if __name__ == '__main__' and len(sys.argv) > 1:
    main(sys.argv[1])
back to top