# imgpaths = imgpaths + glob.glob("/home/doran/Work/images/Anne-Claire_curated_2021/HR*/*.svs") extraimgpaths = glob.glob("/home/edward/WIMM/Decryptics_train/train/extra/*.svs") files_all = imgpaths + extraimgpaths already_curated = pd.read_csv(folder_out + 'curated_files_summary.txt', names = ["file_name", "slide_crtd"]) files_all = [x for x in files_all if x not in list(already_curated["file_name"])] file_paths_filt = pd.read_csv("filtered_list_r.csv") train_imgpaths = file_paths_filt.sample(200, random_state=222) files_all = [x for x in files_all if x in list(train_imgpaths["file_names"])] # len([x for x in train_imgpaths["file_names"] if x in list(already_curated["file_name"])]) for file_i in files_all: # file_i = files_all[4] sld_i = svs_file_w_labels(file_i, 1024, 1) sld_dat_i = sld_i.sld_dat cl_inds = np.where(sld_dat_i[:,3]>0)[0] print([file_i, len(cl_inds), sld_i.mark]) updated_info = -1*np.ones([1,5]) for cln_i in cl_inds: if (cln_i==updated_info[:,4]).any(): continue img_i, crypt_cnt, sld_inf_i = sld_i.fetch_crypt(cln_i, ret_info = True) gui_obj = correct_crypt_gui(img_i, crypt_cnt, sld_inf_i) if gui_obj.sld_inf_i is None: # Abort and flag break else: updated_info = np.vstack([updated_info, gui_obj.sld_inf_i])
def open_all_svs(self, img_paths_all, curated_files): self.all_svs_opened = {} for path_i, curated_i in zip(img_paths_all, curated_files): self.all_svs_opened[path_i] = svs_file_w_labels( path_i, self.tilesize, self.um_per_pixel, curated_i)