'--metric', 'MeanSquares[{},{},{}]'.format(args.use_labels[2], lab_path, w_lab) ]) cmdline.extend( ['--convergence', '[{},1e-9,15]'.format('x'.join(its_syn))]) cmdline.extend(['--smoothing-sigmas', smooth_sig]) cmdline.extend(['--shrink-factors', shrink_fac]) # # mask if args.template_mask is not None: cmdline.extend(['--masks', args.template_mask[0]]) # # launch print "Launching registration of file {}".format(img_file) name_list.append(img_file.split(os.extsep, 1)[0]) launcher.add(name_list[-1], ' '.join(cmdline), args.out_dir[0]) launcher.run(name_list[-1]) print "Waiting for registration jobs to finish..." launcher.wait() print "Registration finished."
cmdline += [ imagemath_path, '3', os.path.join(tmp_dir, 'dummy.txt'), 'NormalizedCorrelation' ] cmdline += [ os.path.join(in1_dir, file1), os.path.join(in2_dir, file2) ] if args.mask_file is not None: cmdline += [ os.path.join(tmp_dir, os.path.basename(args.mask_file[0])) ] name_list.append('%sX%s' % (name1, name2)) launcher.add(name_list[-1], ' '.join(cmdline), tmp_dir) launcher.run(name_list[-1]) # Read scores when jobs are finished if method_cmdline: launcher.wait() for i2, name in enumerate(name_list): out_file = os.path.join(tmp_dir, name + '.out') check_file_repeat(out_file) try: with open(out_file) as f:
for i_img in range(Nimg): est_path = os.path.join(args.est_dir[0], est_files[i_img]) gtr_path = os.path.join(args.gtr_dir[0], gtr_files[i_img]) out_path = os.path.join(tmp_dir, est_names[i_img]) out_paths.append(out_path) cmdline = "%s 3 %s DiceAndMinDistSum %s %s" % (imagemath_path, out_path, est_path, gtr_path) qsub_launcher = Launcher(cmdline) print("Launching Dice evaluation job for labels %s" % est_names[i_img]) launcher.add(est_names[i_img], cmdline, tmp_dir) launcher.run(est_names[i_img]) print "Waiting for Dice evaluation jobs to finish..." launcher.wait() print "Dice evaluation finished." subj_dices = dict([]) label_dices = dict([]) for i, out_path in enumerate(out_paths): # Read per-label Dice check_file_repeat(out_path + '.csv')
args.target_deform_intfix[0] + '1Warp.nii.gz') ] cmdline += [ '--transform', os.path.join( args.target_reg_dir[0], target_name + args.target_linear_intfix[0] + '0GenericAffine.mat') ] cmdline += [ '--output', os.path.join( args.out_dir[0], atlas_file.split(os.extsep, 1)[0] + args.out_suffix[0]) ] # # launch job_name = atlas_file.split(os.extsep, 1)[0] print "Launching warping of file {}".format(job_name) launcher.add(job_name, ' '.join(cmdline), args.out_dir[0]) launcher.run(job_name) # Wait for the jobs to finish (in cluster) print "Waiting for warping jobs to finish..." launcher.wait() print "Warping finished."