prefixes = args.prefix scale = args.scale scale_min = args.scale_min scale_max = args.scale_max verbose = args.verbosity au.setup_logger(verbose) #checking number of files processed nmasks = len(masklst) nouts = 0 m = 0 for maskf in masklst: if not scale: ofname = au.features_str() + get_out_extension(otype) else: ofname = au.features_str() + '.' + au.scaled_str( ) + get_out_extension(otype) if prefixes[m]: ofname = prefixes[m] + '_' + ofname oc = len(au.find(os.listdir(outdir), ofname)) nouts += oc m += 1 if nouts >= nmasks: au.log.debug('Nothing to do in ' + outdir + '. All files processed.') return -1 else:
fmt='%s') np.savetxt(outdir + os.path.sep + au.included_subjlabels_str(), labels, fmt='%i') if excluf: np.savetxt(outdir + os.path.sep + au.excluded_subjects_str(), exclusubjs, fmt='%s') np.savetxt(outdir + os.path.sep + au.excluded_subjlabels_str(), exclulabels, fmt='%i') #saving the feature matrix and labels in a binary file filename = set_filename(outdir, prefix + '_' + au.features_str(), otype) print('Creating ' + filename) if otype == 'numpybin': np.save(filename, feats) elif otype == 'octave': sio.savemat(filename, {au.feats_str(): feats, au.labels_str(): labels}) elif otype == 'svmperf': labels[labels == 0] = -1 ae.write_svmperf_dat(filename, dataname, feats, labels) if excluf: exclulabels[exclulabels == 0] = -1 exclfilename = set_filename(
prefixes = args.prefix scale = args.scale scale_min = args.scale_min scale_max = args.scale_max verbose = args.verbosity au.setup_logger(verbose) # checking number of files processed nmasks = len(masklst) nouts = 0 m = 0 for maskf in masklst: if not scale: ofname = au.features_str() + get_out_extension(otype) else: ofname = au.features_str() + "." + au.scaled_str() + get_out_extension(otype) if prefixes[m]: ofname = prefixes[m] + "_" + ofname oc = len(au.find(os.listdir(outdir), ofname)) nouts += oc m += 1 if nouts >= nmasks: au.log.debug("Nothing to do in " + outdir + ". All files processed.") return -1 else: au.log.debug("Processing to output in: " + outdir)
vold = nib.load(s) vol = vold.get_data() exclfeats[c,:] = vol[mask > 0] c += 1 #saving description files np.savetxt(outdir + os.path.sep + au.included_subjects_str(), subjs, fmt='%s') np.savetxt(outdir + os.path.sep + au.included_subjlabels_str(), labels, fmt='%i') if excluf: np.savetxt(outdir + os.path.sep + au.excluded_subjects_str(), exclusubjs, fmt='%s') np.savetxt(outdir + os.path.sep + au.excluded_subjlabels_str(), exclulabels, fmt='%i') #saving the feature matrix and labels in a binary file filename = set_filename (outdir, prefix + '_' + au.features_str(), otype) print ('Creating ' + filename) if otype == 'numpybin': np.save (filename, feats) elif otype == 'octave': sio.savemat (filename, {au.feats_str(): feats, au.labels_str(): labels}) elif otype == 'svmperf': labels[labels == 0] = -1 ae.write_svmperf_dat(filename, dataname, feats, labels) if excluf: exclulabels[exclulabels == 0] = -1 exclfilename = set_filename(outdir, prefix + '_' + au.excluded_str() + au.feats_str(), otype)