-
Notifications
You must be signed in to change notification settings - Fork 1
/
perform_simple_segmentation.py
22 lines (18 loc) · 1.41 KB
/
perform_simple_segmentation.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import argparse
from annotate.batch_processing import perfrom_simple_intensity_based_segmentation
# Parse the input arguments
options = argparse.ArgumentParser(description = "Correct annotations for a given set of images")
options.add_argument('--datadir', help = 'directory of raw images' , default = 'data/nuc_imgs/')
options.add_argument('--savedir', help = 'directory to output segmentations', default = 'data/nuc_labeled/')
options.add_argument('--sigma', type = int, help = 'sigma to use for the gaussian filter', default = 1)
options.add_argument('--threshold_method', type = str, help = 'threshold method', default = "Otsu")
options.add_argument('--smallest_obj_area', type = int, help = 'Area of the smallest object(in pixels)', default = 25)
options.add_argument('--anno_depth', type = str, help = 'Depth of the annotated image', default = "8bit")
arguments = options.parse_args()
# normalize the images in the folder
perfrom_simple_intensity_based_segmentation(path_to_input_dir = arguments.datadir,
path_to_output_dir = arguments.savedir,
fil_sigma = arguments.sigma,
threshold_method = arguments.threshold_method,
smallest_object_area = arguments.smallest_obj_area,
label_img_depth = arguments.anno_depth)