import settings from settings import process_options, perform_setup (options, args) = process_options() IMG_DTYPE, SEG_DTYPE, _globalnpfile, _globalexpectedpixel, _nx, _ny = perform_setup( options) print('database file: %s ' % settings._globalnpfile) from setupmodel import GetDataDictionary, BuildDB from trainmodel import TrainModel from predictmodel import PredictModel from kfolds import OneKfold, Kfold if options.builddb: BuildDB() if options.kfolds > 1: if options.idfold > -1: databaseinfo = GetDataDictionary(options.dbfile) OneKfold(i=options.idfold, datadict=databaseinfo) else: Kfold() if options.trainmodel and options.kfolds == 1: # no kfolds, i.e. k=1 TrainModel() if options.predictmodel: PredictModel() if ((not options.builddb) and (not options.trainmodel) and (not options.predictmodel) and (options.kfolds == 1)): print("parser error")
saveloclist = options.datafiles_liver elif options.tumor: if not options.datafiles_tumor: print('no list of tumor .npy files given for training') quit() else: saveloclist = options.datafiles_tumor else: print('not specified liver vs tumor') quit() print('files already generated: using', saveloclist) if options.kfolds > 1: if options.idfold > -1: OneKfold(i=options.idfold, saveloclist=saveloclist) else: Kfold(saveloclist=saveloclist) else: TrainModel(saveloclist=saveloclist) if options.predictmodel: if options.predictfromcsv: PredictCSV(modelloc=options.predictmodel, outdir=options.outdir, indir=options.predictfromcsv) else: PredictNifti(model, options.outdir + '/predictions/pred', options.predictimage, segloc=None)