forked from labsyspharm/mcmicro-ilastik
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathParseInput.py
32 lines (28 loc) · 1.58 KB
/
ParseInput.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#Functions for parsing command line arguments for ome ilastik prep
import argparse
def ParseInputOME():
"""Function for parsing command line arguments for input to ilastik prep functions"""
#if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument('--input',nargs='*', help="enter path to images with spaces between each image (Ex: /path1/image1.ome.tiff /path2/image2.ome.tiff)")
parser.add_argument('--output',nargs='*')
parser.add_argument('--crop', action='store_true',default = False)
parser.add_argument('--no-crop', dest='crop', action='store_false')
parser.add_argument('--crop_size',type=int,nargs='*')
parser.add_argument('--nonzero_fraction',type=float)
parser.add_argument('--nuclei_index',type=int)
parser.add_argument('--num_channels',type=int)
parser.add_argument('--channelIDs',type=int,nargs='*')
parser.add_argument('--ring_mask', action='store_true',default = False)
parser.add_argument('--no-ring_mask', dest='ring_mask', action='store_false')
parser.add_argument('--crop_amount', type=int)
args = parser.parse_args()
#Create a dictionary object to pass to the next function
dict = {'input': args.input, 'output': args.output, 'crop': args.crop,\
'crop_size':args.crop_size,'nonzero_fraction':args.nonzero_fraction,\
'nuclei_index':args.nuclei_index, 'num_channels':args.num_channels,\
'channelIDs':args.channelIDs,'ring_mask':args.ring_mask, 'crop_amount':args.crop_amount}
#Print the dictionary object
print(dict)
#Return the dictionary
return dict