mm3.warning('No param file specified. Using 100X template.') param_file_path = 'yaml_templates/params_SJ110_100X.yaml' p = mm3.init_mm3_helpers(param_file_path) # initialized the helper library GUI.init_params(param_file_path) if namespace.fov: user_spec_fovs = [int(val) for val in namespace.fov.split(",")] else: user_spec_fovs = [] if not os.path.exists(p['seg_dir']): sys.exit("Exiting: Segmentation directory, {}, not found.".format(p['seg_dir'])) if not os.path.exists(p['chnl_dir']): sys.exit("Exiting: Channel directory, {}, not found.".format(p['chnl_dir'])) specs = mm3.load_specs() # make list of FOVs to process (keys of channel_mask file) fov_id_list = sorted([fov_id for fov_id in specs.keys()]) # remove fovs if the user specified so if user_spec_fovs: fov_id_list[:] = [fov for fov in fov_id_list if fov in user_spec_fovs] # set segmentation image name for segmented images seg_suffix_finder = re.compile(r'.+(seg_.+)\.tif$') test_name = glob.glob(os.path.join(p['seg_dir'],'*xy{:0=3}*.tif'.format(fov_id_list[0])))[0] mat = seg_suffix_finder.match(test_name) p['seg_img'] = mat.groups()[0] ## be careful here, it is lookgin for segmented images # get paired phase file names and mask file names for each fov fov_filename_dict = {} for fov_id in fov_id_list:
else: user_spec_peaks = [] # set segmentation image name for saving and loading segmented images if namespace.command == 'cells': p['seg_img'] = 'seg_unet' elif namespace.command == 'foci': p['seg_img'] = 'foci_seg_unet' else: sys.exit( "ERROR: your final argument to {} must be either 'cells' or 'foci'" .format(sys.argv[0])) # load specs file if namespace.chtc: specs = mm3.load_specs(fname=namespace.specfile) mm3.load_time_table(fname=namespace.timefile) else: specs = mm3.load_specs() mm3.load_time_table() if namespace.command == 'cells': if namespace.phase_file_name: track_single_file(namespace.phase_file_name, namespace.seg_file_name, p, namespace) if not os.path.exists(p['cell_dir']): os.makedirs(p['cell_dir']) # make list of FOVs to process (keys of channel_mask file) fov_id_list = sorted([fov_id for fov_id in specs.keys()])