def get_filters(image): """ Retrieve filters for image from configuration :param image: :return: """ # processing steps for image processing_steps = list() with open(cfg.file_processing, 'r') as csvfile: image_reader = csv.reader(csvfile, delimiter=cfg.CSV_DEL, quotechar=cfg.CSV_QUOT) # find filters for image for row in image_reader: if row[0] == ImageHandler.extract_expnum_from_ID(image['ID']): for filter in range(1, len(row)): # get filter and parameters split_filter = row[filter].split(cfg.PROC_PARAMS) # build the filter and parameter list steps = list() steps.append(split_filter[0]) # Does the filter have parameters? if len(split_filter) > 1: # split parameters split_params = split_filter[1].split( cfg.PROC_PARAMS_DEL) for param in split_params: # is parameter a digit? if param.isdigit(): param = int(param) steps.append(param) processing_steps.append(steps) break csvfile.close() return processing_steps
clf = Classifier(seg) clf.train_with_exts() # save clf.save_classifier() seg.save() del(seg) del(clf) # merge revisions if processing['rev_merge'] == 2: print('=== Merge revision ===') # get revs from ID revs_to_merge = ImageHandler.get_revs_by_expnum( ImageHandler.extract_expnum_from_ID(selected_info['ID']) ) # go through and merge revs with parent seg = Segmentation(selected_info) seg.load() # merge for rev_info in revs_to_merge: print(rev_info['ID']) seg.merge_parent_with_rev(rev_info) # save merge seg.save_merge_segmentation() seg.save()