for roi in rois: md = max(roi) if md > max_dim: max_dim = md distance = sum((roi-nodule)**2)**(0.5) if distance < min_distance: min_distance = distance closest_roi = roi print 'max_dim', max_dim print 'n', n print 'closest_roi', closest_roi print 'min_distance', min_distance print 'diameter', diameter_in_mm if min_distance < diameter_in_mm: n_found += 1 print 'found', n_found, '/', n_nodules print 'n_regions', n_regions if __name__ == "__main__": # model = segnet1 set_configuration("configurations/elias/roi_luna_1.py") config.data_loader.prepare() for set in [VALIDATION]: check_nodules(set)
pickle.dump(d_out, open(output_folder + patient_id + ".pkl", "wb"), protocol=pickle.HIGHEST_PROTOCOL) print 'n_regions', n_regions print 'n_regions_in_mask', n_regions_in_mask if __name__ == "__main__": parser = argparse.ArgumentParser(description=__doc__) parser.add_argument( "config", help='configuration to run', ) args = parser.parse_args() set_configuration(args.config) roi_config, roi_config_name = get_configuration(config.roi_model_config) roi_config.data_loader.prepare() fpr_config, fpr_config_name = get_configuration(config.fpr_model_config) prediction_folder = paths.MODEL_PREDICTIONS_PATH + '/' + config.prediction_loc + '/' output_folder = paths.MODEL_PREDICTIONS_PATH + '/' + config.output_name + '/' ensure_dir(output_folder) x_shared, iter_predict = load_and_build_model(fpr_config, config.saved_model_loc) for set in [TRAIN, VALIDATION, TEST]: