required=False, help='List of fields of view to analyze. Input "1", "1,2,3", etc. ') parser.add_argument('-t', '--traindir', type=str, required=True, help='Absolute path to the directory where you want your "images" and "masks" training data directories to be created and images to be saved.') parser.add_argument('-c', '--channel', type=int, required=False, default=1, help='Which channel, e.g. phase or some fluorescence image, should be used for creating masks. \ Accepts integers. Default is 1, which is usually your phase contrast images.') parser.add_argument('-n', '--no_prior_mask', action='store_true', help='Apply this argument is you are making masks de novo, i.e., if no masks exist yet for your images.') namespace = parser.parse_args() # Load the project parameters file mm3.information('Loading experiment parameters.') training_dir = namespace.traindir if not os.path.exists(training_dir): mm3.warning('Training directory not found, making directory.') os.makedirs(training_dir) if namespace.paramfile: param_file_path = namespace.paramfile else: 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 = []
parser.add_argument('-f', '--paramfile', type=str, required=True, help='Yaml file containing parameters.') parser.add_argument('-o', '--fov', type=str, required=False, help='List of fields of view to analyze. Input "1", "1,2,3", or "1-10", etc.') parser.add_argument('-j', '--nproc', type=int, required=False, help='Number of processors to use.') parser.add_argument('-c', '--color', type=str, required=False, help='Color plane to subtract. "c1", "c2", etc.') namespace = parser.parse_args() # Load the project parameters file mm3.information('Loading experiment parameters.') if namespace.paramfile: param_file_path = namespace.paramfile else: 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 if namespace.fov: if '-' in namespace.fov: user_spec_fovs = range(int(namespace.fov.split("-")[0]), int(namespace.fov.split("-")[1])+1) else: user_spec_fovs = [int(val) for val in namespace.fov.split(",")] else: user_spec_fovs = [] # number of threads for multiprocessing if namespace.nproc: p['num_analyzers'] = namespace.nproc
gnuoptions = ["paramfile=", "fov=", "picklefile="] opts, args = getopt.getopt(sys.argv[1:], unixoptions, gnuoptions) # switches which may be overwritten param_file_path = '' except getopt.GetoptError: warning('No arguments detected (-f -o).') for opt, arg in opts: if opt in ['-f', "--paramfile"]: param_file_path = arg # parameter file path if opt in ['-o', "--fov"]: try: for fov_to_proc in arg.split(","): user_spec_fovs.append(int(fov_to_proc)) except: mm3.warning("Couldn't convert -o argument to an integer:", arg) raise ValueError if opt in ['-p', "--picklefile"]: pklfile = arg # parameter file path # Load the project parameters file if len(param_file_path) == 0: raise ValueError("A parameter file must be specified (-f <filename>).") mm3.information('Loading experiment parameters and cell data.') with open(param_file_path, 'r') as param_file: allparams = yaml.safe_load(param_file) # loads and returns pklfile = os.path.join(allparams['cell_dir'], 'complete_cells_mothers.pkl') print('using complete_cells.pkl') with open(pklfile, 'rb') as cell_file:
# set switches and parameters parser = argparse.ArgumentParser(prog='python mm3_Foci.py', description='Finds foci.') parser.add_argument('-f', '--paramfile', type=str, required=True, help='Yaml file containing parameters.') parser.add_argument('-c', '--cellfile', type=str, required=False, help='Path to Cell object dicionary to analyze. Defaults to complete_cells.pkl.') namespace = parser.parse_args() # Load the project parameters file mm3.information('Loading experiment parameters.') if namespace.paramfile: param_file_path = namespace.paramfile else: 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 # load cell file mm3.information('Loading cell data.') if namespace.cellfile: cell_file_path = namespace.cellfile else: mm3.warning('No cell file specified. Using complete_cells.pkl.') cell_file_path = os.path.join(p['cell_dir'], 'complete_cells.pkl') with open(cell_file_path, 'rb') as cell_file: Cells = pickle.load(cell_file) # load specs file
action='store_true', required=False, help='Load cross correlation data instead of computing.') parser.add_argument('-s', '--specfile', type=str, required=False, help='Path to spec.yaml file.') namespace = parser.parse_args() # Load the project parameters file mm3.information('Loading experiment parameters.') if namespace.paramfile: param_file_path = namespace.paramfile else: 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 if namespace.fov: if '-' in namespace.fov: user_spec_fovs = range(int(namespace.fov.split("-")[0]), int(namespace.fov.split("-")[1]) + 1) else: user_spec_fovs = [int(val) for val in namespace.fov.split(",")] else: user_spec_fovs = [] # number of threads for multiprocessing if namespace.nproc: p['num_analyzers'] = namespace.nproc