diff --git a/src/locpix/img_processing/data_loading/dataset.py b/src/locpix/img_processing/data_loading/dataset.py index 1c1ce0e..63bf4d2 100644 --- a/src/locpix/img_processing/data_loading/dataset.py +++ b/src/locpix/img_processing/data_loading/dataset.py @@ -17,37 +17,33 @@ class ImgDataset(Dataset): """ def __init__( - self, input_root, label_root, files, input_type, label_type, transform + self, input_root, files, input_type, transform ): """ Args: - input_root (string) : Directory containing the histograms - of the SMLM data in .npy form - label_root (string) : Directory containing the labeled - histograms labels for training + input_root (string) : Directory containing the input annotated + SMLM data files (list) : List of the files to include from the directory in this dataset input_type (string) : String representing the data format of the input - label_type (string) : String representing the data format of the - label transform (pytorch transform) : Transforms to apply to the dataset """ self.input_data = [ os.path.join(input_root, file + input_type) for file in files ] - self.label_data = [ - os.path.join(label_root, file + label_type) for file in files - ] + #self.label_data = [ + # os.path.join(label_root, file + label_type) for file in files + #] print("input root", input_root) - self.input_data, self.label_data = zip( - *sorted(zip(self.input_data, self.label_data)) - ) - print("input and label data") + #self.input_data, self.label_data = zip( + # *sorted(zip(self.input_data, self.label_data)) + #) + #print("input and label data") print(self.input_data) - print(self.label_data) + #print(self.label_data) self.transform = transform def preprocess(self, folder): @@ -58,47 +54,71 @@ def preprocess(self, folder): """ # join data - join_data = zip(self.input_data, self.label_data) + #join_data = zip(self.input_data, self.label_data) + + # make folders to save data at if not already present + img_folder = os.path.join(folder, 'imgs') + label_folder = os.path.join(folder, 'labels') + for folder in [img_folder, label_folder]: + if os.path.exists(folder): + raise ValueError(f"Cannot proceed as {folder} already exists") + else: + os.makedirs(folder) + self.img_data = [] self.label_data = [] # for file in input - for img, label in join_data: + for datum in self.input_data: # load img and label - with open(img, "rb") as f: - img_bad = pkl.load(f) + #with open(img, "rb") as f: + # histo_bad = pkl.load(f) + + # check img and label and check img the same + #histos = [] + #print(type(histo_bad)) + #for key, value in histo_bad.items(): + # histos.append(value) + #histo_bad = np.stack(histos) + #print("histo") + #print(axis_2_chan) + #print(histo.shape) + #print(histo_bad.shape) + + #np.testing.assert_array_equal(histo, histo_bad) item = datastruc.item(None, None, None, None) - item.load_from_parquet(os.path.join(label)) - print(item.df) + item.load_from_parquet(os.path.join(datum)) + #print(item.df) # convert - img, axis_2_chan = item.render_histo() + histo, axis_2_chan = item.render_histo() label = item.render_seg() - # check img and label and check img the same - histos = [] - print(type(img_bad)) - for key, value in img_bad.items(): - histos.append(value) - img_bad = np.stack(histos) - print("img") - print(axis_2_chan) - print(img.shape) - print(img_bad.shape) + # transpose to img space + img = np.transpose(histo, (0,2,1)) + label = label.T - np.testing.assert_array_equal(img, img_bad) - print("label", label.shape) + #import matplotlib.pyplot as plt + #plt.imshow(np.log2(img[0,:,:]), origin = 'upper', cmap = 'Greys', alpha=1) + #plt.imshow(label, origin='upper', cmap='Reds', alpha=.4) + #plt.show() + #print("label", label.shape) + #print('img', img.shape) - # img path + # img & label path + img_path = os.path.join(img_folder, item.name + '.npy') + label_path = os.path.join(label_folder, item.name + '.npy') - # label path + # add img and label path to lists + self.img_data.append(img_path) + self.label_data.append(label_path) # save img and label - - # add img and label path to lists + np.save(img_path, img) + np.save(label_path, label) def __getitem__(self, idx): """Returns an item from the dataset, according to index idx diff --git a/src/locpix/preprocessing/datastruc.py b/src/locpix/preprocessing/datastruc.py index da9dbc0..9e5059b 100644 --- a/src/locpix/preprocessing/datastruc.py +++ b/src/locpix/preprocessing/datastruc.py @@ -633,6 +633,7 @@ def render_histo(self): axis_2_chan (list) : List where the first value is the channel in the first axis of the histogram, second value is the channel in the second axis of the histogram etc. + e.g. [1,3] : 1st channel is in 1st axis, 3rd channel in 2nd axis """ histos = [] diff --git a/src/locpix/preprocessing/functions.py b/src/locpix/preprocessing/functions.py index b4f75e7..6ded5bc 100644 --- a/src/locpix/preprocessing/functions.py +++ b/src/locpix/preprocessing/functions.py @@ -39,11 +39,9 @@ def csv_to_datastruc( # Check dimensions correctly specified if dim != 2 and dim != 3: raise ValueError("Dimensions must be 2 or 3") - if z_col is not None: - print("here", z_col) - if dim == 2 and z_col is not None and z_col: + if dim == 2 and z_col: raise ValueError("If dimensions are two no z should be specified") - if dim == 3 and z_col is None: + if dim == 3 and not z_col: raise ValueError("If dimensions are 3 then z_col must be specified") # Load in data diff --git a/src/locpix/scripts/img_seg/cellpose_eval.py b/src/locpix/scripts/img_seg/cellpose_eval.py index e7c5f1d..05159fa 100644 --- a/src/locpix/scripts/img_seg/cellpose_eval.py +++ b/src/locpix/scripts/img_seg/cellpose_eval.py @@ -44,7 +44,7 @@ def main(): else: root = tk.Tk() root.withdraw() - project_folder = filedialog.askdirectory() + project_folder = filedialog.askdirectory(title="Project directory") # configuration if args.config is not None: @@ -70,8 +70,9 @@ def main(): # if output directory not present create it output_directories = [output_membrane_prob, output_cell_df, output_cell_img] for directory in output_directories: - if not os.path.exists(directory): - print("Making folder") + if os.path.exists(directory): + raise ValueError(f"Cannot proceed as {directory} already exists") + else: os.makedirs(directory) for file in files: @@ -167,6 +168,11 @@ def main(): four_colour=True, ) + # save yaml file + yaml_save_loc = os.path.join(project_folder, "cellpose_eval.yaml") + with open(yaml_save_loc, "w") as outfile: + yaml.dump(config, outfile) + if __name__ == "__main__": main() diff --git a/src/locpix/scripts/img_seg/cellpose_eval_config.py b/src/locpix/scripts/img_seg/cellpose_eval_config.py index 58daaec..de4a503 100644 --- a/src/locpix/scripts/img_seg/cellpose_eval_config.py +++ b/src/locpix/scripts/img_seg/cellpose_eval_config.py @@ -154,10 +154,10 @@ def set_config(self, config): Args: config (dictionary) : Configuration dict""" - config["vis_threshold"] = int(self.vis_threshold.text()) + config["vis_threshold"] = float(self.vis_threshold.text()) config["vis_interpolate"] = self.selectedItems()[0].text() config["model"] = self.cellpose_model.text() - config["diameter"] = int(self.cellpose_diameter.text()) + config["diameter"] = float(self.cellpose_diameter.text()) config["channels"] = [ int(self.first_channel.text()), int(self.second_channel.text()), diff --git a/src/locpix/scripts/img_seg/cellpose_train.py b/src/locpix/scripts/img_seg/cellpose_train.py index 03e761a..9dc3f01 100644 --- a/src/locpix/scripts/img_seg/cellpose_train.py +++ b/src/locpix/scripts/img_seg/cellpose_train.py @@ -49,7 +49,7 @@ def main(): else: root = tk.Tk() root.withdraw() - project_folder = filedialog.askdirectory() + project_folder = filedialog.askdirectory(title="Project directory") if args.config is not None: # load yaml @@ -63,8 +63,8 @@ def main(): # config = cellpose_train_config.config_gui(gt_file_path) # load in config - input_root = os.path.join(project_folder, "annotate/histos") - label_root = os.path.join(project_folder, "annotate/annotated") + input_root = os.path.join(project_folder, "annotate/annotated") + #label_root = os.path.join(project_folder, "annotate/annotated") batch_size = config["batch_size"] epochs = config["epochs"] gpu = config["gpu"] @@ -83,9 +83,10 @@ def main(): raise ValueError("There should be some files to open") # make necessary folders if not present - preprocessed_folder = os.path.join(project_folder, "cellose_train") - if not os.path.exists(preprocessed_folder): - print("Making folder") + preprocessed_folder = os.path.join(project_folder, "cellpose_train") + if os.path.exists(preprocessed_folder): + raise ValueError(f"Cannot proceed as {preprocessed_folder} already exists") + else: os.makedirs(preprocessed_folder) print("files", files) @@ -121,12 +122,14 @@ def main(): # Initialise train and val dataset train_set = dataset.ImgDataset( - input_root, label_root, train_files, ".pkl", ".parquet", train_transform + input_root, train_files, ".parquet", train_transform ) val_set = dataset.ImgDataset( - input_root, label_root, val_files, ".pkl", ".parquet", val_transform + input_root, val_files, ".parquet", val_transform ) + print('Preprocessing datasets') + # Pre-process train and val dataset train_set.preprocess(os.path.join(preprocessed_folder, "train")) val_set.preprocess(os.path.join(preprocessed_folder, "val")) @@ -292,6 +295,11 @@ def main(): save_loc=save_loc, four_colour=True, ) + + # save yaml file + yaml_save_loc = os.path.join(project_folder, "cellpose_train.yaml") + with open(yaml_save_loc, "w") as outfile: + yaml.dump(config, outfile) """ if __name__ == "__main__": diff --git a/src/locpix/scripts/img_seg/classic.py b/src/locpix/scripts/img_seg/classic.py index f35c1fe..a4330bf 100644 --- a/src/locpix/scripts/img_seg/classic.py +++ b/src/locpix/scripts/img_seg/classic.py @@ -44,7 +44,7 @@ def main(): else: root = tk.Tk() root.withdraw() - project_folder = filedialog.askdirectory() + project_folder = filedialog.askdirectory(title="Project directory") # configuration folder if args.config is not None: @@ -64,20 +64,23 @@ def main(): # if output directory not present create it output_membrane_prob = os.path.join(project_folder, "classic/membrane/prob_map") - if not os.path.exists(output_membrane_prob): - print("Making folder") + if os.path.exists(output_membrane_prob): + raise ValueError(f"Cannot proceed as {output_membrane_prob} already exists") + else: os.makedirs(output_membrane_prob) # if output directory not present create it output_cell_df = os.path.join(project_folder, "classic/cell/seg_dataframes") - if not os.path.exists(output_cell_df): - print("Making folder") + if os.path.exists(output_cell_df): + raise ValueError(f"Cannot proceed as {output_cell_df} already exists") + else: os.makedirs(output_cell_df) # if output directory not present create it output_cell_img = os.path.join(project_folder, "classic/cell/seg_img") - if not os.path.exists(output_cell_img): - print("Making folder") + if os.path.exists(output_cell_img): + raise ValueError(f"Cannot proceed as {output_cell_img} already exists") + else: os.makedirs(output_cell_img) for file in files: @@ -163,6 +166,11 @@ def main(): four_colour=True, ) + # save yaml file + yaml_save_loc = os.path.join(project_folder, "classic.yaml") + with open(yaml_save_loc, "w") as outfile: + yaml.dump(config, outfile) + if __name__ == "__main__": main() diff --git a/src/locpix/scripts/img_seg/classic_config.py b/src/locpix/scripts/img_seg/classic_config.py index ce6f8fa..f51b283 100644 --- a/src/locpix/scripts/img_seg/classic_config.py +++ b/src/locpix/scripts/img_seg/classic_config.py @@ -114,7 +114,7 @@ def set_config(self, config): Args: config (dictionary) : Configuration dict""" - config["vis_threshold"] = int(self.vis_threshold.text()) + config["vis_threshold"] = float(self.vis_threshold.text()) config["vis_interpolate"] = self.vis_interpolation.selectedItems()[0].text() config["sum_chan"] = self.sum_chan.isChecked() diff --git a/src/locpix/scripts/img_seg/get_markers.py b/src/locpix/scripts/img_seg/get_markers.py index 1b32340..7dd61fc 100644 --- a/src/locpix/scripts/img_seg/get_markers.py +++ b/src/locpix/scripts/img_seg/get_markers.py @@ -43,7 +43,7 @@ def main(): else: root = tk.Tk() root.withdraw() - project_folder = filedialog.askdirectory() + project_folder = filedialog.askdirectory(title="Project directory") if args.config is not None: # load yaml @@ -95,6 +95,11 @@ def main(): # save np.save(markers_loc, markers) + # save yaml file + yaml_save_loc = os.path.join(project_folder, "get_markers.yaml") + with open(yaml_save_loc, "w") as outfile: + yaml.dump(config, outfile) + if __name__ == "__main__": main() diff --git a/src/locpix/scripts/img_seg/get_markers_config.py b/src/locpix/scripts/img_seg/get_markers_config.py index bab33c9..8735b36 100644 --- a/src/locpix/scripts/img_seg/get_markers_config.py +++ b/src/locpix/scripts/img_seg/get_markers_config.py @@ -104,7 +104,7 @@ def set_config(self, config): Args: config (dictionary) : Configuration dict""" - config["vis_threshold"] = self.vis_threshold + config["vis_threshold"] = float(self.vis_threshold) config["vis_interpolate"] = self.vis_interpolation.selectedItems()[0].text() # check config is correct diff --git a/src/locpix/scripts/img_seg/ilastik_output.py b/src/locpix/scripts/img_seg/ilastik_output.py index a013706..4559ebf 100644 --- a/src/locpix/scripts/img_seg/ilastik_output.py +++ b/src/locpix/scripts/img_seg/ilastik_output.py @@ -43,7 +43,7 @@ def main(): else: root = tk.Tk() root.withdraw() - project_folder = filedialog.askdirectory() + project_folder = filedialog.askdirectory(title="Project directory") if args.config is not None: # load yaml @@ -64,20 +64,23 @@ def main(): output_membrane_prob = os.path.join( project_folder, "ilastik/output/membrane/prob_map" ) - if not os.path.exists(output_membrane_prob): - print("Making folder") + if os.path.exists(output_membrane_prob): + raise ValueError(f"Cannot proceed as {output_membrane_prob} already exists") + else: os.makedirs(output_membrane_prob) # if output directory not present create it output_cell_df = os.path.join(project_folder, "ilastik/output/cell/dataframe") - if not os.path.exists(output_cell_df): - print("Making folder") + if os.path.exists(output_cell_df): + raise ValueError(f"Cannot proceed as {output_cell_df} already exists") + else: os.makedirs(output_cell_df) # if output directory not present create it output_cell_img = os.path.join(project_folder, "ilastik/output/cell/img") - if not os.path.exists(output_cell_img): - print("Making folder") + if os.path.exists(output_cell_img): + raise ValueError(f"Cannot proceed as {output_cell_img} already exists") + else: os.makedirs(output_cell_img) for file in files: @@ -146,6 +149,11 @@ def main(): four_colour=True, ) + # save yaml file + yaml_save_loc = os.path.join(project_folder, "ilastik_output.yaml") + with open(yaml_save_loc, "w") as outfile: + yaml.dump(config, outfile) + if __name__ == "__main__": main() diff --git a/src/locpix/scripts/img_seg/ilastik_output_config.py b/src/locpix/scripts/img_seg/ilastik_output_config.py index e65eda1..affd3cf 100644 --- a/src/locpix/scripts/img_seg/ilastik_output_config.py +++ b/src/locpix/scripts/img_seg/ilastik_output_config.py @@ -105,7 +105,7 @@ def set_config(self, config): Args: config (dictionary) : Configuration dict""" - config["vis_threshold"] = int(self.vis_threshold.text()) + config["vis_threshold"] = float(self.vis_threshold.text()) config["vis_interpolate"] = self.vis_interpolate.selectedItems()[0].text() # check config is correct diff --git a/src/locpix/scripts/img_seg/ilastik_prep.py b/src/locpix/scripts/img_seg/ilastik_prep.py index 79201e0..41272e3 100644 --- a/src/locpix/scripts/img_seg/ilastik_prep.py +++ b/src/locpix/scripts/img_seg/ilastik_prep.py @@ -42,7 +42,7 @@ def main(): else: root = tk.Tk() root.withdraw() - project_folder = filedialog.askdirectory() + project_folder = filedialog.askdirectory(title="Project directory") if args.config is not None: # load yaml @@ -61,8 +61,9 @@ def main(): # if output directory not present create it output_folder = os.path.join(project_folder, "ilastik/prep") - if not os.path.exists(output_folder): - print("Making folder") + if os.path.exists(output_folder): + raise ValueError(f"Cannot proceed as {output_folder} already exists") + else: os.makedirs(output_folder) for file in files: @@ -87,6 +88,11 @@ def main(): save_loc = os.path.join(output_folder, file_name + ".npy") np.save(save_loc, img) + # save yaml file + yaml_save_loc = os.path.join(project_folder, "ilastik_prep.yaml") + with open(yaml_save_loc, "w") as outfile: + yaml.dump(config, outfile) + if __name__ == "__main__": main() diff --git a/src/locpix/scripts/img_seg/ilastik_prep_config.py b/src/locpix/scripts/img_seg/ilastik_prep_config.py index 541cf5f..14e0a32 100644 --- a/src/locpix/scripts/img_seg/ilastik_prep_config.py +++ b/src/locpix/scripts/img_seg/ilastik_prep_config.py @@ -104,7 +104,7 @@ def set_config(self, config): Args: config (dictionary) : Configuration dict""" - config["threshold"] = int(self.threshold.text()) + config["threshold"] = float(self.threshold.text()) config["interpolation"] = self.interpolation.selectedItems()[0].text() # check config is correct diff --git a/src/locpix/scripts/img_seg/membrane_performance.py b/src/locpix/scripts/img_seg/membrane_performance.py index adccc77..aca49d3 100644 --- a/src/locpix/scripts/img_seg/membrane_performance.py +++ b/src/locpix/scripts/img_seg/membrane_performance.py @@ -62,7 +62,7 @@ def main(): else: root = tk.Tk() root.withdraw() - project_folder = filedialog.askdirectory() + project_folder = filedialog.askdirectory(title="Project directory") if args.config is not None: # load yaml @@ -72,7 +72,7 @@ def main(): else: root = tk.Tk() root.withdraw() - gt_file_path = filedialog.askdirectory() + gt_file_path = filedialog.askdirectory(title="GT file path") config = membrane_performance_config.config_gui(gt_file_path) # list items @@ -134,8 +134,9 @@ def main(): for folder in folders: # if output directory not present create it - if not os.path.exists(folder): - print("Making folder") + if os.path.exists(folder): + raise ValueError(f"Cannot proceed as {folder} already exists") + else: os.makedirs(folder) print("Train set...") @@ -368,6 +369,11 @@ def main(): fig_train.savefig(os.path.join(output_overlay_pr_curves, "_train.png"), dpi=600) fig_test.savefig(os.path.join(output_overlay_pr_curves, "_test.png"), dpi=600) + # save yaml file + yaml_save_loc = os.path.join(project_folder, "membrane_performance.yaml") + with open(yaml_save_loc, "w") as outfile: + yaml.dump(config, outfile) + if __name__ == "__main__": main() diff --git a/src/locpix/scripts/img_seg/membrane_performance_config.py b/src/locpix/scripts/img_seg/membrane_performance_config.py index 9018b56..53ff0de 100644 --- a/src/locpix/scripts/img_seg/membrane_performance_config.py +++ b/src/locpix/scripts/img_seg/membrane_performance_config.py @@ -171,7 +171,7 @@ def set_config(self, config): self.test_files.item(x).text() for x in range(self.test_files.count()) ] config["maximise_choice"] = self.maximise_choice.selectedItems()[0].text() - config["vis_threshold"] = int(self.vis_threshold.text()) + config["vis_threshold"] = float(self.vis_threshold.text()) config["vis_interpolate"] = self.vis_interpolate.selectedItems()[0].text() # check config is correct diff --git a/src/locpix/scripts/preprocessing/annotate.py b/src/locpix/scripts/preprocessing/annotate.py index 8ff543c..4827ccd 100644 --- a/src/locpix/scripts/preprocessing/annotate.py +++ b/src/locpix/scripts/preprocessing/annotate.py @@ -43,7 +43,7 @@ def main(): else: root = tk.Tk() root.withdraw() - project_folder = filedialog.askdirectory() + project_folder = filedialog.askdirectory(title="Project directory") # configuration folder if args.config is not None: @@ -56,6 +56,7 @@ def main(): # list items input_folder = os.path.join(project_folder, "preprocess/no_gt_label") + print(input_folder) try: files = os.listdir(input_folder) except FileNotFoundError: @@ -63,20 +64,23 @@ def main(): # if output directory not present create it output_folder = os.path.join(project_folder, "annotate/annotated") - if not os.path.exists(output_folder): - print("Making folder") + if os.path.exists(output_folder): + raise ValueError(f"Cannot proceed as {output_folder} already exists") + else: os.makedirs(output_folder) # if output directory for seg imgs not present create it output_seg_folder = os.path.join(project_folder, "annotate/seg_imgs") - if not os.path.exists(output_seg_folder): - print("Making folder") + if os.path.exists(output_seg_folder): + raise ValueError(f"Cannot proceed as {output_seg_folder} already exists") + else: os.makedirs(output_seg_folder) # if output directory for seg imgs not present create it histo_folder = os.path.join(project_folder, "annotate/histos") - if not os.path.exists(histo_folder): - print("Making folder") + if os.path.exists(histo_folder): + raise ValueError(f"Cannot proceed as {histo_folder} already exists") + else: os.makedirs(histo_folder) if config["dim"] == 2: @@ -134,7 +138,7 @@ def main(): ) # save yaml file - yaml_save_loc = os.path.join(project_folder, "annotate/annotate.yaml") + yaml_save_loc = os.path.join(project_folder, "annotate.yaml") with open(yaml_save_loc, "w") as outfile: yaml.dump(config, outfile) diff --git a/src/locpix/scripts/preprocessing/annotate_config.py b/src/locpix/scripts/preprocessing/annotate_config.py index 0f5b1b3..d1934d3 100644 --- a/src/locpix/scripts/preprocessing/annotate_config.py +++ b/src/locpix/scripts/preprocessing/annotate_config.py @@ -299,21 +299,21 @@ def set_config(self, config): 1: self.gt_label_map_one.text(), } config["save_img"] = self.save_img.isChecked() - config["save_threshold"] = int(self.save_threshold.text()) + config["save_threshold"] = float(self.save_threshold.text()) config["save_interpolate"] = self.save_interpolation.selectedItems()[0].text() config["background_one_colour"] = self.background_one_colour.isChecked() config["four_colour"] = self.four_colour.isChecked() config["alphas"] = [ - self.alpha_zero.text(), - self.alpha_one.text(), - self.alpha_two.text(), - self.alpha_three.text(), + float(self.alpha_zero.text()), + float(self.alpha_one.text()), + float(self.alpha_two.text()), + float(self.alpha_three.text()), ] - config["alpha_seg"] = self.alpha_seg.text() + config["alpha_seg"] = float(self.alpha_seg.text()) config["cmap_seg"] = [self.zero_cmap.text(), self.one_cmap.text()] config["fig_size"] = [int(self.fig_size_x.text()), int(self.fig_size_y.text())] config["vis_channels"] = [ - item.text() for item in self.vis_channels.selectedItems() + int(item.text()) for item in self.vis_channels.selectedItems() ] # check config is correct diff --git a/src/locpix/scripts/preprocessing/preprocess.py b/src/locpix/scripts/preprocessing/preprocess.py index 82e9045..817e21d 100644 --- a/src/locpix/scripts/preprocessing/preprocess.py +++ b/src/locpix/scripts/preprocessing/preprocess.py @@ -30,12 +30,12 @@ def main(): parser.add_argument( "-i", "--input", action="store", type=str, help="path for the input data folder" ) - # parser.add_argument( - # "-s", - # "--sanitycheck", - # action="store_true", - # help="whether to check correct csvs loaded in", - # ) + parser.add_argument( + "-s", + "--sanitycheck", + action="store_true", + help="whether to check correct csvs loaded in", + ) parser.add_argument( "-c", "--config", @@ -61,11 +61,11 @@ def main(): # input data folder if args.input is not None: - csv_path = args.folder + csv_path = args.input else: root = tk.Tk() root.withdraw() - csv_path = filedialog.askdirectory() + csv_path = filedialog.askdirectory(title="Data folder") # project folder if args.project_directory is not None: @@ -73,14 +73,14 @@ def main(): else: root = tk.Tk() root.withdraw() - project_folder = filedialog.askdirectory() + project_folder = filedialog.askdirectory(title="Project folder") # if output directory not present create it - output_folder = os.path.join(project_folder, "preprocess/no_gt_labels") + output_folder = os.path.join(project_folder, "preprocess/no_gt_label") if os.path.exists(output_folder): raise ValueError( "You cannot choose this project folder" - " as it already contains prprocessed data" + " as it already contains preprocessed data" ) else: os.makedirs(output_folder) @@ -123,7 +123,6 @@ def main(): config["z_col"], config["channel_choice"], ) - # have to not drop zero label # as no gt_label yet item.save_to_parquet( diff --git a/src/locpix/templates/cellpose_train.yaml b/src/locpix/templates/cellpose_train.yaml index 1e4224b..d828834 100644 --- a/src/locpix/templates/cellpose_train.yaml +++ b/src/locpix/templates/cellpose_train.yaml @@ -2,7 +2,7 @@ gpu: True # model parameters -model: pointnet +model: LC1 # optimiser parameters optimiser: adam diff --git a/src/locpix/visualise/vis_img.py b/src/locpix/visualise/vis_img.py index 84f6b72..59698bc 100644 --- a/src/locpix/visualise/vis_img.py +++ b/src/locpix/visualise/vis_img.py @@ -149,7 +149,7 @@ def visualise_seg( # and add white to cmap_seg --> ensures # background comes up as untouched segmentation = np.where(segmentation != 0, four_colour_seg + 1, 0) - cmap_seg.insert(0, "w") + cmap_seg = ["w"] + cmap_seg else: segmentation = label_2_4_colours(segmentation)