44import h5py
55import imageio .v3 as imageio
66import napari
7+ import pandas as pd
78import zarr
89
10+ # from skimage.feature import blob_dog
11+ from skimage .feature import peak_local_max
912from torch_em .util import load_model
1013from torch_em .util .prediction import predict_with_halo
1114from train_synapse_detection import get_paths
@@ -34,10 +37,22 @@ def require_prediction(image_data, output_path):
3437 return pred
3538
3639
37- def visualize_results (image_data , pred ):
40+ def run_postprocessing (pred ):
41+ # print("Running local max ...")
42+ # coords = blob_dog(pred)
43+ coords = peak_local_max (pred , min_distance = 2 , threshold_abs = 0.2 )
44+ # print("... done")
45+ return coords
46+
47+
48+ def visualize_results (image_data , pred , coords = None , val_coords = None ):
3849 v = napari .Viewer ()
3950 v .add_image (image_data )
4051 v .add_image (pred )
52+ if coords is None :
53+ v .add_points (coords , name = "predicted_synapses" )
54+ if val_coords is None :
55+ v .add_points (val_coords , face_color = "green" , name = "synapse_annotations" )
4156 napari .run ()
4257
4358
@@ -59,6 +74,7 @@ def check_new_images():
5974 output_folder = os .path .join (OUTPUT_ROOT , "new_crops" )
6075 os .makedirs (output_folder , exist_ok = True )
6176 for path in tqdm (inputs ):
77+ print (path )
6278 name = os .path .basename (path )
6379 if name == "M_AMD_58L_avgblendfused_RibB.tif" :
6480 continue
0 commit comments